zhuyifan

农信点餐小程序

Showing 37 changed files with 2649 additions and 31 deletions
...@@ -6,13 +6,12 @@ ...@@ -6,13 +6,12 @@
6 */ 6 */
7 7
8 plugins { 8 plugins {
9 - // Apply the application plugin to add support for building a CLI application in Java.
10 id 'java' 9 id 'java'
11 id 'idea' 10 id 'idea'
12 id 'application' 11 id 'application'
13 - id 'org.springframework.boot' version '2.3.3.RELEASE' 12 + id 'org.springframework.boot' version '2.5.12'
14 - id 'io.spring.dependency-management' version '1.0.10.RELEASE' 13 + id 'io.spring.dependency-management' version '1.1.6'
15 - id 'com.google.protobuf' version '0.9.3' 14 + id 'com.google.protobuf' version '0.9.4'
16 } 15 }
17 16
18 repositories { 17 repositories {
...@@ -29,8 +28,8 @@ application { ...@@ -29,8 +28,8 @@ application {
29 } 28 }
30 29
31 ext { 30 ext {
32 - grpcVersion = '1.39.0' 31 + grpcVersion = '1.62.2'
33 - protobufVersion = '3.17.2' 32 + protobufVersion = '3.25.3'
34 } 33 }
35 34
36 dependencies { 35 dependencies {
...@@ -55,20 +54,13 @@ dependencies { ...@@ -55,20 +54,13 @@ dependencies {
55 testImplementation "io.grpc:grpc-testing:${grpcVersion}" 54 testImplementation "io.grpc:grpc-testing:${grpcVersion}"
56 } 55 }
57 56
58 -static def isAppleSilicon() {
59 - // 检测 macOS 并且使用的是 Apple Silicon 架构
60 - return System.getProperty('os.name').toLowerCase().contains('mac') && System.getProperty('os.arch').equals('aarch64')
61 -}
62 -
63 -def protocPlatform = isAppleSilicon() ? ':osx-x86_64' : '';
64 -
65 protobuf { 57 protobuf {
66 protoc { 58 protoc {
67 - artifact = "com.google.protobuf:protoc:${protobufVersion}${protocPlatform}" 59 + artifact = "com.google.protobuf:protoc:${protobufVersion}"
68 } 60 }
69 plugins { 61 plugins {
70 grpc { 62 grpc {
71 - artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}${protocPlatform}" 63 + artifact = "io.grpc:protoc-gen-grpc-java:${grpcVersion}"
72 } 64 }
73 } 65 }
74 generateProtoTasks { 66 generateProtoTasks {
...@@ -87,6 +79,13 @@ tasks.withType(JavaCompile).configureEach { ...@@ -87,6 +79,13 @@ tasks.withType(JavaCompile).configureEach {
87 it.options.fork = true 79 it.options.fork = true
88 } 80 }
89 81
82 +tasks {
83 + compileJava {
84 + dependsOn generateProto
85 + source fileTree('build/generated/source/proto/main/java')
86 + }
87 +}
88 +
90 sourceSets { 89 sourceSets {
91 main { 90 main {
92 java { 91 java {
......
1 org.gradle.daemon=true 1 org.gradle.daemon=true
2 org.gradle.parallel=true 2 org.gradle.parallel=true
3 org.gradle.caching=true 3 org.gradle.caching=true
4 -org.gradle.jvmargs=-Xmx4096m -XX:MetaspaceSize=512m -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 4 +org.gradle.jvmargs=-Xmx8g -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
5 +org.gradle.incremental=true
5 org.gradle.configureondemand=true 6 org.gradle.configureondemand=true
6 -org.gradle.java.home=/usr/lib/jvm/java-11-openjdk-amd64
...\ No newline at end of file ...\ No newline at end of file
7 +org.gradle.configuration-cache=true
...\ No newline at end of file ...\ No newline at end of file
......
1 distributionBase=GRADLE_USER_HOME 1 distributionBase=GRADLE_USER_HOME
2 distributionPath=wrapper/dists 2 distributionPath=wrapper/dists
3 -distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-6.9-bin.zip 3 +distributionUrl=https://mirrors.cloud.tencent.com/gradle/gradle-8.11-bin.zip
4 networkTimeout=10000 4 networkTimeout=10000
5 zipStoreBase=GRADLE_USER_HOME 5 zipStoreBase=GRADLE_USER_HOME
6 zipStorePath=wrapper/dists 6 zipStorePath=wrapper/dists
7 +#org.gradle.java.home=/usr/lib/jvm/java-17-openjdk-amd64
...\ No newline at end of file ...\ No newline at end of file
......
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.Diner;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【diners(就餐人表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.Diner
11 +*/
12 +public interface DinerMapper extends MyBaseMapper<Diner> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.GradeClass;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【grade_classes(年级班级表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.GradeClass
11 +*/
12 +public interface GradeClassMapper extends MyBaseMapper<GradeClass> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.MealMenuRecord;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【meal_menu_records(餐单记录表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.MealMenuRecord
11 +*/
12 +public interface MealMenuRecordMapper extends MyBaseMapper<MealMenuRecord> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.MealOrder;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【meal_orders(订餐记录表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.MealOrder
11 +*/
12 +public interface MealOrderMapper extends MyBaseMapper<MealOrder> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.MpAccountDinerRef;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【mp_account_diner_refs(小程序账号和就餐人关联表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.MpAccountDinerRef
11 +*/
12 +public interface MpAccountDinerRefMapper extends MyBaseMapper<MpAccountDinerRef> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.mapper;
2 +
3 +import com.tianting.infoloop.inject.MyBaseMapper;
4 +import com.tianting.infoloop.model.db.MpAccount;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【mp_accounts(小程序账号表)】的数据库操作Mapper
9 +* @createDate 2025-04-10 13:22:20
10 +* @Entity com.tianting.infoloop.model.db.MpAccount
11 +*/
12 +public interface MpAccountMapper extends MyBaseMapper<MpAccount> {
13 +
14 +}
15 +
16 +
17 +
18 +
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableLogic;
8 +import com.baomidou.mybatisplus.annotation.TableName;
9 +import com.baomidou.mybatisplus.extension.activerecord.Model;
10 +import lombok.Data;
11 +import lombok.EqualsAndHashCode;
12 +import lombok.experimental.Accessors;
13 +
14 +import java.io.Serializable;
15 +import java.time.LocalDateTime;
16 +
17 +/**
18 + * @TableName diners
19 + */
20 +@Data
21 +@Accessors(chain = true)
22 +@EqualsAndHashCode(callSuper = true)
23 +@TableName(value ="diners")
24 +public class Diner extends Model<Diner> implements Serializable {
25 +
26 + @TableId(type = IdType.AUTO)
27 + private Integer id;
28 +
29 + private Integer enterpriseId;
30 +
31 + private Integer clientId;
32 +
33 + private Integer classId;
34 +
35 + private String studentNo;
36 +
37 + private String name;
38 +
39 + private Integer createdBy;
40 +
41 + @TableField(fill = FieldFill.INSERT)
42 + private LocalDateTime createdAt;
43 +
44 + private Integer creationSource;
45 +
46 + private Integer updatedBy;
47 +
48 + @TableField(fill = FieldFill.INSERT_UPDATE)
49 + private LocalDateTime updatedAt;
50 +
51 + private Integer updateSource;
52 +
53 + @TableLogic
54 + private Boolean isDeleted;
55 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName grade_classes
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="grade_classes")
23 +public class GradeClass extends Model<GradeClass> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private Integer clientId;
31 +
32 + private String gradeName;
33 +
34 + private String className;
35 +
36 + private String fullName;
37 +
38 + private Integer createdBy;
39 +
40 + @TableField(fill = FieldFill.INSERT)
41 + private LocalDateTime createdAt;
42 +
43 + private Integer creationSource;
44 +
45 + private Integer updatedBy;
46 +
47 + @TableField(fill = FieldFill.INSERT_UPDATE)
48 + private LocalDateTime updatedAt;
49 +
50 + private Integer updateSource;
51 +
52 + private Boolean isDeleted;
53 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName meal_menu_records
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="meal_menu_records")
23 +public class MealMenuRecord extends Model<MealMenuRecord> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private Integer clientId;
31 +
32 + private String name;
33 +
34 + private String imageUrl;
35 +
36 + private Integer createdBy;
37 +
38 + @TableField(fill = FieldFill.INSERT)
39 + private LocalDateTime createdAt;
40 +
41 + private Integer creationSource;
42 +
43 + private Integer updatedBy;
44 +
45 + @TableField(fill = FieldFill.INSERT_UPDATE)
46 + private LocalDateTime updatedAt;
47 +
48 + private Integer updateSource;
49 +
50 + private Boolean isDeleted;
51 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName meal_orders
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="meal_orders")
23 +public class MealOrder extends Model<MealOrder> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private Integer clientId;
31 +
32 + private Integer menuId;
33 +
34 + private Integer accountId;
35 +
36 + private Integer orderMethod;
37 +
38 + private Integer dinerId;
39 +
40 + private String dinerName;
41 +
42 + private String clientName;
43 +
44 + private String gradeName;
45 +
46 + private String className;
47 +
48 + private String studentNo;
49 +
50 + private LocalDateTime reserveDate;
51 +
52 + private String meals;
53 +
54 + private Integer createdBy;
55 +
56 + @TableField(fill = FieldFill.INSERT)
57 + private LocalDateTime createdAt;
58 +
59 + private Integer creationSource;
60 +
61 + private Integer updatedBy;
62 +
63 + @TableField(fill = FieldFill.INSERT_UPDATE)
64 + private LocalDateTime updatedAt;
65 +
66 + private Integer updateSource;
67 +
68 + private Boolean isDeleted;
69 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName mp_accounts
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="mp_accounts")
23 +public class MpAccount extends Model<MpAccount> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private String openId;
31 +
32 + private String unionId;
33 +
34 + private String nickname;
35 +
36 + private String avatarUrl;
37 +
38 + private Integer gender;
39 +
40 + private String phoneNumber;
41 +
42 + private Integer status;
43 +
44 + private Integer createdBy;
45 +
46 + @TableField(fill = FieldFill.INSERT)
47 + private LocalDateTime createdAt;
48 +
49 + private Integer creationSource;
50 +
51 + private Integer updatedBy;
52 +
53 + @TableField(fill = FieldFill.INSERT_UPDATE)
54 + private LocalDateTime updatedAt;
55 +
56 + private Integer updateSource;
57 +
58 + private Boolean isDeleted;
59 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.model.db;
2 +
3 +import com.baomidou.mybatisplus.annotation.FieldFill;
4 +import com.baomidou.mybatisplus.annotation.IdType;
5 +import com.baomidou.mybatisplus.annotation.TableField;
6 +import com.baomidou.mybatisplus.annotation.TableId;
7 +import com.baomidou.mybatisplus.annotation.TableName;
8 +import com.baomidou.mybatisplus.extension.activerecord.Model;
9 +import lombok.Data;
10 +import lombok.EqualsAndHashCode;
11 +import lombok.experimental.Accessors;
12 +
13 +import java.io.Serializable;
14 +import java.time.LocalDateTime;
15 +
16 +/**
17 + * @TableName mp_account_diner_refs
18 + */
19 +@Data
20 +@Accessors(chain = true)
21 +@EqualsAndHashCode(callSuper = true)
22 +@TableName(value ="mp_account_diner_refs")
23 +public class MpAccountDinerRef extends Model<MpAccountDinerRef> implements Serializable {
24 +
25 + @TableId(type = IdType.AUTO)
26 + private Integer id;
27 +
28 + private Integer enterpriseId;
29 +
30 + private Integer accountId;
31 +
32 + private Integer dinerId;
33 +
34 + private Integer createdBy;
35 +
36 + @TableField(fill = FieldFill.INSERT)
37 + private LocalDateTime createdAt;
38 +
39 + private Integer creationSource;
40 +}
...\ No newline at end of file ...\ No newline at end of file
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.Diner;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【diners(就餐人表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface DinerService extends IService<Diner> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.GradeClass;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【grade_classes(年级班级表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface GradeClassService extends IService<GradeClass> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.MealMenuRecord;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【meal_menu_records(餐单记录表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface MealMenuRecordService extends IService<MealMenuRecord> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.MealOrder;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【meal_orders(订餐记录表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface MealOrderService extends IService<MealOrder> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.MpAccountDinerRef;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【mp_account_diner_refs(小程序账号和就餐人关联表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface MpAccountDinerRefService extends IService<MpAccountDinerRef> {
12 +
13 +}
1 +package com.tianting.infoloop.service;
2 +
3 +import com.baomidou.mybatisplus.extension.service.IService;
4 +import com.tianting.infoloop.model.db.MpAccount;
5 +
6 +/**
7 +* @author zhuyf
8 +* @description 针对表【mp_accounts(小程序账号表)】的数据库操作Service
9 +* @createDate 2025-04-10 13:22:20
10 +*/
11 +public interface MpAccountService extends IService<MpAccount> {
12 +
13 +}
1 +package com.tianting.infoloop.service.grpc;
2 +
3 +import cn.hutool.core.date.LocalDateTimeUtil;
4 +import com.baomidou.dynamic.datasource.annotation.DS;
5 +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
6 +import com.baomidou.mybatisplus.core.toolkit.Wrappers;
7 +import com.infoloop.tianting.mealorderservice.BatchCreateGradeClassesRpcRequest;
8 +import com.infoloop.tianting.mealorderservice.BatchCreateGradeClassesRpcResponse;
9 +import com.infoloop.tianting.mealorderservice.BatchSaveOrUpdateDinersRpcRequest;
10 +import com.infoloop.tianting.mealorderservice.BatchSaveOrUpdateDinersRpcResponse;
11 +import com.infoloop.tianting.mealorderservice.BatchSaveOrUpdateGradeClassesRpcRequest;
12 +import com.infoloop.tianting.mealorderservice.BatchSaveOrUpdateGradeClassesRpcResponse;
13 +import com.infoloop.tianting.mealorderservice.CreateDinerRpcRequest;
14 +import com.infoloop.tianting.mealorderservice.CreateDinerRpcResponse;
15 +import com.infoloop.tianting.mealorderservice.CreateGradeClassRpcRequest;
16 +import com.infoloop.tianting.mealorderservice.CreateGradeClassRpcResponse;
17 +import com.infoloop.tianting.mealorderservice.CreateMealMenuRecordRpcRequest;
18 +import com.infoloop.tianting.mealorderservice.CreateMealMenuRecordRpcResponse;
19 +import com.infoloop.tianting.mealorderservice.CreateMealOrderRpcRequest;
20 +import com.infoloop.tianting.mealorderservice.CreateMealOrderRpcResponse;
21 +import com.infoloop.tianting.mealorderservice.CreateMpAccountDinerRefRpcRequest;
22 +import com.infoloop.tianting.mealorderservice.CreateMpAccountDinerRefRpcResponse;
23 +import com.infoloop.tianting.mealorderservice.CreateMpAccountRpcRequest;
24 +import com.infoloop.tianting.mealorderservice.CreateMpAccountRpcResponse;
25 +import com.infoloop.tianting.mealorderservice.DeleteDinersByIdsRpcRequest;
26 +import com.infoloop.tianting.mealorderservice.DeleteDinersRpcResponse;
27 +import com.infoloop.tianting.mealorderservice.DeleteGradeClassesAndDinersByClientIdsRpcRequest;
28 +import com.infoloop.tianting.mealorderservice.DeleteGradeClassesAndDinersByClientIdsRpcResponse;
29 +import com.infoloop.tianting.mealorderservice.DeleteGradeClassesByIdsRpcRequest;
30 +import com.infoloop.tianting.mealorderservice.DeleteGradeClassesRpcResponse;
31 +import com.infoloop.tianting.mealorderservice.DeleteMealOrdersByIdsRpcRequest;
32 +import com.infoloop.tianting.mealorderservice.DeleteMealOrdersRpcResponse;
33 +import com.infoloop.tianting.mealorderservice.DeleteMpAccountDinerRefsByIdsRpcRequest;
34 +import com.infoloop.tianting.mealorderservice.DeleteMpAccountDinerRefsRpcResponse;
35 +import com.infoloop.tianting.mealorderservice.DeleteMpAccountsByIdsRpcRequest;
36 +import com.infoloop.tianting.mealorderservice.DeleteMpAccountsRpcResponse;
37 +import com.infoloop.tianting.mealorderservice.DinerModification;
38 +import com.infoloop.tianting.mealorderservice.GetDinerByIdRpcRequest;
39 +import com.infoloop.tianting.mealorderservice.GetDinerByIdRpcResponse;
40 +import com.infoloop.tianting.mealorderservice.GetDinersByIdsRpcRequest;
41 +import com.infoloop.tianting.mealorderservice.GetDinersByIdsRpcResponse;
42 +import com.infoloop.tianting.mealorderservice.GetGradeClassByIdRpcRequest;
43 +import com.infoloop.tianting.mealorderservice.GetGradeClassByIdRpcResponse;
44 +import com.infoloop.tianting.mealorderservice.GetGradeClassesByIdsRpcRequest;
45 +import com.infoloop.tianting.mealorderservice.GetGradeClassesByIdsRpcResponse;
46 +import com.infoloop.tianting.mealorderservice.GetMealMenuRecordByIdRpcRequest;
47 +import com.infoloop.tianting.mealorderservice.GetMealMenuRecordByIdRpcResponse;
48 +import com.infoloop.tianting.mealorderservice.GetMealMenuRecordsByIdsRpcRequest;
49 +import com.infoloop.tianting.mealorderservice.GetMealMenuRecordsByIdsRpcResponse;
50 +import com.infoloop.tianting.mealorderservice.GetMealOrderByIdRpcRequest;
51 +import com.infoloop.tianting.mealorderservice.GetMealOrderByIdRpcResponse;
52 +import com.infoloop.tianting.mealorderservice.GetMealOrdersByIdsRpcRequest;
53 +import com.infoloop.tianting.mealorderservice.GetMealOrdersByIdsRpcResponse;
54 +import com.infoloop.tianting.mealorderservice.GetMpAccountByIdRpcRequest;
55 +import com.infoloop.tianting.mealorderservice.GetMpAccountByIdRpcResponse;
56 +import com.infoloop.tianting.mealorderservice.GetMpAccountDinerRefsByIdsRpcRequest;
57 +import com.infoloop.tianting.mealorderservice.GetMpAccountDinerRefsByIdsRpcResponse;
58 +import com.infoloop.tianting.mealorderservice.GetMpAccountsByIdsRpcRequest;
59 +import com.infoloop.tianting.mealorderservice.GetMpAccountsByIdsRpcResponse;
60 +import com.infoloop.tianting.mealorderservice.MealOrderServiceRpcGrpc;
61 +import com.infoloop.tianting.mealorderservice.QueryDinersByConditionRpcRequest;
62 +import com.infoloop.tianting.mealorderservice.QueryDinersByConditionRpcResponse;
63 +import com.infoloop.tianting.mealorderservice.QueryGradeClassesByConditionRpcRequest;
64 +import com.infoloop.tianting.mealorderservice.QueryGradeClassesByConditionRpcResponse;
65 +import com.infoloop.tianting.mealorderservice.QueryMealMenuRecordsByConditionRpcRequest;
66 +import com.infoloop.tianting.mealorderservice.QueryMealMenuRecordsByConditionRpcResponse;
67 +import com.infoloop.tianting.mealorderservice.QueryMealOrdersByConditionRpcRequest;
68 +import com.infoloop.tianting.mealorderservice.QueryMealOrdersByConditionRpcResponse;
69 +import com.infoloop.tianting.mealorderservice.QueryMpAccountDinerRefsByConditionRpcRequest;
70 +import com.infoloop.tianting.mealorderservice.QueryMpAccountDinerRefsByConditionRpcResponse;
71 +import com.infoloop.tianting.mealorderservice.QueryMpAccountsByConditionRpcRequest;
72 +import com.infoloop.tianting.mealorderservice.QueryMpAccountsByConditionRpcResponse;
73 +import com.infoloop.tianting.mealorderservice.SingleDinerRpcResponse;
74 +import com.infoloop.tianting.mealorderservice.SingleGradeClassRpcResponse;
75 +import com.infoloop.tianting.mealorderservice.SingleMealMenuRecordRpcResponse;
76 +import com.infoloop.tianting.mealorderservice.SingleMealOrderRpcResponse;
77 +import com.infoloop.tianting.mealorderservice.SingleMpAccountDinerRefRpcResponse;
78 +import com.infoloop.tianting.mealorderservice.SingleMpAccountRpcResponse;
79 +import com.infoloop.tianting.mealorderservice.UpdateDinerRpcRequest;
80 +import com.infoloop.tianting.mealorderservice.UpdateDinerRpcResponse;
81 +import com.infoloop.tianting.mealorderservice.UpdateGradeClassRpcRequest;
82 +import com.infoloop.tianting.mealorderservice.UpdateGradeClassRpcResponse;
83 +import com.infoloop.tianting.mealorderservice.UpdateMpAccountRpcRequest;
84 +import com.infoloop.tianting.mealorderservice.UpdateMpAccountRpcResponse;
85 +import com.tianting.infoloop.model.db.Diner;
86 +import com.tianting.infoloop.model.db.GradeClass;
87 +import com.tianting.infoloop.model.db.MealMenuRecord;
88 +import com.tianting.infoloop.model.db.MealOrder;
89 +import com.tianting.infoloop.model.db.MpAccount;
90 +import com.tianting.infoloop.model.db.MpAccountDinerRef;
91 +import com.tianting.infoloop.service.DinerService;
92 +import com.tianting.infoloop.service.GradeClassService;
93 +import com.tianting.infoloop.service.MealMenuRecordService;
94 +import com.tianting.infoloop.service.MealOrderService;
95 +import com.tianting.infoloop.service.MpAccountDinerRefService;
96 +import com.tianting.infoloop.service.MpAccountService;
97 +import com.tianting.infoloop.utils.ProtoBeanUtil;
98 +import io.grpc.Status;
99 +import io.grpc.stub.StreamObserver;
100 +import lombok.RequiredArgsConstructor;
101 +import lombok.extern.slf4j.Slf4j;
102 +import org.springframework.beans.factory.annotation.Autowired;
103 +import org.springframework.stereotype.Service;
104 +import org.springframework.transaction.annotation.Transactional;
105 +
106 +import java.util.ArrayList;
107 +import java.util.List;
108 +import java.util.stream.Collectors;
109 +
110 +import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_MASTER;
111 +import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_SLAVE;
112 +
113 +@Slf4j
114 +@Service
115 +@RequiredArgsConstructor(onConstructor_ = @Autowired)
116 +public class MealOrderGrpcService extends MealOrderServiceRpcGrpc.MealOrderServiceRpcImplBase {
117 +
118 + private final DinerService dinerService;
119 +
120 + private final GradeClassService gradeClassService;
121 +
122 + private final MealMenuRecordService mealMenuRecordService;
123 +
124 + private final MealOrderService mealOrderService;
125 +
126 + private final MpAccountDinerRefService mpAccountDinerRefService;
127 +
128 + private final MpAccountService mpAccountService;
129 +
130 + @Override
131 + @DS(DATA_SOURCE_SLAVE)
132 + public void getMealOrderById(final GetMealOrderByIdRpcRequest request,
133 + final StreamObserver<GetMealOrderByIdRpcResponse> responseObserver) {
134 + final var builder = GetMealOrderByIdRpcResponse.newBuilder();
135 + try {
136 + final var mealOrder = mealOrderService.getById(request.getId());
137 + if (mealOrder != null) {
138 + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleMealOrderRpcResponse.class));
139 + }
140 + } catch (final Exception e) {
141 + log.error("getMealOrderById error;", e);
142 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
143 + }
144 + responseObserver.onNext(builder.build());
145 + responseObserver.onCompleted();
146 + }
147 +
148 + @Override
149 + @DS(DATA_SOURCE_SLAVE)
150 + public void getMealOrdersByIds(final GetMealOrdersByIdsRpcRequest request,
151 + final StreamObserver<GetMealOrdersByIdsRpcResponse> responseObserver) {
152 + final var builder = GetMealOrdersByIdsRpcResponse.newBuilder();
153 + try {
154 + final var mealOrders = mealOrderService.listByIds(request.getIdsList());
155 + if (!mealOrders.isEmpty()) {
156 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMealOrderRpcResponse.class));
157 + }
158 + } catch (final Exception e) {
159 + log.error("getMealOrdersByIds error;", e);
160 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
161 + }
162 + responseObserver.onNext(builder.build());
163 + responseObserver.onCompleted();
164 + }
165 +
166 + @Override
167 + @DS(DATA_SOURCE_SLAVE)
168 + public void queryMealOrdersByCondition(final QueryMealOrdersByConditionRpcRequest request,
169 + final StreamObserver<QueryMealOrdersByConditionRpcResponse> responseObserver) {
170 + final var builder = QueryMealOrdersByConditionRpcResponse.newBuilder();
171 + try {
172 + LambdaQueryWrapper<MealOrder> queryWrapper = new LambdaQueryWrapper<>();
173 + queryWrapper.eq(MealOrder::getEnterpriseId, request.getEnterpriseId());
174 + if (request.getShouldFilterClientIds()) {
175 + queryWrapper.in(!request.getClientIdsList().isEmpty(), MealOrder::getClientId, request.getClientIdsList());
176 + }
177 + if (request.getShouldFilterMenuIds()) {
178 + queryWrapper.in(!request.getMenuIdsList().isEmpty(), MealOrder::getMenuId, request.getMenuIdsList());
179 + }
180 + if (request.getShouldFilterAccountIds()) {
181 + queryWrapper.in(!request.getAccountIdsList().isEmpty(), MealOrder::getAccountId, request.getAccountIdsList());
182 + }
183 + if (request.getShouldFilterOrderMethod()) {
184 + queryWrapper.eq(MealOrder::getOrderMethod, request.getOrderMethodValue());
185 + }
186 + if (request.getShouldFilterDinerIds()) {
187 + queryWrapper.in(!request.getDinerIdsList().isEmpty(), MealOrder::getDinerId, request.getDinerIdsList());
188 + }
189 + if (request.getShouldFilterReserveDateStart()) {
190 + queryWrapper.ge(MealOrder::getReserveDate, LocalDateTimeUtil.of(request.getReserveDateStart()));
191 + }
192 + if (request.getShouldFilterReserveDateEnd()) {
193 + queryWrapper.lt(MealOrder::getReserveDate, LocalDateTimeUtil.of(request.getReserveDateEnd()));
194 + }
195 + final var mealOrders = mealOrderService.list(queryWrapper);
196 + if (!mealOrders.isEmpty()) {
197 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMealOrderRpcResponse.class));
198 + }
199 + } catch (final Exception e) {
200 + log.error("queryMealOrdersByCondition error;", e);
201 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
202 + }
203 + responseObserver.onNext(builder.build());
204 + responseObserver.onCompleted();
205 + }
206 +
207 + @Override
208 + @DS(DATA_SOURCE_MASTER)
209 + public void createMealOrder(final CreateMealOrderRpcRequest request,
210 + final StreamObserver<CreateMealOrderRpcResponse> responseObserver) {
211 + final var builder = CreateMealOrderRpcResponse.newBuilder();
212 + try {
213 + MealOrder mealOrder = new MealOrder();
214 + mealOrder.setEnterpriseId(request.getEnterpriseId());
215 + mealOrder.setCreatedBy(request.getCreatedBy());
216 + mealOrder.setCreationSource(request.getCreationSource());
217 + mealOrder.setClientId(request.getCreation().getClientId());
218 + mealOrder.setMenuId(request.getCreation().getMenuId());
219 + mealOrder.setAccountId(request.getCreation().getAccountId());
220 + mealOrder.setOrderMethod(request.getCreation().getOrderMethodValue());
221 + mealOrder.setDinerId(request.getCreation().getDinerId());
222 + mealOrder.setDinerName(request.getCreation().getDinerName());
223 + mealOrder.setClientName(request.getCreation().getClientName());
224 + mealOrder.setGradeName(request.getCreation().getGradeName());
225 + mealOrder.setClassName(request.getCreation().getClassName());
226 + mealOrder.setStudentNo(request.getCreation().getStudentNo());
227 + mealOrder.setReserveDate(LocalDateTimeUtil.of(request.getCreation().getReserveDate()));
228 + mealOrder.setMeals(ProtoBeanUtil.protoListToJson(request.getCreation().getMealsList()));
229 + builder.setIsCreated(mealOrderService.save(mealOrder)).setId(mealOrder.getId());
230 + } catch (final Exception e) {
231 + log.error("createMealOrder error;", e);
232 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
233 + }
234 + responseObserver.onNext(builder.build());
235 + responseObserver.onCompleted();
236 + }
237 +
238 + @Override
239 + @DS(DATA_SOURCE_MASTER)
240 + public void deleteMealOrdersByIds(final DeleteMealOrdersByIdsRpcRequest request,
241 + final StreamObserver<DeleteMealOrdersRpcResponse> responseObserver) {
242 + final var builder = DeleteMealOrdersRpcResponse.newBuilder();
243 + try {
244 + builder.setIsDeleted(mealOrderService.removeBatchByIds(request.getIdsList()));
245 + } catch (final Exception e) {
246 + log.error("deleteMealOrdersByIds error;", e);
247 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
248 + }
249 + responseObserver.onNext(builder.build());
250 + responseObserver.onCompleted();
251 + }
252 +
253 + @Override
254 + @DS(DATA_SOURCE_SLAVE)
255 + public void getMpAccountById(final GetMpAccountByIdRpcRequest request,
256 + final StreamObserver<GetMpAccountByIdRpcResponse> responseObserver) {
257 + final var builder = GetMpAccountByIdRpcResponse.newBuilder();
258 + try {
259 + final var mealOrder = mpAccountService.getById(request.getId());
260 + if (mealOrder != null) {
261 + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleMpAccountRpcResponse.class));
262 + }
263 + } catch (final Exception e) {
264 + log.error("getMpAccountById error;", e);
265 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
266 + }
267 + responseObserver.onNext(builder.build());
268 + responseObserver.onCompleted();
269 + }
270 +
271 + @Override
272 + @DS(DATA_SOURCE_SLAVE)
273 + public void getMpAccountsByIds(final GetMpAccountsByIdsRpcRequest request,
274 + final StreamObserver<GetMpAccountsByIdsRpcResponse> responseObserver) {
275 + final var builder = GetMpAccountsByIdsRpcResponse.newBuilder();
276 + try {
277 + final var mealOrders = mpAccountService.listByIds(request.getIdsList());
278 + if (!mealOrders.isEmpty()) {
279 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMpAccountRpcResponse.class));
280 + }
281 + } catch (final Exception e) {
282 + log.error("getMpAccountsByIds error;", e);
283 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
284 + }
285 + responseObserver.onNext(builder.build());
286 + responseObserver.onCompleted();
287 + }
288 +
289 + @Override
290 + @DS(DATA_SOURCE_SLAVE)
291 + public void queryMpAccountsByCondition(final QueryMpAccountsByConditionRpcRequest request,
292 + final StreamObserver<QueryMpAccountsByConditionRpcResponse> responseObserver) {
293 + final var builder = QueryMpAccountsByConditionRpcResponse.newBuilder();
294 + try {
295 + LambdaQueryWrapper<MpAccount> queryWrapper = new LambdaQueryWrapper<>();
296 + queryWrapper.eq(MpAccount::getEnterpriseId, request.getEnterpriseId());
297 + if (request.getShouldFilterOpenId()) {
298 + queryWrapper.eq(MpAccount::getOpenId, request.getOpenId());
299 + }
300 + if (request.getShouldFilterUnionId()) {
301 + queryWrapper.eq(MpAccount::getUnionId, request.getUnionId());
302 + }
303 + if (request.getShouldFilterPhoneNumber()) {
304 + queryWrapper.eq(MpAccount::getPhoneNumber, request.getPhoneNumber());
305 + }
306 + if (request.getShouldFilterStatus()) {
307 + queryWrapper.eq(MpAccount::getStatus, request.getStatusValue());
308 + }
309 + final var mealOrders = mpAccountService.list(queryWrapper);
310 + if (!mealOrders.isEmpty()) {
311 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMpAccountRpcResponse.class));
312 + }
313 + } catch (final Exception e) {
314 + log.error("queryMpAccountsByCondition error;", e);
315 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
316 + }
317 + responseObserver.onNext(builder.build());
318 + responseObserver.onCompleted();
319 + }
320 +
321 + @Override
322 + @DS(DATA_SOURCE_MASTER)
323 + public void createMpAccount(final CreateMpAccountRpcRequest request,
324 + final StreamObserver<CreateMpAccountRpcResponse> responseObserver) {
325 + final var builder = CreateMpAccountRpcResponse.newBuilder();
326 + try {
327 + MpAccount mpAccount = new MpAccount();
328 + mpAccount.setEnterpriseId(request.getEnterpriseId());
329 + mpAccount.setCreatedBy(request.getCreatedBy());
330 + mpAccount.setCreationSource(request.getCreationSource());
331 + mpAccount.setOpenId(request.getCreation().getOpenId());
332 + if (request.getCreation().getShouldCreateUnionId()) {
333 + mpAccount.setUnionId(request.getCreation().getUnionId());
334 + }
335 + if (request.getCreation().getShouldCreateNickname()) {
336 + mpAccount.setNickname(request.getCreation().getNickname());
337 + }
338 + if (request.getCreation().getShouldCreateAvatarUrl()) {
339 + mpAccount.setAvatarUrl(request.getCreation().getAvatarUrl());
340 + }
341 + mpAccount.setGender(request.getCreation().getGenderValue());
342 + mpAccount.setPhoneNumber(request.getCreation().getPhoneNumber());
343 + mpAccount.setStatus(request.getCreation().getStatusValue());
344 + builder.setIsCreated(mpAccountService.save(mpAccount)).setId(mpAccount.getId());
345 + } catch (final Exception e) {
346 + log.error("createMpAccount error;", e);
347 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
348 + }
349 + responseObserver.onNext(builder.build());
350 + responseObserver.onCompleted();
351 + }
352 +
353 + @Override
354 + @DS(DATA_SOURCE_MASTER)
355 + public void updateMpAccount(final UpdateMpAccountRpcRequest request,
356 + final StreamObserver<UpdateMpAccountRpcResponse> responseObserver) {
357 + final var builder = UpdateMpAccountRpcResponse.newBuilder();
358 + try {
359 + MpAccount mpAccount = new MpAccount();
360 + mpAccount.setId(request.getModification().getId());
361 + mpAccount.setEnterpriseId(request.getEnterpriseId());
362 + mpAccount.setUpdatedBy(request.getUpdatedBy());
363 + mpAccount.setUpdateSource(request.getUpdateSource());
364 + if (request.getModification().getShouldUpdateNickname()) {
365 + mpAccount.setNickname(request.getModification().getNickname());
366 + }
367 + if (request.getModification().getShouldUpdateAvatarUrl()) {
368 + mpAccount.setAvatarUrl(request.getModification().getAvatarUrl());
369 + }
370 + if (request.getModification().getShouldUpdateGender()) {
371 + mpAccount.setGender(request.getModification().getGenderValue());
372 + }
373 + if (request.getModification().getShouldUpdatePhoneNumber()) {
374 + mpAccount.setPhoneNumber(request.getModification().getPhoneNumber());
375 + }
376 + if (request.getModification().getShouldUpdateStatus()) {
377 + mpAccount.setStatus(request.getModification().getStatusValue());
378 + }
379 + builder.setIsUpdated(mpAccountService.updateById(mpAccount));
380 + } catch (final Exception e) {
381 + log.error("updateMpAccount error;", e);
382 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
383 + }
384 + responseObserver.onNext(builder.build());
385 + responseObserver.onCompleted();
386 + }
387 +
388 + @Override
389 + @DS(DATA_SOURCE_MASTER)
390 + public void deleteMpAccountsByIds(final DeleteMpAccountsByIdsRpcRequest request,
391 + final StreamObserver<DeleteMpAccountsRpcResponse> responseObserver) {
392 + final var builder = DeleteMpAccountsRpcResponse.newBuilder();
393 + try {
394 + builder.setIsDeleted(mpAccountService.removeBatchByIds(request.getIdsList()));
395 + } catch (final Exception e) {
396 + log.error("deleteMpAccountsByIds error;", e);
397 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
398 + }
399 + responseObserver.onNext(builder.build());
400 + responseObserver.onCompleted();
401 + }
402 +
403 + @Override
404 + @DS(DATA_SOURCE_SLAVE)
405 + public void getDinerById(final GetDinerByIdRpcRequest request,
406 + final StreamObserver<GetDinerByIdRpcResponse> responseObserver) {
407 + final var builder = GetDinerByIdRpcResponse.newBuilder();
408 + try {
409 + final var mealOrder = dinerService.getById(request.getId());
410 + if (mealOrder != null) {
411 + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleDinerRpcResponse.class));
412 + }
413 + } catch (final Exception e) {
414 + log.error("getDinerById error;", e);
415 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
416 + }
417 + responseObserver.onNext(builder.build());
418 + responseObserver.onCompleted();
419 + }
420 +
421 + @Override
422 + @DS(DATA_SOURCE_SLAVE)
423 + public void getDinersByIds(final GetDinersByIdsRpcRequest request,
424 + final StreamObserver<GetDinersByIdsRpcResponse> responseObserver) {
425 + final var builder = GetDinersByIdsRpcResponse.newBuilder();
426 + try {
427 + final var mealOrders = dinerService.listByIds(request.getIdsList());
428 + if (!mealOrders.isEmpty()) {
429 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleDinerRpcResponse.class));
430 + }
431 + } catch (final Exception e) {
432 + log.error("getDinersByIds error;", e);
433 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
434 + }
435 + responseObserver.onNext(builder.build());
436 + responseObserver.onCompleted();
437 + }
438 +
439 + @Override
440 + @DS(DATA_SOURCE_SLAVE)
441 + public void queryDinersByCondition(final QueryDinersByConditionRpcRequest request,
442 + final StreamObserver<QueryDinersByConditionRpcResponse> responseObserver) {
443 + final var builder = QueryDinersByConditionRpcResponse.newBuilder();
444 + try {
445 + LambdaQueryWrapper<Diner> queryWrapper = new LambdaQueryWrapper<>();
446 + queryWrapper.eq(Diner::getEnterpriseId, request.getEnterpriseId());
447 + if (request.getShouldFilterClientIds()) {
448 + queryWrapper.in(!request.getClientIdsList().isEmpty(), Diner::getClientId, request.getClientIdsList());
449 + }
450 + if (request.getShouldFilterClassIds()) {
451 + queryWrapper.in(!request.getClassIdsList().isEmpty(), Diner::getClassId, request.getClassIdsList());
452 + }
453 + if (request.getShouldFilterStudentNo()) {
454 + queryWrapper.eq(Diner::getStudentNo, request.getStudentNo());
455 + }
456 + if (request.getShouldFilterName()) {
457 + queryWrapper.eq(Diner::getName, request.getName());
458 + }
459 + final var diners = dinerService.list(queryWrapper);
460 + if (!diners.isEmpty()) {
461 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleDinerRpcResponse.class));
462 + }
463 + } catch (final Exception e) {
464 + log.error("queryDinersByCondition error;", e);
465 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
466 + }
467 + responseObserver.onNext(builder.build());
468 + responseObserver.onCompleted();
469 + }
470 +
471 + @Override
472 + @DS(DATA_SOURCE_MASTER)
473 + public void createDiner(final CreateDinerRpcRequest request,
474 + final StreamObserver<CreateDinerRpcResponse> responseObserver) {
475 + final var builder = CreateDinerRpcResponse.newBuilder();
476 + try {
477 + Diner diner = new Diner();
478 + diner.setEnterpriseId(request.getEnterpriseId());
479 + diner.setCreatedBy(request.getCreatedBy());
480 + diner.setCreationSource(request.getCreationSource());
481 + diner.setClientId(request.getCreation().getClientId());
482 + diner.setClassId(request.getCreation().getClassId());
483 + diner.setStudentNo(request.getCreation().getStudentNo());
484 + diner.setName(request.getCreation().getName());
485 + builder.setIsCreated(dinerService.save(diner)).setId(diner.getId());
486 + } catch (final Exception e) {
487 + log.error("createDiner error;", e);
488 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
489 + }
490 + responseObserver.onNext(builder.build());
491 + responseObserver.onCompleted();
492 + }
493 +
494 + @Override
495 + @DS(DATA_SOURCE_MASTER)
496 + public void updateDiner(final UpdateDinerRpcRequest request,
497 + final StreamObserver<UpdateDinerRpcResponse> responseObserver) {
498 + final var builder = UpdateDinerRpcResponse.newBuilder();
499 + try {
500 + Diner diner = new Diner();
501 + diner.setId(request.getModification().getId());
502 + diner.setEnterpriseId(request.getEnterpriseId());
503 + diner.setUpdatedBy(request.getUpdatedBy());
504 + diner.setUpdateSource(request.getUpdateSource());
505 + if (request.getModification().getShouldUpdateClientId()) {
506 + diner.setClientId(request.getModification().getClientId());
507 + }
508 + if (request.getModification().getShouldUpdateClassId()) {
509 + diner.setClassId(request.getModification().getClassId());
510 + }
511 + if (request.getModification().getShouldUpdateStudentNo()) {
512 + diner.setStudentNo(request.getModification().getStudentNo());
513 + }
514 + if (request.getModification().getShouldUpdateName()) {
515 + diner.setName(request.getModification().getName());
516 + }
517 + builder.setIsUpdated(dinerService.updateById(diner));
518 + } catch (final Exception e) {
519 + log.error("updateDiner error;", e);
520 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
521 + }
522 + responseObserver.onNext(builder.build());
523 + responseObserver.onCompleted();
524 + }
525 +
526 + @Override
527 + @DS(DATA_SOURCE_MASTER)
528 + public void batchSaveOrUpdateDiners(final BatchSaveOrUpdateDinersRpcRequest request,
529 + final StreamObserver<BatchSaveOrUpdateDinersRpcResponse> responseObserver) {
530 + final var builder = BatchSaveOrUpdateDinersRpcResponse.newBuilder();
531 + try {
532 + final var diners = new ArrayList<Diner>();
533 + for (DinerModification modification : request.getModificationsList()) {
534 + Diner diner = new Diner();
535 + diner.setId(modification.getId() == 0 ? null : modification.getId());
536 + diner.setEnterpriseId(request.getEnterpriseId());
537 + if (modification.getId() == 0) {
538 + diner.setCreatedBy(request.getUpdatedBy());
539 + diner.setCreationSource(request.getUpdateSource());
540 + }
541 + diner.setUpdatedBy(request.getUpdatedBy());
542 + diner.setUpdateSource(request.getUpdateSource());
543 + if (modification.getShouldUpdateClientId()) {
544 + diner.setClientId(modification.getClientId());
545 + }
546 + if (modification.getShouldUpdateClassId()) {
547 + diner.setClassId(modification.getClassId());
548 + }
549 + if (modification.getShouldUpdateStudentNo()) {
550 + diner.setStudentNo(modification.getStudentNo());
551 + }
552 + if (modification.getShouldUpdateName()) {
553 + diner.setName(modification.getName());
554 + }
555 + diners.add(diner);
556 + }
557 + builder.setIsUpdated(dinerService.saveOrUpdateBatch(diners));
558 + } catch (final Exception e) {
559 + log.error("batchSaveOrUpdateDiners error;", e);
560 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
561 + }
562 + responseObserver.onNext(builder.build());
563 + responseObserver.onCompleted();
564 + }
565 +
566 + @Override
567 + @DS(DATA_SOURCE_MASTER)
568 + public void deleteDinersByIds(final DeleteDinersByIdsRpcRequest request,
569 + final StreamObserver<DeleteDinersRpcResponse> responseObserver) {
570 + final var builder = DeleteDinersRpcResponse.newBuilder();
571 + try {
572 + builder.setIsDeleted(dinerService.removeBatchByIds(request.getIdsList()));
573 + } catch (final Exception e) {
574 + log.error("deleteDinersByIds error;", e);
575 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
576 + }
577 + responseObserver.onNext(builder.build());
578 + responseObserver.onCompleted();
579 + }
580 +
581 + @Override
582 + @DS(DATA_SOURCE_SLAVE)
583 + public void getMpAccountDinerRefsByIds(final GetMpAccountDinerRefsByIdsRpcRequest request,
584 + final StreamObserver<GetMpAccountDinerRefsByIdsRpcResponse> responseObserver) {
585 + final var builder = GetMpAccountDinerRefsByIdsRpcResponse.newBuilder();
586 + try {
587 + final var mpAccountDinerRefs = mpAccountDinerRefService.listByIds(request.getIdsList());
588 + if (!mpAccountDinerRefs.isEmpty()) {
589 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mpAccountDinerRefs, SingleMpAccountDinerRefRpcResponse.class));
590 + }
591 + } catch (final Exception e) {
592 + log.error("getMpAccountDinerRefsByIds error;", e);
593 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
594 + }
595 + responseObserver.onNext(builder.build());
596 + responseObserver.onCompleted();
597 + }
598 +
599 + @Override
600 + @DS(DATA_SOURCE_SLAVE)
601 + public void queryMpAccountDinerRefsByCondition(final QueryMpAccountDinerRefsByConditionRpcRequest request,
602 + final StreamObserver<QueryMpAccountDinerRefsByConditionRpcResponse> responseObserver) {
603 + final var builder = QueryMpAccountDinerRefsByConditionRpcResponse.newBuilder();
604 + try {
605 + LambdaQueryWrapper<MpAccountDinerRef> queryWrapper = new LambdaQueryWrapper<>();
606 + queryWrapper.eq(MpAccountDinerRef::getEnterpriseId, request.getEnterpriseId());
607 + if (request.getShouldFilterAccountIds()) {
608 + queryWrapper.in(!request.getAccountIdsList().isEmpty(), MpAccountDinerRef::getAccountId, request.getAccountIdsList());
609 + }
610 + if (request.getShouldFilterDinerIds()) {
611 + queryWrapper.in(!request.getDinerIdsList().isEmpty(), MpAccountDinerRef::getDinerId, request.getDinerIdsList());
612 + }
613 + final var diners = mpAccountDinerRefService.list(queryWrapper);
614 + if (!diners.isEmpty()) {
615 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleMpAccountDinerRefRpcResponse.class));
616 + }
617 + } catch (final Exception e) {
618 + log.error("queryMpAccountDinerRefsByCondition error;", e);
619 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
620 + }
621 + responseObserver.onNext(builder.build());
622 + responseObserver.onCompleted();
623 + }
624 +
625 + @Override
626 + @DS(DATA_SOURCE_MASTER)
627 + public void createMpAccountDinerRef(final CreateMpAccountDinerRefRpcRequest request,
628 + final StreamObserver<CreateMpAccountDinerRefRpcResponse> responseObserver) {
629 + final var builder = CreateMpAccountDinerRefRpcResponse.newBuilder();
630 + try {
631 + MpAccountDinerRef mpAccountDinerRef = new MpAccountDinerRef();
632 + mpAccountDinerRef.setEnterpriseId(request.getEnterpriseId());
633 + mpAccountDinerRef.setCreatedBy(request.getCreatedBy());
634 + mpAccountDinerRef.setCreationSource(request.getCreationSource());
635 + mpAccountDinerRef.setAccountId(request.getCreation().getAccountId());
636 + mpAccountDinerRef.setDinerId(request.getCreation().getDinerId());
637 + builder.setIsCreated(mpAccountDinerRefService.save(mpAccountDinerRef)).setId(mpAccountDinerRef.getId());
638 + } catch (final Exception e) {
639 + log.error("createMpAccountDinerRef error;", e);
640 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
641 + }
642 + responseObserver.onNext(builder.build());
643 + responseObserver.onCompleted();
644 + }
645 +
646 + @Override
647 + @DS(DATA_SOURCE_MASTER)
648 + public void deleteMpAccountDinerRefsByIds(final DeleteMpAccountDinerRefsByIdsRpcRequest request,
649 + final StreamObserver<DeleteMpAccountDinerRefsRpcResponse> responseObserver) {
650 + final var builder = DeleteMpAccountDinerRefsRpcResponse.newBuilder();
651 + try {
652 + builder.setIsDeleted(mpAccountDinerRefService.removeBatchByIds(request.getIdsList()));
653 + } catch (final Exception e) {
654 + log.error("deleteMpAccountDinerRefsByIds error;", e);
655 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
656 + }
657 + responseObserver.onNext(builder.build());
658 + responseObserver.onCompleted();
659 + }
660 +
661 + @Override
662 + @DS(DATA_SOURCE_SLAVE)
663 + public void getGradeClassById(final GetGradeClassByIdRpcRequest request,
664 + final StreamObserver<GetGradeClassByIdRpcResponse> responseObserver) {
665 + final var builder = GetGradeClassByIdRpcResponse.newBuilder();
666 + try {
667 + final var gradeClass = gradeClassService.getById(request.getId());
668 + if (gradeClass != null) {
669 + builder.setResponse(ProtoBeanUtil.beanToProto(gradeClass, SingleGradeClassRpcResponse.class));
670 + }
671 + } catch (final Exception e) {
672 + log.error("getGradeClassById error;", e);
673 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
674 + }
675 + responseObserver.onNext(builder.build());
676 + responseObserver.onCompleted();
677 + }
678 +
679 + @Override
680 + @DS(DATA_SOURCE_SLAVE)
681 + public void getGradeClassesByIds(final GetGradeClassesByIdsRpcRequest request,
682 + final StreamObserver<GetGradeClassesByIdsRpcResponse> responseObserver) {
683 + final var builder = GetGradeClassesByIdsRpcResponse.newBuilder();
684 + try {
685 + final var gradeClasses = gradeClassService.listByIds(request.getIdsList());
686 + if (!gradeClasses.isEmpty()) {
687 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(gradeClasses, SingleGradeClassRpcResponse.class));
688 + }
689 + } catch (final Exception e) {
690 + log.error("getGradeClassesByIds error;", e);
691 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
692 + }
693 + responseObserver.onNext(builder.build());
694 + responseObserver.onCompleted();
695 + }
696 +
697 + @Override
698 + @DS(DATA_SOURCE_SLAVE)
699 + public void queryGradeClassesByCondition(final QueryGradeClassesByConditionRpcRequest request,
700 + final StreamObserver<QueryGradeClassesByConditionRpcResponse> responseObserver) {
701 + final var builder = QueryGradeClassesByConditionRpcResponse.newBuilder();
702 + try {
703 + LambdaQueryWrapper<GradeClass> queryWrapper = new LambdaQueryWrapper<>();
704 + queryWrapper.eq(GradeClass::getEnterpriseId, request.getEnterpriseId());
705 + if (request.getShouldFilterClientIds()) {
706 + queryWrapper.in(!request.getClientIdsList().isEmpty(), GradeClass::getClientId, request.getClientIdsList());
707 + }
708 + if (request.getShouldFilterGradeName()) {
709 + queryWrapper.eq(GradeClass::getGradeName, request.getGradeName());
710 + }
711 + final var gradeClasses = gradeClassService.list(queryWrapper);
712 + if (!gradeClasses.isEmpty()) {
713 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(gradeClasses, SingleGradeClassRpcResponse.class));
714 + }
715 + } catch (final Exception e) {
716 + log.error("queryGradeClassesByCondition error;", e);
717 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
718 + }
719 + responseObserver.onNext(builder.build());
720 + responseObserver.onCompleted();
721 + }
722 +
723 + @Override
724 + @DS(DATA_SOURCE_MASTER)
725 + public void createGradeClass(final CreateGradeClassRpcRequest request,
726 + final StreamObserver<CreateGradeClassRpcResponse> responseObserver) {
727 + final var builder = CreateGradeClassRpcResponse.newBuilder();
728 + try {
729 + GradeClass gradeClass = new GradeClass();
730 + gradeClass.setEnterpriseId(request.getEnterpriseId());
731 + gradeClass.setCreatedBy(request.getCreatedBy());
732 + gradeClass.setCreationSource(request.getCreationSource());
733 + gradeClass.setClientId(request.getCreation().getClientId());
734 + gradeClass.setGradeName(request.getCreation().getGradeName());
735 + gradeClass.setClassName(request.getCreation().getClassName());
736 + builder.setIsCreated(gradeClassService.save(gradeClass)).setId(gradeClass.getId());
737 + } catch (final Exception e) {
738 + log.error("createGradeClass error;", e);
739 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
740 + }
741 + responseObserver.onNext(builder.build());
742 + responseObserver.onCompleted();
743 + }
744 +
745 + @Override
746 + @DS(DATA_SOURCE_MASTER)
747 + public void batchCreateGradeClasses(final BatchCreateGradeClassesRpcRequest request,
748 + final StreamObserver<BatchCreateGradeClassesRpcResponse> responseObserver) {
749 + final var builder = BatchCreateGradeClassesRpcResponse.newBuilder();
750 + try {
751 + final var gradeClasses = new ArrayList<GradeClass>();
752 + for (final var creation : request.getCreationsList()) {
753 + final var gradeClass = new GradeClass();
754 + gradeClass.setEnterpriseId(request.getEnterpriseId());
755 + gradeClass.setCreatedBy(request.getCreatedBy());
756 + gradeClass.setCreationSource(request.getCreationSource());
757 + gradeClass.setClientId(creation.getClientId());
758 + gradeClass.setGradeName(creation.getGradeName());
759 + gradeClass.setClassName(creation.getClassName());
760 + gradeClasses.add(gradeClass);
761 + }
762 + builder.setIsCreated(gradeClassService.saveBatch(gradeClasses)).addAllIds(gradeClasses.stream().map(GradeClass::getId).collect(Collectors.toList()));
763 + } catch (final Exception e) {
764 + log.error("batchCreateGradeClasses error;", e);
765 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
766 + }
767 + responseObserver.onNext(builder.build());
768 + responseObserver.onCompleted();
769 + }
770 +
771 + @Override
772 + @DS(DATA_SOURCE_MASTER)
773 + public void updateGradeClass(final UpdateGradeClassRpcRequest request,
774 + final StreamObserver<UpdateGradeClassRpcResponse> responseObserver) {
775 + final var builder = UpdateGradeClassRpcResponse.newBuilder();
776 + try {
777 + GradeClass gradeClass = new GradeClass();
778 + gradeClass.setId(request.getModification().getId());
779 + gradeClass.setEnterpriseId(request.getEnterpriseId());
780 + gradeClass.setUpdatedBy(request.getUpdatedBy());
781 + gradeClass.setUpdateSource(request.getUpdateSource());
782 + if (request.getModification().getShouldUpdateClientId()) {
783 + gradeClass.setClientId(request.getModification().getClientId());
784 + }
785 + if (request.getModification().getShouldUpdateClassName()) {
786 + gradeClass.setClassName(request.getModification().getClassName());
787 + }
788 + if (request.getModification().getShouldUpdateGradeName()) {
789 + gradeClass.setGradeName(request.getModification().getGradeName());
790 + }
791 + builder.setIsUpdated(gradeClassService.updateById(gradeClass));
792 + } catch (final Exception e) {
793 + log.error("updateGradeClass error;", e);
794 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
795 + }
796 + responseObserver.onNext(builder.build());
797 + responseObserver.onCompleted();
798 + }
799 +
800 + @Override
801 + @DS(DATA_SOURCE_MASTER)
802 + public void batchSaveOrUpdateGradeClasses(final BatchSaveOrUpdateGradeClassesRpcRequest request,
803 + final StreamObserver<BatchSaveOrUpdateGradeClassesRpcResponse> responseObserver) {
804 + final var builder = BatchSaveOrUpdateGradeClassesRpcResponse.newBuilder();
805 + try {
806 + List<GradeClass> gradeClasses = new ArrayList<>();
807 + for (final var modification : request.getModificationsList()) {
808 + GradeClass gradeClass = new GradeClass();
809 + gradeClass.setId(modification.getId() == 0 ? null : modification.getId());
810 + gradeClass.setEnterpriseId(request.getEnterpriseId());
811 + if (modification.getId() == 0) {
812 + gradeClass.setCreatedBy(request.getUpdatedBy());
813 + gradeClass.setCreationSource(request.getUpdateSource());
814 + }
815 + gradeClass.setUpdatedBy(request.getUpdatedBy());
816 + gradeClass.setUpdateSource(request.getUpdateSource());
817 + if (modification.getShouldUpdateClientId()) {
818 + gradeClass.setClientId(modification.getClientId());
819 + }
820 + if (modification.getShouldUpdateClassName()) {
821 + gradeClass.setClassName(modification.getClassName());
822 + }
823 + if (modification.getShouldUpdateGradeName()) {
824 + gradeClass.setGradeName(modification.getGradeName());
825 + }
826 + gradeClasses.add(gradeClass);
827 + }
828 + builder.setIsUpdated(gradeClassService.saveOrUpdateBatch(gradeClasses));
829 + } catch (final Exception e) {
830 + log.error("updateGradeClass error;", e);
831 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
832 + }
833 + responseObserver.onNext(builder.build());
834 + responseObserver.onCompleted();
835 + }
836 +
837 + @Override
838 + @DS(DATA_SOURCE_MASTER)
839 + public void deleteGradeClassesByIds(final DeleteGradeClassesByIdsRpcRequest request,
840 + final StreamObserver<DeleteGradeClassesRpcResponse> responseObserver) {
841 + final var builder = DeleteGradeClassesRpcResponse.newBuilder();
842 + try {
843 + builder.setIsDeleted(gradeClassService.removeBatchByIds(request.getIdsList()));
844 + } catch (final Exception e) {
845 + log.error("deleteGradeClassesByIds error;", e);
846 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
847 + }
848 + responseObserver.onNext(builder.build());
849 + responseObserver.onCompleted();
850 + }
851 +
852 + @Override
853 + @DS(DATA_SOURCE_MASTER)
854 + @Transactional(rollbackFor = Exception.class)
855 + public void deleteGradeClassesAndDinersByClientIds(final DeleteGradeClassesAndDinersByClientIdsRpcRequest request,
856 + final StreamObserver<DeleteGradeClassesAndDinersByClientIdsRpcResponse> responseObserver) {
857 + final var builder = DeleteGradeClassesAndDinersByClientIdsRpcResponse.newBuilder();
858 + try {
859 + LambdaQueryWrapper<GradeClass> queryWrapper = Wrappers.lambdaQuery();
860 + queryWrapper.in(GradeClass::getEnterpriseId, request.getEnterpriseId());
861 + queryWrapper.in(GradeClass::getClientId, request.getClientIdsList());
862 + final boolean remove = gradeClassService.remove(queryWrapper);
863 + LambdaQueryWrapper<Diner> dinerLambdaQueryWrapper = Wrappers.lambdaQuery();
864 + dinerLambdaQueryWrapper.in(Diner::getEnterpriseId, request.getEnterpriseId());
865 + dinerLambdaQueryWrapper.in(Diner::getClientId, request.getClientIdsList());
866 + final var diners = dinerService.list(dinerLambdaQueryWrapper);
867 + final var remove1 = dinerService.remove(dinerLambdaQueryWrapper);
868 + boolean remove2 = false;
869 + if (!diners.isEmpty()) {
870 + LambdaQueryWrapper<MpAccountDinerRef> mpAccountDinerRefLambdaQueryWrapper = Wrappers.lambdaQuery();
871 + mpAccountDinerRefLambdaQueryWrapper.in(MpAccountDinerRef::getEnterpriseId, request.getEnterpriseId());
872 + mpAccountDinerRefLambdaQueryWrapper.in(MpAccountDinerRef::getDinerId, diners.stream().map(Diner::getId).collect(Collectors.toList()));
873 + remove2 = mpAccountDinerRefService.remove(mpAccountDinerRefLambdaQueryWrapper);
874 + }
875 + builder.setIsDeleted(remove && remove1 && remove2);
876 + } catch (final Exception e) {
877 + log.error("deleteGradeClassesAndDinersByClientIds error;", e);
878 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
879 + }
880 + responseObserver.onNext(builder.build());
881 + responseObserver.onCompleted();
882 + }
883 +
884 + @Override
885 + @DS(DATA_SOURCE_SLAVE)
886 + public void getMealMenuRecordById(final GetMealMenuRecordByIdRpcRequest request,
887 + final StreamObserver<GetMealMenuRecordByIdRpcResponse> responseObserver) {
888 + final var builder = GetMealMenuRecordByIdRpcResponse.newBuilder();
889 + try {
890 + final var mealMenuRecord = mealMenuRecordService.getById(request.getId());
891 + if (mealMenuRecord != null) {
892 + builder.setResponse(ProtoBeanUtil.beanToProto(mealMenuRecord, SingleMealMenuRecordRpcResponse.class));
893 + }
894 + } catch (final Exception e) {
895 + log.error("getMealMenuRecordById error;", e);
896 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
897 + }
898 + responseObserver.onNext(builder.build());
899 + responseObserver.onCompleted();
900 + }
901 +
902 + @Override
903 + @DS(DATA_SOURCE_SLAVE)
904 + public void getMealMenuRecordsByIds(final GetMealMenuRecordsByIdsRpcRequest request,
905 + final StreamObserver<GetMealMenuRecordsByIdsRpcResponse> responseObserver) {
906 + final var builder = GetMealMenuRecordsByIdsRpcResponse.newBuilder();
907 + try {
908 + final var mealMenuRecords = mealMenuRecordService.listByIds(request.getIdsList());
909 + if (!mealMenuRecords.isEmpty()) {
910 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealMenuRecords, SingleMealMenuRecordRpcResponse.class));
911 + }
912 + } catch (final Exception e) {
913 + log.error("getMealMenuRecordsByIds error;", e);
914 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
915 + }
916 + responseObserver.onNext(builder.build());
917 + responseObserver.onCompleted();
918 + }
919 +
920 + @Override
921 + @DS(DATA_SOURCE_SLAVE)
922 + public void queryMealMenuRecordsByCondition(final QueryMealMenuRecordsByConditionRpcRequest request,
923 + final StreamObserver<QueryMealMenuRecordsByConditionRpcResponse> responseObserver) {
924 + final var builder = QueryMealMenuRecordsByConditionRpcResponse.newBuilder();
925 + try {
926 + LambdaQueryWrapper<MealMenuRecord> queryWrapper = new LambdaQueryWrapper<>();
927 + queryWrapper.eq(MealMenuRecord::getEnterpriseId, request.getEnterpriseId());
928 + if (request.getShouldFilterClientIds()) {
929 + queryWrapper.in(!request.getClientIdsList().isEmpty(), MealMenuRecord::getClientId, request.getClientIdsList());
930 + }
931 + if (request.getShouldFilterName()) {
932 + queryWrapper.eq(MealMenuRecord::getName, request.getName());
933 + }
934 + final var diners = mealMenuRecordService.list(queryWrapper);
935 + if (!diners.isEmpty()) {
936 + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleMealMenuRecordRpcResponse.class));
937 + }
938 + } catch (final Exception e) {
939 + log.error("queryMealMenuRecordsByCondition error;", e);
940 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
941 + }
942 + responseObserver.onNext(builder.build());
943 + responseObserver.onCompleted();
944 + }
945 +
946 + @Override
947 + @DS(DATA_SOURCE_MASTER)
948 + public void createMealMenuRecord(final CreateMealMenuRecordRpcRequest request,
949 + final StreamObserver<CreateMealMenuRecordRpcResponse> responseObserver) {
950 + final var builder = CreateMealMenuRecordRpcResponse.newBuilder();
951 + try {
952 + MealMenuRecord mealMenuRecord = new MealMenuRecord();
953 + mealMenuRecord.setEnterpriseId(request.getEnterpriseId());
954 + mealMenuRecord.setCreatedBy(request.getCreatedBy());
955 + mealMenuRecord.setCreationSource(request.getCreationSource());
956 + mealMenuRecord.setClientId(request.getCreation().getClientId());
957 + mealMenuRecord.setName(request.getCreation().getName());
958 + mealMenuRecord.setImageUrl(request.getCreation().getImageUrl());
959 + builder.setIsCreated(mealMenuRecordService.save(mealMenuRecord)).setId(mealMenuRecord.getId());
960 + } catch (final Exception e) {
961 + log.error("createMealMenuRecord error;", e);
962 + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
963 + }
964 + responseObserver.onNext(builder.build());
965 + responseObserver.onCompleted();
966 + }
967 +}
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.DinerMapper;
5 +import com.tianting.infoloop.model.db.Diner;
6 +import com.tianting.infoloop.service.DinerService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【diners(就餐人表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class DinerServiceImpl extends ServiceImpl<DinerMapper, Diner>
16 + implements DinerService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.GradeClassMapper;
5 +import com.tianting.infoloop.model.db.GradeClass;
6 +import com.tianting.infoloop.service.GradeClassService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【grade_classes(年级班级表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class GradeClassServiceImpl extends ServiceImpl<GradeClassMapper, GradeClass>
16 + implements GradeClassService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.MealMenuRecordMapper;
5 +import com.tianting.infoloop.model.db.MealMenuRecord;
6 +import com.tianting.infoloop.service.MealMenuRecordService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【meal_menu_records(餐单记录表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class MealMenuRecordServiceImpl extends ServiceImpl<MealMenuRecordMapper, MealMenuRecord>
16 + implements MealMenuRecordService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.MealOrderMapper;
5 +import com.tianting.infoloop.model.db.MealOrder;
6 +import com.tianting.infoloop.service.MealOrderService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【meal_orders(订餐记录表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class MealOrderServiceImpl extends ServiceImpl<MealOrderMapper, MealOrder>
16 + implements MealOrderService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.MpAccountDinerRefMapper;
5 +import com.tianting.infoloop.model.db.MpAccountDinerRef;
6 +import com.tianting.infoloop.service.MpAccountDinerRefService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【mp_account_diner_refs(小程序账号和就餐人关联表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class MpAccountDinerRefServiceImpl extends ServiceImpl<MpAccountDinerRefMapper, MpAccountDinerRef>
16 + implements MpAccountDinerRefService{
17 +
18 +}
19 +
20 +
21 +
22 +
1 +package com.tianting.infoloop.service.impl;
2 +
3 +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
4 +import com.tianting.infoloop.mapper.MpAccountMapper;
5 +import com.tianting.infoloop.model.db.MpAccount;
6 +import com.tianting.infoloop.service.MpAccountService;
7 +import org.springframework.stereotype.Service;
8 +
9 +/**
10 +* @author zhuyf
11 +* @description 针对表【mp_accounts(小程序账号表)】的数据库操作Service实现
12 +* @createDate 2025-04-10 13:22:20
13 +*/
14 +@Service
15 +public class MpAccountServiceImpl extends ServiceImpl<MpAccountMapper, MpAccount>
16 + implements MpAccountService{
17 +
18 +}
19 +
20 +
21 +
22 +
...@@ -3,6 +3,9 @@ package com.tianting.infoloop.utils; ...@@ -3,6 +3,9 @@ package com.tianting.infoloop.utils;
3 import cn.hutool.core.date.LocalDateTimeUtil; 3 import cn.hutool.core.date.LocalDateTimeUtil;
4 import com.google.gson.Gson; 4 import com.google.gson.Gson;
5 import com.google.gson.GsonBuilder; 5 import com.google.gson.GsonBuilder;
6 +import com.google.gson.JsonArray;
7 +import com.google.gson.JsonElement;
8 +import com.google.gson.JsonParser;
6 import com.google.gson.TypeAdapter; 9 import com.google.gson.TypeAdapter;
7 import com.google.gson.stream.JsonReader; 10 import com.google.gson.stream.JsonReader;
8 import com.google.gson.stream.JsonWriter; 11 import com.google.gson.stream.JsonWriter;
...@@ -23,6 +26,8 @@ import java.util.List; ...@@ -23,6 +26,8 @@ import java.util.List;
23 26
24 public class ProtoBeanUtil { 27 public class ProtoBeanUtil {
25 28
29 + private static Gson gson = getGson();
30 +
26 /** 31 /**
27 * protoBean -> string 32 * protoBean -> string
28 * 33 *
...@@ -31,13 +36,68 @@ public class ProtoBeanUtil { ...@@ -31,13 +36,68 @@ public class ProtoBeanUtil {
31 */ 36 */
32 public static String protoToJson(MessageOrBuilder sourceMessage) { 37 public static String protoToJson(MessageOrBuilder sourceMessage) {
33 try { 38 try {
34 - return JsonFormat.printer().print(sourceMessage); 39 + return JsonFormat.printer().includingDefaultValueFields().print(sourceMessage);
35 } catch (Exception e) { 40 } catch (Exception e) {
36 throw new IllegalArgumentException("ProtoBeanUtil->toJson->errorMessage:proto序列化string异常", e); 41 throw new IllegalArgumentException("ProtoBeanUtil->toJson->errorMessage:proto序列化string异常", e);
37 } 42 }
38 } 43 }
39 44
40 - private static Gson gson = getGson(); 45 + @SuppressWarnings("unchecked")
46 + public static <T extends Message> T jsonToProto(String json, Class<T> protoBean) {
47 + try {
48 + Constructor<T> declaredConstructor = protoBean.getDeclaredConstructor((Class<?>[]) null);
49 + declaredConstructor.setAccessible(Boolean.TRUE);
50 + T instance = declaredConstructor.newInstance();
51 + final var builder = instance.toBuilder();
52 + if (json == null || json.isEmpty() || json.trim().equals("{}")) {
53 + return (T) builder.build();
54 + }
55 + JsonFormat.parser().ignoringUnknownFields().merge(json, builder);
56 + return (T) builder.build();
57 + } catch (Exception e) {
58 + throw new IllegalArgumentException("json to proto error", e);
59 + }
60 + }
61 +
62 + @SuppressWarnings("unchecked")
63 + public static <T extends Message> List<T> jsonToProtoList(String jsonArray, Class<T> protoBean) {
64 + try {
65 + if (jsonArray == null || jsonArray.isEmpty() || jsonArray.trim().equals("[]")) {
66 + return new ArrayList<>();
67 + }
68 + Constructor<T> declaredConstructor = protoBean.getDeclaredConstructor();
69 + declaredConstructor.setAccessible(true);
70 + List<T> protoList = new ArrayList<>();
71 + JsonArray jsonElements = JsonParser.parseString(jsonArray).getAsJsonArray();
72 + for (JsonElement jsonElement : jsonElements) {
73 + T instance = declaredConstructor.newInstance();
74 + Message.Builder builder = instance.toBuilder();
75 + JsonFormat.parser().ignoringUnknownFields().merge(jsonElement.toString(), builder);
76 + protoList.add((T) builder.build());
77 + }
78 + return protoList;
79 + } catch (Exception e) {
80 + throw new IllegalArgumentException("jsonArray to protoList error", e);
81 + }
82 + }
83 +
84 + public static String protoListToJson(List<? extends Message> sourceList) {
85 + try {
86 + StringBuilder jsonArrayBuilder = new StringBuilder();
87 + jsonArrayBuilder.append("[");
88 + for (int i = 0; i < sourceList.size(); i++) {
89 + String json = protoToJson(sourceList.get(i));
90 + jsonArrayBuilder.append(json);
91 + if (i < sourceList.size() - 1) {
92 + jsonArrayBuilder.append(",");
93 + }
94 + }
95 + jsonArrayBuilder.append("]");
96 + return jsonArrayBuilder.toString();
97 + } catch (Exception e) {
98 + throw new IllegalArgumentException("ProtoList to jsonArray error", e);
99 + }
100 + }
41 101
42 /** 102 /**
43 * @desc: String 转 Builder对象 103 * @desc: String 转 Builder对象
......
1 +syntax = "proto3";
2 +
3 +option java_multiple_files = true;
4 +option java_package = "com.infoloop.tianting.mealorderservice";
5 +option java_outer_classname = "MealOrderServiceProto";
6 +option objc_class_prefix = "OP";
7 +
8 +package com.infoloop.tianting.mealorderservice;
9 +
10 +service MealOrderServiceRpc {
11 + rpc GetMealOrderById (GetMealOrderByIdRpcRequest) returns (GetMealOrderByIdRpcResponse) {}
12 + rpc GetMealOrdersByIds (GetMealOrdersByIdsRpcRequest) returns (GetMealOrdersByIdsRpcResponse) {}
13 + rpc QueryMealOrdersByCondition (QueryMealOrdersByConditionRpcRequest) returns (QueryMealOrdersByConditionRpcResponse) {}
14 + rpc CreateMealOrder (CreateMealOrderRpcRequest) returns (CreateMealOrderRpcResponse) {}
15 + rpc DeleteMealOrdersByIds (DeleteMealOrdersByIdsRpcRequest) returns (DeleteMealOrdersRpcResponse) {}
16 +
17 + rpc GetMpAccountById (GetMpAccountByIdRpcRequest) returns (GetMpAccountByIdRpcResponse) {}
18 + rpc GetMpAccountsByIds (GetMpAccountsByIdsRpcRequest) returns (GetMpAccountsByIdsRpcResponse) {}
19 + rpc QueryMpAccountsByCondition (QueryMpAccountsByConditionRpcRequest) returns (QueryMpAccountsByConditionRpcResponse) {}
20 + rpc CreateMpAccount (CreateMpAccountRpcRequest) returns (CreateMpAccountRpcResponse) {}
21 + rpc UpdateMpAccount (UpdateMpAccountRpcRequest) returns (UpdateMpAccountRpcResponse) {}
22 + rpc DeleteMpAccountsByIds (DeleteMpAccountsByIdsRpcRequest) returns (DeleteMpAccountsRpcResponse) {}
23 +
24 + rpc GetDinerById (GetDinerByIdRpcRequest) returns (GetDinerByIdRpcResponse) {}
25 + rpc GetDinersByIds (GetDinersByIdsRpcRequest) returns (GetDinersByIdsRpcResponse) {}
26 + rpc QueryDinersByCondition (QueryDinersByConditionRpcRequest) returns (QueryDinersByConditionRpcResponse) {}
27 + rpc CreateDiner (CreateDinerRpcRequest) returns (CreateDinerRpcResponse) {}
28 + rpc UpdateDiner (UpdateDinerRpcRequest) returns (UpdateDinerRpcResponse) {}
29 + rpc BatchSaveOrUpdateDiners (BatchSaveOrUpdateDinersRpcRequest) returns (BatchSaveOrUpdateDinersRpcResponse) {}
30 + rpc DeleteDinersByIds (DeleteDinersByIdsRpcRequest) returns (DeleteDinersRpcResponse) {}
31 +
32 + rpc GetMpAccountDinerRefsByIds (GetMpAccountDinerRefsByIdsRpcRequest) returns (GetMpAccountDinerRefsByIdsRpcResponse) {}
33 + rpc QueryMpAccountDinerRefsByCondition (QueryMpAccountDinerRefsByConditionRpcRequest) returns (QueryMpAccountDinerRefsByConditionRpcResponse) {}
34 + rpc CreateMpAccountDinerRef (CreateMpAccountDinerRefRpcRequest) returns (CreateMpAccountDinerRefRpcResponse) {}
35 + rpc DeleteMpAccountDinerRefsByIds (DeleteMpAccountDinerRefsByIdsRpcRequest) returns (DeleteMpAccountDinerRefsRpcResponse) {}
36 +
37 + rpc GetGradeClassById (GetGradeClassByIdRpcRequest) returns (GetGradeClassByIdRpcResponse) {}
38 + rpc GetGradeClassesByIds (GetGradeClassesByIdsRpcRequest) returns (GetGradeClassesByIdsRpcResponse) {}
39 + rpc QueryGradeClassesByCondition (QueryGradeClassesByConditionRpcRequest) returns (QueryGradeClassesByConditionRpcResponse) {}
40 + rpc CreateGradeClass (CreateGradeClassRpcRequest) returns (CreateGradeClassRpcResponse) {}
41 + rpc BatchCreateGradeClasses (BatchCreateGradeClassesRpcRequest) returns (BatchCreateGradeClassesRpcResponse) {}
42 + rpc UpdateGradeClass (UpdateGradeClassRpcRequest) returns (UpdateGradeClassRpcResponse) {}
43 + rpc BatchSaveOrUpdateGradeClasses (BatchSaveOrUpdateGradeClassesRpcRequest) returns (BatchSaveOrUpdateGradeClassesRpcResponse) {}
44 + rpc DeleteGradeClassesByIds (DeleteGradeClassesByIdsRpcRequest) returns (DeleteGradeClassesRpcResponse) {}
45 + rpc DeleteGradeClassesAndDinersByClientIds (DeleteGradeClassesAndDinersByClientIdsRpcRequest) returns (DeleteGradeClassesAndDinersByClientIdsRpcResponse) {}
46 +
47 + rpc GetMealMenuRecordById (GetMealMenuRecordByIdRpcRequest) returns (GetMealMenuRecordByIdRpcResponse) {}
48 + rpc GetMealMenuRecordsByIds (GetMealMenuRecordsByIdsRpcRequest) returns (GetMealMenuRecordsByIdsRpcResponse) {}
49 + rpc QueryMealMenuRecordsByCondition (QueryMealMenuRecordsByConditionRpcRequest) returns (QueryMealMenuRecordsByConditionRpcResponse) {}
50 + rpc CreateMealMenuRecord (CreateMealMenuRecordRpcRequest) returns (CreateMealMenuRecordRpcResponse) {}
51 +}
52 +
53 +enum MealOrderOrderMethodEnum {
54 + MEAL_ORDER_METHOD_SYSTEM = 0;
55 + MEAL_ORDER_METHOD_MICRO = 1;
56 +}
57 +
58 +message SingleMealOrderRpcResponse {
59 + int32 id = 1;
60 + int32 enterpriseId = 2;
61 + int32 clientId = 3;
62 + int32 menuId = 4;
63 + int32 accountId = 5;
64 + MealOrderOrderMethodEnum orderMethod = 6;
65 + int32 dinerId = 7;
66 + string dinerName = 8;
67 + string clientName = 9;
68 + string gradeName = 10;
69 + string className = 11;
70 + string studentNo = 12;
71 + int64 reserveDate = 13;
72 + string meals = 14;
73 + int32 createdBy = 15;
74 + int64 createdAt = 16;
75 + int32 creationSource = 17;
76 + int32 updatedBy = 18;
77 + int64 updatedAt = 19;
78 + int32 updateSource = 20;
79 + bool isDeleted = 21;
80 +}
81 +
82 +message GetMealOrderByIdRpcRequest {
83 + int32 id = 1;
84 + int32 enterpriseId = 2;
85 + bool includeDeleted = 3;
86 +}
87 +
88 +message GetMealOrderByIdRpcResponse {
89 + SingleMealOrderRpcResponse response = 1;
90 +}
91 +
92 +message GetMealOrdersByIdsRpcRequest {
93 + repeated int32 ids = 1;
94 + int32 enterpriseId = 2;
95 + bool includeDeleted = 3;
96 +}
97 +
98 +message GetMealOrdersByIdsRpcResponse {
99 + repeated SingleMealOrderRpcResponse responses = 1;
100 +}
101 +
102 +message QueryMealOrdersByConditionRpcRequest {
103 + int32 enterpriseId = 1;
104 + bool shouldFilterClientIds = 2;
105 + repeated int32 clientIds = 3;
106 + bool shouldFilterMenuIds = 4;
107 + repeated int32 menuIds = 5;
108 + bool shouldFilterAccountIds = 6;
109 + repeated int32 accountIds = 7;
110 + bool shouldFilterOrderMethod = 8;
111 + MealOrderOrderMethodEnum orderMethod = 9;
112 + bool shouldFilterDinerIds = 10;
113 + repeated int32 dinerIds = 11;
114 + bool shouldFilterReserveDateStart = 12;
115 + int64 reserveDateStart = 13;
116 + bool shouldFilterReserveDateEnd = 14;
117 + int64 reserveDateEnd = 15;
118 + bool includeDeleted = 16;
119 +}
120 +
121 +message QueryMealOrdersByConditionRpcResponse {
122 + repeated SingleMealOrderRpcResponse responses = 1;
123 +}
124 +
125 +message MealOrderCreation{
126 + int32 clientId = 1;
127 + int32 menuId = 2;
128 + int32 accountId = 3;
129 + MealOrderOrderMethodEnum orderMethod = 4;
130 + int32 dinerId = 5;
131 + string dinerName = 6;
132 + string clientName = 7;
133 + string gradeName = 8;
134 + string className = 9;
135 + string studentNo = 10;
136 + int64 reserveDate = 11;
137 + repeated MenuSchedule meals = 12;
138 +}
139 +
140 +message MenuSchedule {
141 + string date = 1; // 日期字段,类型是 string
142 + string menu = 2; // 菜单字段,类型是 string
143 +}
144 +
145 +message CreateMealOrderRpcRequest {
146 + MealOrderCreation creation = 1;
147 + int32 enterpriseId = 2;
148 + int32 createdBy = 3;
149 + int32 creationSource = 4;
150 +}
151 +
152 +message CreateMealOrderRpcResponse {
153 + int32 id = 1;
154 + bool isCreated = 2;
155 +}
156 +
157 +message BatchCreateMealOrdersRpcRequest {
158 + repeated MealOrderCreation creations = 1;
159 + int32 enterpriseId = 2;
160 + int32 createdBy = 3;
161 + int32 creationSource = 4;
162 +}
163 +
164 +message BatchCreateMealOrdersRpcResponse {
165 + repeated int32 ids = 1;
166 + bool isCreated = 2;
167 +}
168 +
169 +message MealOrderModification {
170 + int32 id = 1;
171 + bool shouldUpdateClientId = 2;
172 + int32 clientId = 3;
173 + bool shouldUpdateMenuId = 4;
174 + int32 menuId = 5;
175 + bool shouldUpdateAccountId = 6;
176 + int32 accountId = 7;
177 + bool shouldUpdateOrderMethod = 8;
178 + MealOrderOrderMethodEnum orderMethod = 9;
179 + bool shouldUpdateDinerId = 10;
180 + int32 dinerId = 11;
181 + bool shouldUpdateDinerName = 12;
182 + string dinerName = 13;
183 + bool shouldUpdateClientName = 14;
184 + string clientName = 15;
185 + bool shouldUpdateGradeName = 16;
186 + string gradeName = 17;
187 + bool shouldUpdateClassName = 18;
188 + string className = 19;
189 + bool shouldUpdateStudentNo = 20;
190 + string studentNo = 21;
191 + bool shouldUpdateReserveDate = 22;
192 + int64 reserveDate = 23;
193 + bool shouldUpdateMeals = 24;
194 + string meals = 25;
195 +}
196 +
197 +message UpdateMealOrderRpcRequest {
198 + MealOrderModification modification = 1;
199 + int32 enterpriseId = 2;
200 + int32 updatedBy = 3;
201 + int32 updateSource = 4;
202 +}
203 +
204 +message UpdateMealOrderRpcResponse {
205 + bool isUpdated = 1;
206 +}
207 +
208 +message BatchUpdateMealOrdersRpcRequest {
209 + repeated MealOrderModification modifications = 1;
210 + int32 enterpriseId = 2;
211 + int32 updatedBy = 3;
212 + int32 updateSource = 4;
213 +}
214 +
215 +message BatchUpdateMealOrdersRpcResponse {
216 + bool isUpdated = 1;
217 +}
218 +
219 +message DeleteMealOrdersByIdsRpcRequest {
220 + repeated int32 ids = 1;
221 + int32 enterpriseId = 2;
222 + int32 updatedBy = 3;
223 + int32 updateSource = 4;
224 +}
225 +
226 +message DeleteMealOrdersRpcResponse {
227 + bool isDeleted = 1;
228 +}
229 +
230 +message SingleDinerRpcResponse {
231 + int32 id = 1;
232 + int32 enterpriseId = 2;
233 + int32 clientId = 3;
234 + int32 classId = 4;
235 + string studentNo = 5;
236 + string name = 6;
237 + int32 createdBy = 7;
238 + int64 createdAt = 8;
239 + int32 creationSource = 9;
240 + int32 updatedBy = 10;
241 + int64 updatedAt = 11;
242 + int32 updateSource = 12;
243 + bool isDeleted = 13;
244 +}
245 +
246 +message GetDinerByIdRpcRequest {
247 + int32 id = 1;
248 + int32 enterpriseId = 2;
249 + bool includeDeleted = 3;
250 +}
251 +
252 +message GetDinerByIdRpcResponse {
253 + SingleDinerRpcResponse response = 1;
254 +}
255 +
256 +message GetDinersByIdsRpcRequest {
257 + repeated int32 ids = 1;
258 + int32 enterpriseId = 2;
259 + bool includeDeleted = 3;
260 +}
261 +
262 +message GetDinersByIdsRpcResponse {
263 + repeated SingleDinerRpcResponse responses = 1;
264 +}
265 +
266 +message QueryDinersByConditionRpcRequest {
267 + int32 enterpriseId = 1;
268 + bool shouldFilterClientIds = 2;
269 + repeated int32 clientIds = 3;
270 + bool shouldFilterClassIds = 4;
271 + repeated int32 classIds = 5;
272 + bool shouldFilterStudentNo = 6;
273 + string studentNo = 7;
274 + bool shouldFilterName = 8;
275 + string name = 9;
276 + bool includeDeleted = 10;
277 +}
278 +
279 +message QueryDinersByConditionRpcResponse {
280 + repeated SingleDinerRpcResponse responses = 1;
281 +}
282 +
283 +message DinerCreation{
284 + int32 clientId = 1;
285 + int32 classId = 2;
286 + string studentNo = 3;
287 + string name = 4;
288 +}
289 +
290 +message CreateDinerRpcRequest {
291 + DinerCreation creation = 1;
292 + int32 enterpriseId = 2;
293 + int32 createdBy = 3;
294 + int32 creationSource = 4;
295 +}
296 +
297 +message CreateDinerRpcResponse {
298 + int32 id = 1;
299 + bool isCreated = 2;
300 +}
301 +
302 +message DinerModification {
303 + int32 id = 1;
304 + bool shouldUpdateClientId = 2;
305 + int32 clientId = 3;
306 + bool shouldUpdateClassId = 4;
307 + int32 classId = 5;
308 + bool shouldUpdateStudentNo = 6;
309 + string studentNo = 7;
310 + bool shouldUpdateName = 8;
311 + string name = 9;
312 +}
313 +
314 +message UpdateDinerRpcRequest {
315 + DinerModification modification = 1;
316 + int32 enterpriseId = 2;
317 + int32 updatedBy = 3;
318 + int32 updateSource = 4;
319 +}
320 +
321 +message UpdateDinerRpcResponse {
322 + bool isUpdated = 1;
323 +}
324 +
325 +message BatchSaveOrUpdateDinersRpcRequest {
326 + repeated DinerModification modifications = 1;
327 + int32 enterpriseId = 2;
328 + int32 updatedBy = 3;
329 + int32 updateSource = 4;
330 +}
331 +
332 +message BatchSaveOrUpdateDinersRpcResponse {
333 + bool isUpdated = 1;
334 +}
335 +
336 +message DeleteDinersByIdsRpcRequest {
337 + repeated int32 ids = 1;
338 + int32 enterpriseId = 2;
339 + int32 updatedBy = 3;
340 + int32 updateSource = 4;
341 +}
342 +
343 +message DeleteDinersRpcResponse {
344 + bool isDeleted = 1;
345 +}
346 +
347 +enum MpAccountGenderEnum {
348 + MP_ACCOUNT_GENDER_MAN = 0;
349 + MP_ACCOUNT_GENDER_WOMAN = 1;
350 +}
351 +enum MpAccountStatusEnum {
352 + MP_ACCOUNT_STATUS_ENABLE = 0;
353 + MP_ACCOUNT_STATUS_DISABLE = 1;
354 +}
355 +
356 +message SingleMpAccountRpcResponse {
357 + int32 id = 1;
358 + int32 enterpriseId = 2;
359 + string openId = 3;
360 + string unionId = 4;
361 + string nickname = 5;
362 + string avatarUrl = 6;
363 + MpAccountGenderEnum gender = 7;
364 + string phoneNumber = 8;
365 + MpAccountStatusEnum status = 9;
366 + int32 createdBy = 10;
367 + int64 createdAt = 11;
368 + int32 creationSource = 12;
369 + int32 updatedBy = 13;
370 + int64 updatedAt = 14;
371 + int32 updateSource = 15;
372 + bool isDeleted = 16;
373 +}
374 +
375 +message GetMpAccountByIdRpcRequest {
376 + int32 id = 1;
377 + int32 enterpriseId = 2;
378 + bool includeDeleted = 3;
379 +}
380 +
381 +message GetMpAccountByIdRpcResponse {
382 + SingleMpAccountRpcResponse response = 1;
383 +}
384 +
385 +message GetMpAccountsByIdsRpcRequest {
386 + repeated int32 ids = 1;
387 + int32 enterpriseId = 2;
388 + bool includeDeleted = 3;
389 +}
390 +
391 +message GetMpAccountsByIdsRpcResponse {
392 + repeated SingleMpAccountRpcResponse responses = 1;
393 +}
394 +
395 +message QueryMpAccountsByConditionRpcRequest {
396 + int32 enterpriseId = 1;
397 + bool shouldFilterOpenId = 2;
398 + string openId = 3;
399 + bool shouldFilterUnionId = 4;
400 + string unionId = 5;
401 + bool shouldFilterPhoneNumber = 6;
402 + string phoneNumber = 7;
403 + bool shouldFilterStatus = 8;
404 + MpAccountStatusEnum status = 9;
405 + bool includeDeleted = 10;
406 +}
407 +
408 +message QueryMpAccountsByConditionRpcResponse {
409 + repeated SingleMpAccountRpcResponse responses = 1;
410 +}
411 +
412 +message MpAccountCreation{
413 + string openId = 1;
414 + bool shouldCreateUnionId = 2;
415 + string unionId = 3;
416 + bool shouldCreateNickname = 4;
417 + string nickname = 5;
418 + bool shouldCreateAvatarUrl = 6;
419 + string avatarUrl = 7;
420 + MpAccountGenderEnum gender = 8;
421 + string phoneNumber = 9;
422 + MpAccountStatusEnum status = 10;
423 +}
424 +
425 +message CreateMpAccountRpcRequest {
426 + MpAccountCreation creation = 1;
427 + int32 enterpriseId = 2;
428 + int32 createdBy = 3;
429 + int32 creationSource = 4;
430 +}
431 +
432 +message CreateMpAccountRpcResponse {
433 + int32 id = 1;
434 + bool isCreated = 2;
435 +}
436 +
437 +message MpAccountModification {
438 + int32 id = 1;
439 + bool shouldUpdateOpenId = 2;
440 + string openId = 3;
441 + bool shouldUpdateUnionId = 4;
442 + string unionId = 5;
443 + bool shouldUpdateNickname = 6;
444 + string nickname = 7;
445 + bool shouldUpdateAvatarUrl = 8;
446 + string avatarUrl = 9;
447 + bool shouldUpdateGender = 10;
448 + MpAccountGenderEnum gender = 11;
449 + bool shouldUpdatePhoneNumber = 12;
450 + string phoneNumber = 13;
451 + bool shouldUpdateStatus = 14;
452 + MpAccountStatusEnum status = 15;
453 +}
454 +
455 +message UpdateMpAccountRpcRequest {
456 + MpAccountModification modification = 1;
457 + int32 enterpriseId = 2;
458 + int32 updatedBy = 3;
459 + int32 updateSource = 4;
460 +}
461 +
462 +message UpdateMpAccountRpcResponse {
463 + bool isUpdated = 1;
464 +}
465 +
466 +message DeleteMpAccountsByIdsRpcRequest {
467 + repeated int32 ids = 1;
468 + int32 enterpriseId = 2;
469 + int32 updatedBy = 3;
470 + int32 updateSource = 4;
471 +}
472 +
473 +message DeleteMpAccountsRpcResponse {
474 + bool isDeleted = 1;
475 +}
476 +
477 +message SingleMpAccountDinerRefRpcResponse {
478 + int32 id = 1;
479 + int32 enterpriseId = 2;
480 + int32 accountId = 3;
481 + int32 dinerId = 4;
482 + int32 createdBy = 5;
483 + int64 createdAt = 6;
484 + int32 creationSource = 7;
485 +}
486 +
487 +message GetMpAccountDinerRefsByIdsRpcRequest {
488 + repeated int32 ids = 1;
489 + int32 enterpriseId = 2;
490 +}
491 +
492 +message GetMpAccountDinerRefsByIdsRpcResponse {
493 + repeated SingleMpAccountDinerRefRpcResponse responses = 1;
494 +}
495 +
496 +message QueryMpAccountDinerRefsByConditionRpcRequest {
497 + int32 enterpriseId = 1;
498 + bool shouldFilterAccountIds = 2;
499 + repeated int32 accountIds = 3;
500 + bool shouldFilterDinerIds = 4;
501 + repeated int32 dinerIds = 5;
502 +}
503 +
504 +message QueryMpAccountDinerRefsByConditionRpcResponse {
505 + repeated SingleMpAccountDinerRefRpcResponse responses = 1;
506 +}
507 +
508 +message MpAccountDinerRefCreation{
509 + int32 accountId = 1;
510 + int32 dinerId = 2;
511 +}
512 +
513 +message CreateMpAccountDinerRefRpcRequest {
514 + MpAccountDinerRefCreation creation = 1;
515 + int32 enterpriseId = 2;
516 + int32 createdBy = 3;
517 + int32 creationSource = 4;
518 +}
519 +
520 +message CreateMpAccountDinerRefRpcResponse {
521 + int32 id = 1;
522 + bool isCreated = 2;
523 +}
524 +
525 +message BatchCreateMpAccountDinerRefsRpcRequest {
526 + repeated MpAccountDinerRefCreation creations = 1;
527 + int32 enterpriseId = 2;
528 + int32 createdBy = 3;
529 + int32 creationSource = 4;
530 +}
531 +
532 +message BatchCreateMpAccountDinerRefsRpcResponse {
533 + repeated int32 ids = 1;
534 + bool isCreated = 2;
535 +}
536 +
537 +message DeleteMpAccountDinerRefsByIdsRpcRequest {
538 + repeated int32 ids = 1;
539 + int32 enterpriseId = 2;
540 +}
541 +
542 +message DeleteMpAccountDinerRefsRpcResponse {
543 + bool isDeleted = 1;
544 +}
545 +
546 +message SingleGradeClassRpcResponse {
547 + int32 id = 1;
548 + int32 enterpriseId = 2;
549 + int32 clientId = 3;
550 + string gradeName = 4;
551 + string className = 5;
552 + string fullName = 6;
553 + int32 createdBy = 7;
554 + int64 createdAt = 8;
555 + int32 creationSource = 9;
556 + int32 updatedBy = 10;
557 + int64 updatedAt = 11;
558 + int32 updateSource = 12;
559 + bool isDeleted = 13;
560 +}
561 +
562 +message GetGradeClassByIdRpcRequest {
563 + int32 id = 1;
564 + int32 enterpriseId = 2;
565 + bool includeDeleted = 3;
566 +}
567 +
568 +message GetGradeClassByIdRpcResponse {
569 + SingleGradeClassRpcResponse response = 1;
570 +}
571 +
572 +message GetGradeClassesByIdsRpcRequest {
573 + repeated int32 ids = 1;
574 + int32 enterpriseId = 2;
575 + bool includeDeleted = 3;
576 +}
577 +
578 +message GetGradeClassesByIdsRpcResponse {
579 + repeated SingleGradeClassRpcResponse responses = 1;
580 +}
581 +
582 +message GetAllGradeClassesRpcRequest {
583 + int32 enterpriseId = 1;
584 + bool includeDeleted = 2;
585 +}
586 +
587 +message GetAllGradeClassesRpcResponse {
588 + repeated SingleGradeClassRpcResponse responses = 1;
589 +}
590 +
591 +message QueryGradeClassesByConditionRpcRequest {
592 + int32 enterpriseId = 1;
593 + bool shouldFilterClientIds = 2;
594 + repeated int32 clientIds = 3;
595 + bool shouldFilterGradeName = 4;
596 + string gradeName = 5;
597 + bool includeDeleted = 6;
598 +}
599 +
600 +message QueryGradeClassesByConditionRpcResponse {
601 + repeated SingleGradeClassRpcResponse responses = 1;
602 +}
603 +
604 +message GradeClassCreation{
605 + int32 clientId = 1;
606 + string gradeName = 2;
607 + string className = 3;
608 + bool shouldCreateFullName = 4;
609 + string fullName = 5;
610 +}
611 +
612 +message CreateGradeClassRpcRequest {
613 + GradeClassCreation creation = 1;
614 + int32 enterpriseId = 2;
615 + int32 createdBy = 3;
616 + int32 creationSource = 4;
617 +}
618 +
619 +message CreateGradeClassRpcResponse {
620 + int32 id = 1;
621 + bool isCreated = 2;
622 +}
623 +
624 +message BatchCreateGradeClassesRpcRequest {
625 + repeated GradeClassCreation creations = 1;
626 + int32 enterpriseId = 2;
627 + int32 createdBy = 3;
628 + int32 creationSource = 4;
629 +}
630 +
631 +message BatchCreateGradeClassesRpcResponse {
632 + repeated int32 ids = 1;
633 + bool isCreated = 2;
634 +}
635 +
636 +message GradeClassModification {
637 + int32 id = 1;
638 + bool shouldUpdateClientId = 2;
639 + int32 clientId = 3;
640 + bool shouldUpdateGradeName = 4;
641 + string gradeName = 5;
642 + bool shouldUpdateClassName = 6;
643 + string className = 7;
644 + bool shouldUpdateFullName = 8;
645 + string fullName = 9;
646 +}
647 +
648 +message UpdateGradeClassRpcRequest {
649 + GradeClassModification modification = 1;
650 + int32 enterpriseId = 2;
651 + int32 updatedBy = 3;
652 + int32 updateSource = 4;
653 +}
654 +
655 +message UpdateGradeClassRpcResponse {
656 + bool isUpdated = 1;
657 +}
658 +
659 +message BatchSaveOrUpdateGradeClassesRpcRequest {
660 + repeated GradeClassModification modifications = 1;
661 + int32 enterpriseId = 2;
662 + int32 updatedBy = 3;
663 + int32 updateSource = 4;
664 +}
665 +
666 +message BatchSaveOrUpdateGradeClassesRpcResponse {
667 + bool isUpdated = 1;
668 +}
669 +
670 +message BatchUpdateGradeClassesRpcRequest {
671 + repeated GradeClassModification modifications = 1;
672 + int32 enterpriseId = 2;
673 + int32 updatedBy = 3;
674 + int32 updateSource = 4;
675 +}
676 +
677 +message BatchUpdateGradeClassesRpcResponse {
678 + bool isUpdated = 1;
679 +}
680 +
681 +message DeleteGradeClassesByIdsRpcRequest {
682 + repeated int32 ids = 1;
683 + int32 enterpriseId = 2;
684 + int32 updatedBy = 3;
685 + int32 updateSource = 4;
686 +}
687 +
688 +message DeleteGradeClassesRpcResponse {
689 + bool isDeleted = 1;
690 +}
691 +
692 +message DeleteGradeClassesAndDinersByClientIdsRpcRequest {
693 + repeated int32 clientIds = 1;
694 + int32 enterpriseId = 2;
695 + int32 updatedBy = 3;
696 + int32 updateSource = 4;
697 +}
698 +
699 +message DeleteGradeClassesAndDinersByClientIdsRpcResponse {
700 + bool isDeleted = 1;
701 +}
702 +
703 +message SingleMealMenuRecordRpcResponse {
704 + int32 id = 1;
705 + int32 enterpriseId = 2;
706 + int32 clientId = 3;
707 + string name = 4;
708 + string imageUrl = 5;
709 + int32 createdBy = 6;
710 + int64 createdAt = 7;
711 + int32 creationSource = 8;
712 + int32 updatedBy = 9;
713 + int64 updatedAt = 10;
714 + int32 updateSource = 11;
715 + bool isDeleted = 12;
716 +}
717 +
718 +message GetMealMenuRecordByIdRpcRequest {
719 + int32 id = 1;
720 + int32 enterpriseId = 2;
721 + bool includeDeleted = 3;
722 +}
723 +
724 +message GetMealMenuRecordByIdRpcResponse {
725 + SingleMealMenuRecordRpcResponse response = 1;
726 +}
727 +
728 +message GetMealMenuRecordsByIdsRpcRequest {
729 + repeated int32 ids = 1;
730 + int32 enterpriseId = 2;
731 + bool includeDeleted = 3;
732 +}
733 +
734 +message GetMealMenuRecordsByIdsRpcResponse {
735 + repeated SingleMealMenuRecordRpcResponse responses = 1;
736 +}
737 +
738 +message QueryMealMenuRecordsByConditionRpcRequest {
739 + int32 enterpriseId = 1;
740 + bool shouldFilterClientIds = 2;
741 + repeated int32 clientIds = 3;
742 + bool shouldFilterName = 4;
743 + string name = 5;
744 + bool includeDeleted = 6;
745 +}
746 +
747 +message QueryMealMenuRecordsByConditionRpcResponse {
748 + repeated SingleMealMenuRecordRpcResponse responses = 1;
749 +}
750 +
751 +message MealMenuRecordCreation{
752 + int32 clientId = 1;
753 + string name = 2;
754 + bool shouldCreateImageUrl = 3;
755 + string imageUrl = 4;
756 +}
757 +
758 +message CreateMealMenuRecordRpcRequest {
759 + MealMenuRecordCreation creation = 1;
760 + int32 enterpriseId = 2;
761 + int32 createdBy = 3;
762 + int32 creationSource = 4;
763 +}
764 +
765 +message CreateMealMenuRecordRpcResponse {
766 + int32 id = 1;
767 + bool isCreated = 2;
768 +}
...@@ -7,20 +7,13 @@ spring.main.web-application-type=none ...@@ -7,20 +7,13 @@ spring.main.web-application-type=none
7 spring.application.name=order-service 7 spring.application.name=order-service
8 spring.datasource.driver-class-name=com.mysql.jdbc.Driver 8 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
9 9
10 -spring.datasource.dynamic.datasource.master.url=jdbc:mysql://localhost:3306/cater?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false 10 +spring.datasource.dynamic.datasource.master.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
11 spring.datasource.dynamic.datasource.master.username=root 11 spring.datasource.dynamic.datasource.master.username=root
12 -spring.datasource.dynamic.datasource.master.password=QAZwsx098 12 +spring.datasource.dynamic.datasource.master.password=123456
13 -spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://localhost:3306/cater_slave?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false 13 +spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
14 spring.datasource.dynamic.datasource.slave.username=root 14 spring.datasource.dynamic.datasource.slave.username=root
15 -spring.datasource.dynamic.datasource.slave.password=QAZwsx098 15 +spring.datasource.dynamic.datasource.slave.password=123456
16 spring.datasource.dynamic.primary=master 16 spring.datasource.dynamic.primary=master
17 -#spring.datasource.dynamic.datasource.master.url=jdbc:mysql://rm-uf63gfjzejp163e3g4o.mysql.rds.aliyuncs.com:3306/qingniu?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
18 -#spring.datasource.dynamic.datasource.master.username=jj_infoloop_stage
19 -#spring.datasource.dynamic.datasource.master.password=H8kjNeChi1wimXw
20 -#spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://rm-uf63gfjzejp163e3g4o.mysql.rds.aliyuncs.com:3306/qingniu?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
21 -#spring.datasource.dynamic.datasource.slave.username=jj_infoloop_stage
22 -#spring.datasource.dynamic.datasource.slave.password=H8kjNeChi1wimXw
23 -#spring.datasource.dynamic.primary=master
24 17
25 logging.config=classpath:logback-spring.xml 18 logging.config=classpath:logback-spring.xml
26 19
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.DinerMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.Diner">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="classId" column="classId" jdbcType="INTEGER"/>
12 + <result property="studentNo" column="studentNo" jdbcType="VARCHAR"/>
13 + <result property="name" column="name" jdbcType="VARCHAR"/>
14 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
15 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
16 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
17 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
18 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
19 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
20 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
21 + </resultMap>
22 +
23 + <sql id="Base_Column_List">
24 + id,enterpriseId,clientId,
25 + classId,studentNo,name,
26 + createdBy,createdAt,creationSource,
27 + updatedBy,updatedAt,updateSource,
28 + isDeleted
29 + </sql>
30 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.GradeClassMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.GradeClass">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="gradeName" column="gradeName" jdbcType="VARCHAR"/>
12 + <result property="className" column="className" jdbcType="VARCHAR"/>
13 + <result property="fullName" column="fullName" jdbcType="VARCHAR"/>
14 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
15 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
16 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
17 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
18 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
19 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
20 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
21 + </resultMap>
22 +
23 + <sql id="Base_Column_List">
24 + id,enterpriseId,clientId,
25 + gradeName,className,fullName,
26 + createdBy,createdAt,creationSource,
27 + updatedBy,updatedAt,updateSource,
28 + isDeleted
29 + </sql>
30 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MealMenuRecordMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MealMenuRecord">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="name" column="name" jdbcType="VARCHAR"/>
12 + <result property="imageUrl" column="imageUrl" jdbcType="VARCHAR"/>
13 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
14 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
15 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
16 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
17 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
18 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
19 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
20 + </resultMap>
21 +
22 + <sql id="Base_Column_List">
23 + id,enterpriseId,clientId,
24 + name,imageUrl,createdBy,
25 + createdAt,creationSource,updatedBy,
26 + updatedAt,updateSource,isDeleted
27 + </sql>
28 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MealOrderMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MealOrder">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="menuId" column="menuId" jdbcType="INTEGER"/>
12 + <result property="accountId" column="accountId" jdbcType="INTEGER"/>
13 + <result property="orderMethod" column="orderMethod" jdbcType="TINYINT"/>
14 + <result property="dinerId" column="dinerId" jdbcType="INTEGER"/>
15 + <result property="dinerName" column="dinerName" jdbcType="VARCHAR"/>
16 + <result property="clientName" column="clientName" jdbcType="VARCHAR"/>
17 + <result property="gradeName" column="gradeName" jdbcType="VARCHAR"/>
18 + <result property="className" column="className" jdbcType="VARCHAR"/>
19 + <result property="studentNo" column="studentNo" jdbcType="VARCHAR"/>
20 + <result property="reserveDate" column="reserveDate" jdbcType="TIMESTAMP"/>
21 + <result property="meals" column="meals" jdbcType="OTHER"/>
22 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
23 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
24 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
25 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
26 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
27 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
28 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
29 + </resultMap>
30 +
31 + <sql id="Base_Column_List">
32 + id,enterpriseId,clientId,
33 + menuId,accountId,orderMethod,
34 + dinerId,dinerName,clientName,
35 + gradeName,className,studentNo,
36 + reserveDate,meals,createdBy,
37 + createdAt,creationSource,updatedBy,
38 + updatedAt,updateSource,isDeleted
39 + </sql>
40 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MpAccountDinerRefMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MpAccountDinerRef">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="accountId" column="accountId" jdbcType="INTEGER"/>
11 + <result property="dinerId" column="dinerId" jdbcType="INTEGER"/>
12 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
13 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
14 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
15 + </resultMap>
16 +
17 + <sql id="Base_Column_List">
18 + id,enterpriseId,accountId,
19 + dinerId,createdBy,createdAt,
20 + creationSource
21 + </sql>
22 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MpAccountMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MpAccount">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="openId" column="openId" jdbcType="VARCHAR"/>
11 + <result property="unionId" column="unionId" jdbcType="VARCHAR"/>
12 + <result property="nickname" column="nickname" jdbcType="VARCHAR"/>
13 + <result property="avatarUrl" column="avatarUrl" jdbcType="VARCHAR"/>
14 + <result property="gender" column="gender" jdbcType="TINYINT"/>
15 + <result property="phoneNumber" column="phoneNumber" jdbcType="VARCHAR"/>
16 + <result property="status" column="status" jdbcType="TINYINT"/>
17 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
18 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
19 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
20 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
21 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
22 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
23 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
24 + </resultMap>
25 +
26 + <sql id="Base_Column_List">
27 + id,enterpriseId,openId,
28 + unionId,nickname,avatarUrl,
29 + gender,phoneNumber,status,
30 + createdBy,createdAt,creationSource,
31 + updatedBy,updatedAt,updateSource,
32 + isDeleted
33 + </sql>
34 +</mapper>