Showing
37 changed files
with
2760 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.GetMpAccountByOpenIdRpcRequest; | ||
| 57 | +import com.infoloop.tianting.mealorderservice.GetMpAccountByOpenIdRpcResponse; | ||
| 58 | +import com.infoloop.tianting.mealorderservice.GetMpAccountDinerRefsByIdsRpcRequest; | ||
| 59 | +import com.infoloop.tianting.mealorderservice.GetMpAccountDinerRefsByIdsRpcResponse; | ||
| 60 | +import com.infoloop.tianting.mealorderservice.GetMpAccountsByIdsRpcRequest; | ||
| 61 | +import com.infoloop.tianting.mealorderservice.GetMpAccountsByIdsRpcResponse; | ||
| 62 | +import com.infoloop.tianting.mealorderservice.MealOrderServiceRpcGrpc; | ||
| 63 | +import com.infoloop.tianting.mealorderservice.QueryDinersByConditionRpcRequest; | ||
| 64 | +import com.infoloop.tianting.mealorderservice.QueryDinersByConditionRpcResponse; | ||
| 65 | +import com.infoloop.tianting.mealorderservice.QueryGradeClassesByConditionRpcRequest; | ||
| 66 | +import com.infoloop.tianting.mealorderservice.QueryGradeClassesByConditionRpcResponse; | ||
| 67 | +import com.infoloop.tianting.mealorderservice.QueryLatestMealMenuRecordByClientIdRpcRequest; | ||
| 68 | +import com.infoloop.tianting.mealorderservice.QueryLatestMealMenuRecordByClientIdRpcResponse; | ||
| 69 | +import com.infoloop.tianting.mealorderservice.QueryMealMenuRecordsByConditionRpcRequest; | ||
| 70 | +import com.infoloop.tianting.mealorderservice.QueryMealMenuRecordsByConditionRpcResponse; | ||
| 71 | +import com.infoloop.tianting.mealorderservice.QueryMealOrdersByConditionRpcRequest; | ||
| 72 | +import com.infoloop.tianting.mealorderservice.QueryMealOrdersByConditionRpcResponse; | ||
| 73 | +import com.infoloop.tianting.mealorderservice.QueryMpAccountDinerRefsByConditionRpcRequest; | ||
| 74 | +import com.infoloop.tianting.mealorderservice.QueryMpAccountDinerRefsByConditionRpcResponse; | ||
| 75 | +import com.infoloop.tianting.mealorderservice.QueryMpAccountsByConditionRpcRequest; | ||
| 76 | +import com.infoloop.tianting.mealorderservice.QueryMpAccountsByConditionRpcResponse; | ||
| 77 | +import com.infoloop.tianting.mealorderservice.QueryReserveMealOrdersByDinerIdsRpcRequest; | ||
| 78 | +import com.infoloop.tianting.mealorderservice.QueryReserveMealOrdersByDinerIdsRpcResponse; | ||
| 79 | +import com.infoloop.tianting.mealorderservice.SingleDinerRpcResponse; | ||
| 80 | +import com.infoloop.tianting.mealorderservice.SingleGradeClassRpcResponse; | ||
| 81 | +import com.infoloop.tianting.mealorderservice.SingleMealMenuRecordRpcResponse; | ||
| 82 | +import com.infoloop.tianting.mealorderservice.SingleMealOrderRpcResponse; | ||
| 83 | +import com.infoloop.tianting.mealorderservice.SingleMpAccountDinerRefRpcResponse; | ||
| 84 | +import com.infoloop.tianting.mealorderservice.SingleMpAccountRpcResponse; | ||
| 85 | +import com.infoloop.tianting.mealorderservice.UpdateDinerRpcRequest; | ||
| 86 | +import com.infoloop.tianting.mealorderservice.UpdateDinerRpcResponse; | ||
| 87 | +import com.infoloop.tianting.mealorderservice.UpdateGradeClassRpcRequest; | ||
| 88 | +import com.infoloop.tianting.mealorderservice.UpdateGradeClassRpcResponse; | ||
| 89 | +import com.infoloop.tianting.mealorderservice.UpdateMpAccountRpcRequest; | ||
| 90 | +import com.infoloop.tianting.mealorderservice.UpdateMpAccountRpcResponse; | ||
| 91 | +import com.tianting.infoloop.model.db.Diner; | ||
| 92 | +import com.tianting.infoloop.model.db.GradeClass; | ||
| 93 | +import com.tianting.infoloop.model.db.MealMenuRecord; | ||
| 94 | +import com.tianting.infoloop.model.db.MealOrder; | ||
| 95 | +import com.tianting.infoloop.model.db.MpAccount; | ||
| 96 | +import com.tianting.infoloop.model.db.MpAccountDinerRef; | ||
| 97 | +import com.tianting.infoloop.service.DinerService; | ||
| 98 | +import com.tianting.infoloop.service.GradeClassService; | ||
| 99 | +import com.tianting.infoloop.service.MealMenuRecordService; | ||
| 100 | +import com.tianting.infoloop.service.MealOrderService; | ||
| 101 | +import com.tianting.infoloop.service.MpAccountDinerRefService; | ||
| 102 | +import com.tianting.infoloop.service.MpAccountService; | ||
| 103 | +import com.tianting.infoloop.utils.ProtoBeanUtil; | ||
| 104 | +import io.grpc.Status; | ||
| 105 | +import io.grpc.stub.StreamObserver; | ||
| 106 | +import lombok.RequiredArgsConstructor; | ||
| 107 | +import lombok.extern.slf4j.Slf4j; | ||
| 108 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 109 | +import org.springframework.stereotype.Service; | ||
| 110 | +import org.springframework.transaction.annotation.Transactional; | ||
| 111 | + | ||
| 112 | +import java.time.DayOfWeek; | ||
| 113 | +import java.time.LocalDate; | ||
| 114 | +import java.time.LocalDateTime; | ||
| 115 | +import java.time.LocalTime; | ||
| 116 | +import java.time.temporal.TemporalAdjusters; | ||
| 117 | +import java.util.ArrayList; | ||
| 118 | +import java.util.List; | ||
| 119 | +import java.util.stream.Collectors; | ||
| 120 | + | ||
| 121 | +import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_MASTER; | ||
| 122 | +import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_SLAVE; | ||
| 123 | + | ||
| 124 | +@Slf4j | ||
| 125 | +@Service | ||
| 126 | +@RequiredArgsConstructor(onConstructor_ = @Autowired) | ||
| 127 | +public class MealOrderGrpcService extends MealOrderServiceRpcGrpc.MealOrderServiceRpcImplBase { | ||
| 128 | + | ||
| 129 | + private final DinerService dinerService; | ||
| 130 | + | ||
| 131 | + private final GradeClassService gradeClassService; | ||
| 132 | + | ||
| 133 | + private final MealMenuRecordService mealMenuRecordService; | ||
| 134 | + | ||
| 135 | + private final MealOrderService mealOrderService; | ||
| 136 | + | ||
| 137 | + private final MpAccountDinerRefService mpAccountDinerRefService; | ||
| 138 | + | ||
| 139 | + private final MpAccountService mpAccountService; | ||
| 140 | + | ||
| 141 | + @Override | ||
| 142 | + @DS(DATA_SOURCE_SLAVE) | ||
| 143 | + public void getMealOrderById(final GetMealOrderByIdRpcRequest request, | ||
| 144 | + final StreamObserver<GetMealOrderByIdRpcResponse> responseObserver) { | ||
| 145 | + final var builder = GetMealOrderByIdRpcResponse.newBuilder(); | ||
| 146 | + try { | ||
| 147 | + final var mealOrder = mealOrderService.getById(request.getId()); | ||
| 148 | + if (mealOrder != null) { | ||
| 149 | + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleMealOrderRpcResponse.class)); | ||
| 150 | + } | ||
| 151 | + } catch (final Exception e) { | ||
| 152 | + log.error("getMealOrderById error;", e); | ||
| 153 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 154 | + } | ||
| 155 | + responseObserver.onNext(builder.build()); | ||
| 156 | + responseObserver.onCompleted(); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + @Override | ||
| 160 | + @DS(DATA_SOURCE_SLAVE) | ||
| 161 | + public void getMealOrdersByIds(final GetMealOrdersByIdsRpcRequest request, | ||
| 162 | + final StreamObserver<GetMealOrdersByIdsRpcResponse> responseObserver) { | ||
| 163 | + final var builder = GetMealOrdersByIdsRpcResponse.newBuilder(); | ||
| 164 | + try { | ||
| 165 | + final var mealOrders = mealOrderService.listByIds(request.getIdsList()); | ||
| 166 | + if (!mealOrders.isEmpty()) { | ||
| 167 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMealOrderRpcResponse.class)); | ||
| 168 | + } | ||
| 169 | + } catch (final Exception e) { | ||
| 170 | + log.error("getMealOrdersByIds error;", e); | ||
| 171 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 172 | + } | ||
| 173 | + responseObserver.onNext(builder.build()); | ||
| 174 | + responseObserver.onCompleted(); | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + @Override | ||
| 178 | + @DS(DATA_SOURCE_SLAVE) | ||
| 179 | + public void queryMealOrdersByCondition(final QueryMealOrdersByConditionRpcRequest request, | ||
| 180 | + final StreamObserver<QueryMealOrdersByConditionRpcResponse> responseObserver) { | ||
| 181 | + final var builder = QueryMealOrdersByConditionRpcResponse.newBuilder(); | ||
| 182 | + try { | ||
| 183 | + LambdaQueryWrapper<MealOrder> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 184 | + queryWrapper.eq(MealOrder::getEnterpriseId, request.getEnterpriseId()); | ||
| 185 | + if (request.getShouldFilterClientIds()) { | ||
| 186 | + queryWrapper.in(!request.getClientIdsList().isEmpty(), MealOrder::getClientId, request.getClientIdsList()); | ||
| 187 | + } | ||
| 188 | + if (request.getShouldFilterMenuIds()) { | ||
| 189 | + queryWrapper.in(!request.getMenuIdsList().isEmpty(), MealOrder::getMenuId, request.getMenuIdsList()); | ||
| 190 | + } | ||
| 191 | + if (request.getShouldFilterAccountIds()) { | ||
| 192 | + queryWrapper.in(!request.getAccountIdsList().isEmpty(), MealOrder::getAccountId, request.getAccountIdsList()); | ||
| 193 | + } | ||
| 194 | + if (request.getShouldFilterOrderMethod()) { | ||
| 195 | + queryWrapper.eq(MealOrder::getOrderMethod, request.getOrderMethodValue()); | ||
| 196 | + } | ||
| 197 | + if (request.getShouldFilterDinerIds()) { | ||
| 198 | + queryWrapper.in(!request.getDinerIdsList().isEmpty(), MealOrder::getDinerId, request.getDinerIdsList()); | ||
| 199 | + } | ||
| 200 | + if (request.getShouldFilterReserveDateStart()) { | ||
| 201 | + queryWrapper.ge(MealOrder::getReserveDate, LocalDateTimeUtil.of(request.getReserveDateStart())); | ||
| 202 | + } | ||
| 203 | + if (request.getShouldFilterReserveDateEnd()) { | ||
| 204 | + queryWrapper.lt(MealOrder::getReserveDate, LocalDateTimeUtil.of(request.getReserveDateEnd())); | ||
| 205 | + } | ||
| 206 | + final var mealOrders = mealOrderService.list(queryWrapper); | ||
| 207 | + if (!mealOrders.isEmpty()) { | ||
| 208 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMealOrderRpcResponse.class)); | ||
| 209 | + } | ||
| 210 | + } catch (final Exception e) { | ||
| 211 | + log.error("queryMealOrdersByCondition error;", e); | ||
| 212 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 213 | + } | ||
| 214 | + responseObserver.onNext(builder.build()); | ||
| 215 | + responseObserver.onCompleted(); | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + @Override | ||
| 219 | + @DS(DATA_SOURCE_SLAVE) | ||
| 220 | + public void queryReserveMealOrdersByDinerIds(final QueryReserveMealOrdersByDinerIdsRpcRequest request, | ||
| 221 | + final StreamObserver<QueryReserveMealOrdersByDinerIdsRpcResponse> responseObserver) { | ||
| 222 | + final var builder = QueryReserveMealOrdersByDinerIdsRpcResponse.newBuilder(); | ||
| 223 | + try { | ||
| 224 | + LambdaQueryWrapper<MealOrder> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 225 | + queryWrapper.eq(MealOrder::getEnterpriseId, request.getEnterpriseId()); | ||
| 226 | + queryWrapper.in(!request.getDinerIdsList().isEmpty(), MealOrder::getDinerId, request.getDinerIdsList()); | ||
| 227 | + LocalDate today = LocalDate.now(); | ||
| 228 | + LocalDate nextMonday = today.with(TemporalAdjusters.next(DayOfWeek.MONDAY)); | ||
| 229 | + LocalDateTime nextMondayStart = LocalDateTime.of(nextMonday, LocalTime.MIN); | ||
| 230 | + LocalDate nextSunday = nextMonday.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)); | ||
| 231 | + LocalDateTime nextSundayEnd = LocalDateTime.of(nextSunday, LocalTime.MAX); | ||
| 232 | + queryWrapper.ge(MealOrder::getReserveDate, nextMondayStart); | ||
| 233 | + queryWrapper.lt(MealOrder::getReserveDate, nextSundayEnd); | ||
| 234 | + final var mealOrders = mealOrderService.list(queryWrapper); | ||
| 235 | + if (!mealOrders.isEmpty()) { | ||
| 236 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMealOrderRpcResponse.class)); | ||
| 237 | + } | ||
| 238 | + } catch (final Exception e) { | ||
| 239 | + log.error("queryReserveMealOrdersByDinerIds error;", e); | ||
| 240 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 241 | + } | ||
| 242 | + responseObserver.onNext(builder.build()); | ||
| 243 | + responseObserver.onCompleted(); | ||
| 244 | + } | ||
| 245 | + | ||
| 246 | + @Override | ||
| 247 | + @DS(DATA_SOURCE_MASTER) | ||
| 248 | + public void createMealOrder(final CreateMealOrderRpcRequest request, | ||
| 249 | + final StreamObserver<CreateMealOrderRpcResponse> responseObserver) { | ||
| 250 | + final var builder = CreateMealOrderRpcResponse.newBuilder(); | ||
| 251 | + try { | ||
| 252 | + MealOrder mealOrder = new MealOrder(); | ||
| 253 | + mealOrder.setEnterpriseId(request.getEnterpriseId()); | ||
| 254 | + mealOrder.setCreatedBy(request.getCreatedBy()); | ||
| 255 | + mealOrder.setCreationSource(request.getCreationSource()); | ||
| 256 | + mealOrder.setClientId(request.getCreation().getClientId()); | ||
| 257 | + mealOrder.setMenuId(request.getCreation().getMenuId()); | ||
| 258 | + mealOrder.setAccountId(request.getCreation().getAccountId()); | ||
| 259 | + mealOrder.setOrderMethod(request.getCreation().getOrderMethodValue()); | ||
| 260 | + mealOrder.setDinerId(request.getCreation().getDinerId()); | ||
| 261 | + mealOrder.setDinerName(request.getCreation().getDinerName()); | ||
| 262 | + mealOrder.setClientName(request.getCreation().getClientName()); | ||
| 263 | + mealOrder.setGradeName(request.getCreation().getGradeName()); | ||
| 264 | + mealOrder.setClassName(request.getCreation().getClassName()); | ||
| 265 | + mealOrder.setStudentNo(request.getCreation().getStudentNo()); | ||
| 266 | + mealOrder.setReserveDate(LocalDateTimeUtil.of(request.getCreation().getReserveDate())); | ||
| 267 | + mealOrder.setMeals(ProtoBeanUtil.protoListToJson(request.getCreation().getMealsList())); | ||
| 268 | + builder.setIsCreated(mealOrderService.save(mealOrder)).setId(mealOrder.getId()); | ||
| 269 | + } catch (final Exception e) { | ||
| 270 | + log.error("createMealOrder error;", e); | ||
| 271 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 272 | + } | ||
| 273 | + responseObserver.onNext(builder.build()); | ||
| 274 | + responseObserver.onCompleted(); | ||
| 275 | + } | ||
| 276 | + | ||
| 277 | + @Override | ||
| 278 | + @DS(DATA_SOURCE_MASTER) | ||
| 279 | + public void deleteMealOrdersByIds(final DeleteMealOrdersByIdsRpcRequest request, | ||
| 280 | + final StreamObserver<DeleteMealOrdersRpcResponse> responseObserver) { | ||
| 281 | + final var builder = DeleteMealOrdersRpcResponse.newBuilder(); | ||
| 282 | + try { | ||
| 283 | + builder.setIsDeleted(mealOrderService.removeBatchByIds(request.getIdsList())); | ||
| 284 | + } catch (final Exception e) { | ||
| 285 | + log.error("deleteMealOrdersByIds error;", e); | ||
| 286 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 287 | + } | ||
| 288 | + responseObserver.onNext(builder.build()); | ||
| 289 | + responseObserver.onCompleted(); | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + @Override | ||
| 293 | + @DS(DATA_SOURCE_SLAVE) | ||
| 294 | + public void getMpAccountById(final GetMpAccountByIdRpcRequest request, | ||
| 295 | + final StreamObserver<GetMpAccountByIdRpcResponse> responseObserver) { | ||
| 296 | + final var builder = GetMpAccountByIdRpcResponse.newBuilder(); | ||
| 297 | + try { | ||
| 298 | + final var mealOrder = mpAccountService.getById(request.getId()); | ||
| 299 | + if (mealOrder != null) { | ||
| 300 | + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleMpAccountRpcResponse.class)); | ||
| 301 | + } | ||
| 302 | + } catch (final Exception e) { | ||
| 303 | + log.error("getMpAccountById error;", e); | ||
| 304 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 305 | + } | ||
| 306 | + responseObserver.onNext(builder.build()); | ||
| 307 | + responseObserver.onCompleted(); | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + @Override | ||
| 311 | + @DS(DATA_SOURCE_SLAVE) | ||
| 312 | + public void getMpAccountByOpenId(final GetMpAccountByOpenIdRpcRequest request, | ||
| 313 | + final StreamObserver<GetMpAccountByOpenIdRpcResponse> responseObserver) { | ||
| 314 | + final var builder = GetMpAccountByOpenIdRpcResponse.newBuilder(); | ||
| 315 | + try { | ||
| 316 | + LambdaQueryWrapper<MpAccount> queryWrapper = Wrappers.lambdaQuery(); | ||
| 317 | + queryWrapper.eq(MpAccount::getOpenId, request.getOpenId()); | ||
| 318 | + final var mpAccount = mpAccountService.getOne(queryWrapper); | ||
| 319 | + if (mpAccount != null) { | ||
| 320 | + builder.setResponse(ProtoBeanUtil.beanToProto(mpAccount, SingleMpAccountRpcResponse.class)); | ||
| 321 | + } | ||
| 322 | + } catch (final Exception e) { | ||
| 323 | + log.error("getMpAccountByOpenId error;", e); | ||
| 324 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 325 | + } | ||
| 326 | + responseObserver.onNext(builder.build()); | ||
| 327 | + responseObserver.onCompleted(); | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + @Override | ||
| 331 | + @DS(DATA_SOURCE_SLAVE) | ||
| 332 | + public void getMpAccountsByIds(final GetMpAccountsByIdsRpcRequest request, | ||
| 333 | + final StreamObserver<GetMpAccountsByIdsRpcResponse> responseObserver) { | ||
| 334 | + final var builder = GetMpAccountsByIdsRpcResponse.newBuilder(); | ||
| 335 | + try { | ||
| 336 | + final var mealOrders = mpAccountService.listByIds(request.getIdsList()); | ||
| 337 | + if (!mealOrders.isEmpty()) { | ||
| 338 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMpAccountRpcResponse.class)); | ||
| 339 | + } | ||
| 340 | + } catch (final Exception e) { | ||
| 341 | + log.error("getMpAccountsByIds error;", e); | ||
| 342 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 343 | + } | ||
| 344 | + responseObserver.onNext(builder.build()); | ||
| 345 | + responseObserver.onCompleted(); | ||
| 346 | + } | ||
| 347 | + | ||
| 348 | + @Override | ||
| 349 | + @DS(DATA_SOURCE_SLAVE) | ||
| 350 | + public void queryMpAccountsByCondition(final QueryMpAccountsByConditionRpcRequest request, | ||
| 351 | + final StreamObserver<QueryMpAccountsByConditionRpcResponse> responseObserver) { | ||
| 352 | + final var builder = QueryMpAccountsByConditionRpcResponse.newBuilder(); | ||
| 353 | + try { | ||
| 354 | + LambdaQueryWrapper<MpAccount> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 355 | + queryWrapper.eq(MpAccount::getEnterpriseId, request.getEnterpriseId()); | ||
| 356 | + if (request.getShouldFilterOpenId()) { | ||
| 357 | + queryWrapper.eq(MpAccount::getOpenId, request.getOpenId()); | ||
| 358 | + } | ||
| 359 | + if (request.getShouldFilterUnionId()) { | ||
| 360 | + queryWrapper.eq(MpAccount::getUnionId, request.getUnionId()); | ||
| 361 | + } | ||
| 362 | + if (request.getShouldFilterPhoneNumber()) { | ||
| 363 | + queryWrapper.eq(MpAccount::getPhoneNumber, request.getPhoneNumber()); | ||
| 364 | + } | ||
| 365 | + if (request.getShouldFilterStatus()) { | ||
| 366 | + queryWrapper.eq(MpAccount::getStatus, request.getStatusValue()); | ||
| 367 | + } | ||
| 368 | + final var mealOrders = mpAccountService.list(queryWrapper); | ||
| 369 | + if (!mealOrders.isEmpty()) { | ||
| 370 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleMpAccountRpcResponse.class)); | ||
| 371 | + } | ||
| 372 | + } catch (final Exception e) { | ||
| 373 | + log.error("queryMpAccountsByCondition error;", e); | ||
| 374 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 375 | + } | ||
| 376 | + responseObserver.onNext(builder.build()); | ||
| 377 | + responseObserver.onCompleted(); | ||
| 378 | + } | ||
| 379 | + | ||
| 380 | + @Override | ||
| 381 | + @DS(DATA_SOURCE_MASTER) | ||
| 382 | + public void createMpAccount(final CreateMpAccountRpcRequest request, | ||
| 383 | + final StreamObserver<CreateMpAccountRpcResponse> responseObserver) { | ||
| 384 | + final var builder = CreateMpAccountRpcResponse.newBuilder(); | ||
| 385 | + try { | ||
| 386 | + MpAccount mpAccount = new MpAccount(); | ||
| 387 | + mpAccount.setEnterpriseId(request.getEnterpriseId()); | ||
| 388 | + mpAccount.setCreatedBy(request.getCreatedBy()); | ||
| 389 | + mpAccount.setCreationSource(request.getCreationSource()); | ||
| 390 | + mpAccount.setOpenId(request.getCreation().getOpenId()); | ||
| 391 | + if (request.getCreation().getShouldCreateUnionId()) { | ||
| 392 | + mpAccount.setUnionId(request.getCreation().getUnionId()); | ||
| 393 | + } | ||
| 394 | + if (request.getCreation().getShouldCreateNickname()) { | ||
| 395 | + mpAccount.setNickname(request.getCreation().getNickname()); | ||
| 396 | + } | ||
| 397 | + if (request.getCreation().getShouldCreateAvatarUrl()) { | ||
| 398 | + mpAccount.setAvatarUrl(request.getCreation().getAvatarUrl()); | ||
| 399 | + } | ||
| 400 | + mpAccount.setGender(request.getCreation().getGenderValue()); | ||
| 401 | + mpAccount.setPhoneNumber(request.getCreation().getPhoneNumber()); | ||
| 402 | + mpAccount.setStatus(request.getCreation().getStatusValue()); | ||
| 403 | + builder.setIsCreated(mpAccountService.save(mpAccount)).setId(mpAccount.getId()); | ||
| 404 | + } catch (final Exception e) { | ||
| 405 | + log.error("createMpAccount error;", e); | ||
| 406 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 407 | + } | ||
| 408 | + responseObserver.onNext(builder.build()); | ||
| 409 | + responseObserver.onCompleted(); | ||
| 410 | + } | ||
| 411 | + | ||
| 412 | + @Override | ||
| 413 | + @DS(DATA_SOURCE_MASTER) | ||
| 414 | + public void updateMpAccount(final UpdateMpAccountRpcRequest request, | ||
| 415 | + final StreamObserver<UpdateMpAccountRpcResponse> responseObserver) { | ||
| 416 | + final var builder = UpdateMpAccountRpcResponse.newBuilder(); | ||
| 417 | + try { | ||
| 418 | + MpAccount mpAccount = new MpAccount(); | ||
| 419 | + mpAccount.setId(request.getModification().getId()); | ||
| 420 | + mpAccount.setEnterpriseId(request.getEnterpriseId()); | ||
| 421 | + mpAccount.setUpdatedBy(request.getUpdatedBy()); | ||
| 422 | + mpAccount.setUpdateSource(request.getUpdateSource()); | ||
| 423 | + if (request.getModification().getShouldUpdateNickname()) { | ||
| 424 | + mpAccount.setNickname(request.getModification().getNickname()); | ||
| 425 | + } | ||
| 426 | + if (request.getModification().getShouldUpdateAvatarUrl()) { | ||
| 427 | + mpAccount.setAvatarUrl(request.getModification().getAvatarUrl()); | ||
| 428 | + } | ||
| 429 | + if (request.getModification().getShouldUpdateGender()) { | ||
| 430 | + mpAccount.setGender(request.getModification().getGenderValue()); | ||
| 431 | + } | ||
| 432 | + if (request.getModification().getShouldUpdatePhoneNumber()) { | ||
| 433 | + mpAccount.setPhoneNumber(request.getModification().getPhoneNumber()); | ||
| 434 | + } | ||
| 435 | + if (request.getModification().getShouldUpdateStatus()) { | ||
| 436 | + mpAccount.setStatus(request.getModification().getStatusValue()); | ||
| 437 | + } | ||
| 438 | + builder.setIsUpdated(mpAccountService.updateById(mpAccount)); | ||
| 439 | + } catch (final Exception e) { | ||
| 440 | + log.error("updateMpAccount error;", e); | ||
| 441 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 442 | + } | ||
| 443 | + responseObserver.onNext(builder.build()); | ||
| 444 | + responseObserver.onCompleted(); | ||
| 445 | + } | ||
| 446 | + | ||
| 447 | + @Override | ||
| 448 | + @DS(DATA_SOURCE_MASTER) | ||
| 449 | + public void deleteMpAccountsByIds(final DeleteMpAccountsByIdsRpcRequest request, | ||
| 450 | + final StreamObserver<DeleteMpAccountsRpcResponse> responseObserver) { | ||
| 451 | + final var builder = DeleteMpAccountsRpcResponse.newBuilder(); | ||
| 452 | + try { | ||
| 453 | + builder.setIsDeleted(mpAccountService.removeBatchByIds(request.getIdsList())); | ||
| 454 | + } catch (final Exception e) { | ||
| 455 | + log.error("deleteMpAccountsByIds error;", e); | ||
| 456 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 457 | + } | ||
| 458 | + responseObserver.onNext(builder.build()); | ||
| 459 | + responseObserver.onCompleted(); | ||
| 460 | + } | ||
| 461 | + | ||
| 462 | + @Override | ||
| 463 | + @DS(DATA_SOURCE_SLAVE) | ||
| 464 | + public void getDinerById(final GetDinerByIdRpcRequest request, | ||
| 465 | + final StreamObserver<GetDinerByIdRpcResponse> responseObserver) { | ||
| 466 | + final var builder = GetDinerByIdRpcResponse.newBuilder(); | ||
| 467 | + try { | ||
| 468 | + final var mealOrder = dinerService.getById(request.getId()); | ||
| 469 | + if (mealOrder != null) { | ||
| 470 | + builder.setResponse(ProtoBeanUtil.beanToProto(mealOrder, SingleDinerRpcResponse.class)); | ||
| 471 | + } | ||
| 472 | + } catch (final Exception e) { | ||
| 473 | + log.error("getDinerById error;", e); | ||
| 474 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 475 | + } | ||
| 476 | + responseObserver.onNext(builder.build()); | ||
| 477 | + responseObserver.onCompleted(); | ||
| 478 | + } | ||
| 479 | + | ||
| 480 | + @Override | ||
| 481 | + @DS(DATA_SOURCE_SLAVE) | ||
| 482 | + public void getDinersByIds(final GetDinersByIdsRpcRequest request, | ||
| 483 | + final StreamObserver<GetDinersByIdsRpcResponse> responseObserver) { | ||
| 484 | + final var builder = GetDinersByIdsRpcResponse.newBuilder(); | ||
| 485 | + try { | ||
| 486 | + final var mealOrders = dinerService.listByIds(request.getIdsList()); | ||
| 487 | + if (!mealOrders.isEmpty()) { | ||
| 488 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealOrders, SingleDinerRpcResponse.class)); | ||
| 489 | + } | ||
| 490 | + } catch (final Exception e) { | ||
| 491 | + log.error("getDinersByIds error;", e); | ||
| 492 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 493 | + } | ||
| 494 | + responseObserver.onNext(builder.build()); | ||
| 495 | + responseObserver.onCompleted(); | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + @Override | ||
| 499 | + @DS(DATA_SOURCE_SLAVE) | ||
| 500 | + public void queryDinersByCondition(final QueryDinersByConditionRpcRequest request, | ||
| 501 | + final StreamObserver<QueryDinersByConditionRpcResponse> responseObserver) { | ||
| 502 | + final var builder = QueryDinersByConditionRpcResponse.newBuilder(); | ||
| 503 | + try { | ||
| 504 | + LambdaQueryWrapper<Diner> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 505 | + queryWrapper.eq(Diner::getEnterpriseId, request.getEnterpriseId()); | ||
| 506 | + if (request.getShouldFilterClientIds()) { | ||
| 507 | + queryWrapper.in(!request.getClientIdsList().isEmpty(), Diner::getClientId, request.getClientIdsList()); | ||
| 508 | + } | ||
| 509 | + if (request.getShouldFilterClassIds()) { | ||
| 510 | + queryWrapper.in(!request.getClassIdsList().isEmpty(), Diner::getClassId, request.getClassIdsList()); | ||
| 511 | + } | ||
| 512 | + if (request.getShouldFilterStudentNo()) { | ||
| 513 | + queryWrapper.eq(Diner::getStudentNo, request.getStudentNo()); | ||
| 514 | + } | ||
| 515 | + if (request.getShouldFilterName()) { | ||
| 516 | + queryWrapper.eq(Diner::getName, request.getName()); | ||
| 517 | + } | ||
| 518 | + final var diners = dinerService.list(queryWrapper); | ||
| 519 | + if (!diners.isEmpty()) { | ||
| 520 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleDinerRpcResponse.class)); | ||
| 521 | + } | ||
| 522 | + } catch (final Exception e) { | ||
| 523 | + log.error("queryDinersByCondition error;", e); | ||
| 524 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 525 | + } | ||
| 526 | + responseObserver.onNext(builder.build()); | ||
| 527 | + responseObserver.onCompleted(); | ||
| 528 | + } | ||
| 529 | + | ||
| 530 | + @Override | ||
| 531 | + @DS(DATA_SOURCE_MASTER) | ||
| 532 | + public void createDiner(final CreateDinerRpcRequest request, | ||
| 533 | + final StreamObserver<CreateDinerRpcResponse> responseObserver) { | ||
| 534 | + final var builder = CreateDinerRpcResponse.newBuilder(); | ||
| 535 | + try { | ||
| 536 | + Diner diner = new Diner(); | ||
| 537 | + diner.setEnterpriseId(request.getEnterpriseId()); | ||
| 538 | + diner.setCreatedBy(request.getCreatedBy()); | ||
| 539 | + diner.setCreationSource(request.getCreationSource()); | ||
| 540 | + diner.setClientId(request.getCreation().getClientId()); | ||
| 541 | + diner.setClassId(request.getCreation().getClassId()); | ||
| 542 | + diner.setStudentNo(request.getCreation().getStudentNo()); | ||
| 543 | + diner.setName(request.getCreation().getName()); | ||
| 544 | + builder.setIsCreated(dinerService.save(diner)).setId(diner.getId()); | ||
| 545 | + } catch (final Exception e) { | ||
| 546 | + log.error("createDiner error;", e); | ||
| 547 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 548 | + } | ||
| 549 | + responseObserver.onNext(builder.build()); | ||
| 550 | + responseObserver.onCompleted(); | ||
| 551 | + } | ||
| 552 | + | ||
| 553 | + @Override | ||
| 554 | + @DS(DATA_SOURCE_MASTER) | ||
| 555 | + public void updateDiner(final UpdateDinerRpcRequest request, | ||
| 556 | + final StreamObserver<UpdateDinerRpcResponse> responseObserver) { | ||
| 557 | + final var builder = UpdateDinerRpcResponse.newBuilder(); | ||
| 558 | + try { | ||
| 559 | + Diner diner = new Diner(); | ||
| 560 | + diner.setId(request.getModification().getId()); | ||
| 561 | + diner.setEnterpriseId(request.getEnterpriseId()); | ||
| 562 | + diner.setUpdatedBy(request.getUpdatedBy()); | ||
| 563 | + diner.setUpdateSource(request.getUpdateSource()); | ||
| 564 | + if (request.getModification().getShouldUpdateClientId()) { | ||
| 565 | + diner.setClientId(request.getModification().getClientId()); | ||
| 566 | + } | ||
| 567 | + if (request.getModification().getShouldUpdateClassId()) { | ||
| 568 | + diner.setClassId(request.getModification().getClassId()); | ||
| 569 | + } | ||
| 570 | + if (request.getModification().getShouldUpdateStudentNo()) { | ||
| 571 | + diner.setStudentNo(request.getModification().getStudentNo()); | ||
| 572 | + } | ||
| 573 | + if (request.getModification().getShouldUpdateName()) { | ||
| 574 | + diner.setName(request.getModification().getName()); | ||
| 575 | + } | ||
| 576 | + builder.setIsUpdated(dinerService.updateById(diner)); | ||
| 577 | + } catch (final Exception e) { | ||
| 578 | + log.error("updateDiner error;", e); | ||
| 579 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 580 | + } | ||
| 581 | + responseObserver.onNext(builder.build()); | ||
| 582 | + responseObserver.onCompleted(); | ||
| 583 | + } | ||
| 584 | + | ||
| 585 | + @Override | ||
| 586 | + @DS(DATA_SOURCE_MASTER) | ||
| 587 | + public void batchSaveOrUpdateDiners(final BatchSaveOrUpdateDinersRpcRequest request, | ||
| 588 | + final StreamObserver<BatchSaveOrUpdateDinersRpcResponse> responseObserver) { | ||
| 589 | + final var builder = BatchSaveOrUpdateDinersRpcResponse.newBuilder(); | ||
| 590 | + try { | ||
| 591 | + final var diners = new ArrayList<Diner>(); | ||
| 592 | + for (DinerModification modification : request.getModificationsList()) { | ||
| 593 | + Diner diner = new Diner(); | ||
| 594 | + diner.setId(modification.getId() == 0 ? null : modification.getId()); | ||
| 595 | + diner.setEnterpriseId(request.getEnterpriseId()); | ||
| 596 | + if (modification.getId() == 0) { | ||
| 597 | + diner.setCreatedBy(request.getUpdatedBy()); | ||
| 598 | + diner.setCreationSource(request.getUpdateSource()); | ||
| 599 | + } | ||
| 600 | + diner.setUpdatedBy(request.getUpdatedBy()); | ||
| 601 | + diner.setUpdateSource(request.getUpdateSource()); | ||
| 602 | + if (modification.getShouldUpdateClientId()) { | ||
| 603 | + diner.setClientId(modification.getClientId()); | ||
| 604 | + } | ||
| 605 | + if (modification.getShouldUpdateClassId()) { | ||
| 606 | + diner.setClassId(modification.getClassId()); | ||
| 607 | + } | ||
| 608 | + if (modification.getShouldUpdateStudentNo()) { | ||
| 609 | + diner.setStudentNo(modification.getStudentNo()); | ||
| 610 | + } | ||
| 611 | + if (modification.getShouldUpdateName()) { | ||
| 612 | + diner.setName(modification.getName()); | ||
| 613 | + } | ||
| 614 | + diners.add(diner); | ||
| 615 | + } | ||
| 616 | + builder.setIsUpdated(dinerService.saveOrUpdateBatch(diners)); | ||
| 617 | + } catch (final Exception e) { | ||
| 618 | + log.error("batchSaveOrUpdateDiners 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 deleteDinersByIds(final DeleteDinersByIdsRpcRequest request, | ||
| 628 | + final StreamObserver<DeleteDinersRpcResponse> responseObserver) { | ||
| 629 | + final var builder = DeleteDinersRpcResponse.newBuilder(); | ||
| 630 | + try { | ||
| 631 | + builder.setIsDeleted(dinerService.removeBatchByIds(request.getIdsList())); | ||
| 632 | + } catch (final Exception e) { | ||
| 633 | + log.error("deleteDinersByIds error;", e); | ||
| 634 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 635 | + } | ||
| 636 | + responseObserver.onNext(builder.build()); | ||
| 637 | + responseObserver.onCompleted(); | ||
| 638 | + } | ||
| 639 | + | ||
| 640 | + @Override | ||
| 641 | + @DS(DATA_SOURCE_SLAVE) | ||
| 642 | + public void getMpAccountDinerRefsByIds(final GetMpAccountDinerRefsByIdsRpcRequest request, | ||
| 643 | + final StreamObserver<GetMpAccountDinerRefsByIdsRpcResponse> responseObserver) { | ||
| 644 | + final var builder = GetMpAccountDinerRefsByIdsRpcResponse.newBuilder(); | ||
| 645 | + try { | ||
| 646 | + final var mpAccountDinerRefs = mpAccountDinerRefService.listByIds(request.getIdsList()); | ||
| 647 | + if (!mpAccountDinerRefs.isEmpty()) { | ||
| 648 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mpAccountDinerRefs, SingleMpAccountDinerRefRpcResponse.class)); | ||
| 649 | + } | ||
| 650 | + } catch (final Exception e) { | ||
| 651 | + log.error("getMpAccountDinerRefsByIds error;", e); | ||
| 652 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 653 | + } | ||
| 654 | + responseObserver.onNext(builder.build()); | ||
| 655 | + responseObserver.onCompleted(); | ||
| 656 | + } | ||
| 657 | + | ||
| 658 | + @Override | ||
| 659 | + @DS(DATA_SOURCE_SLAVE) | ||
| 660 | + public void queryMpAccountDinerRefsByCondition(final QueryMpAccountDinerRefsByConditionRpcRequest request, | ||
| 661 | + final StreamObserver<QueryMpAccountDinerRefsByConditionRpcResponse> responseObserver) { | ||
| 662 | + final var builder = QueryMpAccountDinerRefsByConditionRpcResponse.newBuilder(); | ||
| 663 | + try { | ||
| 664 | + LambdaQueryWrapper<MpAccountDinerRef> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 665 | + queryWrapper.eq(MpAccountDinerRef::getEnterpriseId, request.getEnterpriseId()); | ||
| 666 | + if (request.getShouldFilterAccountIds()) { | ||
| 667 | + queryWrapper.in(!request.getAccountIdsList().isEmpty(), MpAccountDinerRef::getAccountId, request.getAccountIdsList()); | ||
| 668 | + } | ||
| 669 | + if (request.getShouldFilterDinerIds()) { | ||
| 670 | + queryWrapper.in(!request.getDinerIdsList().isEmpty(), MpAccountDinerRef::getDinerId, request.getDinerIdsList()); | ||
| 671 | + } | ||
| 672 | + final var diners = mpAccountDinerRefService.list(queryWrapper); | ||
| 673 | + if (!diners.isEmpty()) { | ||
| 674 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleMpAccountDinerRefRpcResponse.class)); | ||
| 675 | + } | ||
| 676 | + } catch (final Exception e) { | ||
| 677 | + log.error("queryMpAccountDinerRefsByCondition error;", e); | ||
| 678 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 679 | + } | ||
| 680 | + responseObserver.onNext(builder.build()); | ||
| 681 | + responseObserver.onCompleted(); | ||
| 682 | + } | ||
| 683 | + | ||
| 684 | + @Override | ||
| 685 | + @DS(DATA_SOURCE_MASTER) | ||
| 686 | + public void createMpAccountDinerRef(final CreateMpAccountDinerRefRpcRequest request, | ||
| 687 | + final StreamObserver<CreateMpAccountDinerRefRpcResponse> responseObserver) { | ||
| 688 | + final var builder = CreateMpAccountDinerRefRpcResponse.newBuilder(); | ||
| 689 | + try { | ||
| 690 | + MpAccountDinerRef mpAccountDinerRef = new MpAccountDinerRef(); | ||
| 691 | + mpAccountDinerRef.setEnterpriseId(request.getEnterpriseId()); | ||
| 692 | + mpAccountDinerRef.setCreatedBy(request.getCreatedBy()); | ||
| 693 | + mpAccountDinerRef.setCreationSource(request.getCreationSource()); | ||
| 694 | + mpAccountDinerRef.setAccountId(request.getCreation().getAccountId()); | ||
| 695 | + mpAccountDinerRef.setDinerId(request.getCreation().getDinerId()); | ||
| 696 | + builder.setIsCreated(mpAccountDinerRefService.save(mpAccountDinerRef)).setId(mpAccountDinerRef.getId()); | ||
| 697 | + } catch (final Exception e) { | ||
| 698 | + log.error("createMpAccountDinerRef error;", e); | ||
| 699 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 700 | + } | ||
| 701 | + responseObserver.onNext(builder.build()); | ||
| 702 | + responseObserver.onCompleted(); | ||
| 703 | + } | ||
| 704 | + | ||
| 705 | + @Override | ||
| 706 | + @DS(DATA_SOURCE_MASTER) | ||
| 707 | + public void deleteMpAccountDinerRefsByIds(final DeleteMpAccountDinerRefsByIdsRpcRequest request, | ||
| 708 | + final StreamObserver<DeleteMpAccountDinerRefsRpcResponse> responseObserver) { | ||
| 709 | + final var builder = DeleteMpAccountDinerRefsRpcResponse.newBuilder(); | ||
| 710 | + try { | ||
| 711 | + builder.setIsDeleted(mpAccountDinerRefService.removeBatchByIds(request.getIdsList())); | ||
| 712 | + } catch (final Exception e) { | ||
| 713 | + log.error("deleteMpAccountDinerRefsByIds error;", e); | ||
| 714 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 715 | + } | ||
| 716 | + responseObserver.onNext(builder.build()); | ||
| 717 | + responseObserver.onCompleted(); | ||
| 718 | + } | ||
| 719 | + | ||
| 720 | + @Override | ||
| 721 | + @DS(DATA_SOURCE_SLAVE) | ||
| 722 | + public void getGradeClassById(final GetGradeClassByIdRpcRequest request, | ||
| 723 | + final StreamObserver<GetGradeClassByIdRpcResponse> responseObserver) { | ||
| 724 | + final var builder = GetGradeClassByIdRpcResponse.newBuilder(); | ||
| 725 | + try { | ||
| 726 | + final var gradeClass = gradeClassService.getById(request.getId()); | ||
| 727 | + if (gradeClass != null) { | ||
| 728 | + builder.setResponse(ProtoBeanUtil.beanToProto(gradeClass, SingleGradeClassRpcResponse.class)); | ||
| 729 | + } | ||
| 730 | + } catch (final Exception e) { | ||
| 731 | + log.error("getGradeClassById error;", e); | ||
| 732 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 733 | + } | ||
| 734 | + responseObserver.onNext(builder.build()); | ||
| 735 | + responseObserver.onCompleted(); | ||
| 736 | + } | ||
| 737 | + | ||
| 738 | + @Override | ||
| 739 | + @DS(DATA_SOURCE_SLAVE) | ||
| 740 | + public void getGradeClassesByIds(final GetGradeClassesByIdsRpcRequest request, | ||
| 741 | + final StreamObserver<GetGradeClassesByIdsRpcResponse> responseObserver) { | ||
| 742 | + final var builder = GetGradeClassesByIdsRpcResponse.newBuilder(); | ||
| 743 | + try { | ||
| 744 | + final var gradeClasses = gradeClassService.listByIds(request.getIdsList()); | ||
| 745 | + if (!gradeClasses.isEmpty()) { | ||
| 746 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(gradeClasses, SingleGradeClassRpcResponse.class)); | ||
| 747 | + } | ||
| 748 | + } catch (final Exception e) { | ||
| 749 | + log.error("getGradeClassesByIds error;", e); | ||
| 750 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 751 | + } | ||
| 752 | + responseObserver.onNext(builder.build()); | ||
| 753 | + responseObserver.onCompleted(); | ||
| 754 | + } | ||
| 755 | + | ||
| 756 | + @Override | ||
| 757 | + @DS(DATA_SOURCE_SLAVE) | ||
| 758 | + public void queryGradeClassesByCondition(final QueryGradeClassesByConditionRpcRequest request, | ||
| 759 | + final StreamObserver<QueryGradeClassesByConditionRpcResponse> responseObserver) { | ||
| 760 | + final var builder = QueryGradeClassesByConditionRpcResponse.newBuilder(); | ||
| 761 | + try { | ||
| 762 | + LambdaQueryWrapper<GradeClass> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 763 | + queryWrapper.eq(GradeClass::getEnterpriseId, request.getEnterpriseId()); | ||
| 764 | + if (request.getShouldFilterClientIds()) { | ||
| 765 | + queryWrapper.in(!request.getClientIdsList().isEmpty(), GradeClass::getClientId, request.getClientIdsList()); | ||
| 766 | + } | ||
| 767 | + if (request.getShouldFilterGradeName()) { | ||
| 768 | + queryWrapper.eq(GradeClass::getGradeName, request.getGradeName()); | ||
| 769 | + } | ||
| 770 | + final var gradeClasses = gradeClassService.list(queryWrapper); | ||
| 771 | + if (!gradeClasses.isEmpty()) { | ||
| 772 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(gradeClasses, SingleGradeClassRpcResponse.class)); | ||
| 773 | + } | ||
| 774 | + } catch (final Exception e) { | ||
| 775 | + log.error("queryGradeClassesByCondition error;", e); | ||
| 776 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 777 | + } | ||
| 778 | + responseObserver.onNext(builder.build()); | ||
| 779 | + responseObserver.onCompleted(); | ||
| 780 | + } | ||
| 781 | + | ||
| 782 | + @Override | ||
| 783 | + @DS(DATA_SOURCE_MASTER) | ||
| 784 | + public void createGradeClass(final CreateGradeClassRpcRequest request, | ||
| 785 | + final StreamObserver<CreateGradeClassRpcResponse> responseObserver) { | ||
| 786 | + final var builder = CreateGradeClassRpcResponse.newBuilder(); | ||
| 787 | + try { | ||
| 788 | + GradeClass gradeClass = new GradeClass(); | ||
| 789 | + gradeClass.setEnterpriseId(request.getEnterpriseId()); | ||
| 790 | + gradeClass.setCreatedBy(request.getCreatedBy()); | ||
| 791 | + gradeClass.setCreationSource(request.getCreationSource()); | ||
| 792 | + gradeClass.setClientId(request.getCreation().getClientId()); | ||
| 793 | + gradeClass.setGradeName(request.getCreation().getGradeName()); | ||
| 794 | + gradeClass.setClassName(request.getCreation().getClassName()); | ||
| 795 | + builder.setIsCreated(gradeClassService.save(gradeClass)).setId(gradeClass.getId()); | ||
| 796 | + } catch (final Exception e) { | ||
| 797 | + log.error("createGradeClass error;", e); | ||
| 798 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 799 | + } | ||
| 800 | + responseObserver.onNext(builder.build()); | ||
| 801 | + responseObserver.onCompleted(); | ||
| 802 | + } | ||
| 803 | + | ||
| 804 | + @Override | ||
| 805 | + @DS(DATA_SOURCE_MASTER) | ||
| 806 | + public void batchCreateGradeClasses(final BatchCreateGradeClassesRpcRequest request, | ||
| 807 | + final StreamObserver<BatchCreateGradeClassesRpcResponse> responseObserver) { | ||
| 808 | + final var builder = BatchCreateGradeClassesRpcResponse.newBuilder(); | ||
| 809 | + try { | ||
| 810 | + final var gradeClasses = new ArrayList<GradeClass>(); | ||
| 811 | + for (final var creation : request.getCreationsList()) { | ||
| 812 | + final var gradeClass = new GradeClass(); | ||
| 813 | + gradeClass.setEnterpriseId(request.getEnterpriseId()); | ||
| 814 | + gradeClass.setCreatedBy(request.getCreatedBy()); | ||
| 815 | + gradeClass.setCreationSource(request.getCreationSource()); | ||
| 816 | + gradeClass.setClientId(creation.getClientId()); | ||
| 817 | + gradeClass.setGradeName(creation.getGradeName()); | ||
| 818 | + gradeClass.setClassName(creation.getClassName()); | ||
| 819 | + gradeClasses.add(gradeClass); | ||
| 820 | + } | ||
| 821 | + builder.setIsCreated(gradeClassService.saveBatch(gradeClasses)).addAllIds(gradeClasses.stream().map(GradeClass::getId).collect(Collectors.toList())); | ||
| 822 | + } catch (final Exception e) { | ||
| 823 | + log.error("batchCreateGradeClasses error;", e); | ||
| 824 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 825 | + } | ||
| 826 | + responseObserver.onNext(builder.build()); | ||
| 827 | + responseObserver.onCompleted(); | ||
| 828 | + } | ||
| 829 | + | ||
| 830 | + @Override | ||
| 831 | + @DS(DATA_SOURCE_MASTER) | ||
| 832 | + public void updateGradeClass(final UpdateGradeClassRpcRequest request, | ||
| 833 | + final StreamObserver<UpdateGradeClassRpcResponse> responseObserver) { | ||
| 834 | + final var builder = UpdateGradeClassRpcResponse.newBuilder(); | ||
| 835 | + try { | ||
| 836 | + GradeClass gradeClass = new GradeClass(); | ||
| 837 | + gradeClass.setId(request.getModification().getId()); | ||
| 838 | + gradeClass.setEnterpriseId(request.getEnterpriseId()); | ||
| 839 | + gradeClass.setUpdatedBy(request.getUpdatedBy()); | ||
| 840 | + gradeClass.setUpdateSource(request.getUpdateSource()); | ||
| 841 | + if (request.getModification().getShouldUpdateClientId()) { | ||
| 842 | + gradeClass.setClientId(request.getModification().getClientId()); | ||
| 843 | + } | ||
| 844 | + if (request.getModification().getShouldUpdateClassName()) { | ||
| 845 | + gradeClass.setClassName(request.getModification().getClassName()); | ||
| 846 | + } | ||
| 847 | + if (request.getModification().getShouldUpdateGradeName()) { | ||
| 848 | + gradeClass.setGradeName(request.getModification().getGradeName()); | ||
| 849 | + } | ||
| 850 | + builder.setIsUpdated(gradeClassService.updateById(gradeClass)); | ||
| 851 | + } catch (final Exception e) { | ||
| 852 | + log.error("updateGradeClass error;", e); | ||
| 853 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 854 | + } | ||
| 855 | + responseObserver.onNext(builder.build()); | ||
| 856 | + responseObserver.onCompleted(); | ||
| 857 | + } | ||
| 858 | + | ||
| 859 | + @Override | ||
| 860 | + @DS(DATA_SOURCE_MASTER) | ||
| 861 | + public void batchSaveOrUpdateGradeClasses(final BatchSaveOrUpdateGradeClassesRpcRequest request, | ||
| 862 | + final StreamObserver<BatchSaveOrUpdateGradeClassesRpcResponse> responseObserver) { | ||
| 863 | + final var builder = BatchSaveOrUpdateGradeClassesRpcResponse.newBuilder(); | ||
| 864 | + try { | ||
| 865 | + List<GradeClass> gradeClasses = new ArrayList<>(); | ||
| 866 | + for (final var modification : request.getModificationsList()) { | ||
| 867 | + GradeClass gradeClass = new GradeClass(); | ||
| 868 | + gradeClass.setId(modification.getId() == 0 ? null : modification.getId()); | ||
| 869 | + gradeClass.setEnterpriseId(request.getEnterpriseId()); | ||
| 870 | + if (modification.getId() == 0) { | ||
| 871 | + gradeClass.setCreatedBy(request.getUpdatedBy()); | ||
| 872 | + gradeClass.setCreationSource(request.getUpdateSource()); | ||
| 873 | + } | ||
| 874 | + gradeClass.setUpdatedBy(request.getUpdatedBy()); | ||
| 875 | + gradeClass.setUpdateSource(request.getUpdateSource()); | ||
| 876 | + if (modification.getShouldUpdateClientId()) { | ||
| 877 | + gradeClass.setClientId(modification.getClientId()); | ||
| 878 | + } | ||
| 879 | + if (modification.getShouldUpdateClassName()) { | ||
| 880 | + gradeClass.setClassName(modification.getClassName()); | ||
| 881 | + } | ||
| 882 | + if (modification.getShouldUpdateGradeName()) { | ||
| 883 | + gradeClass.setGradeName(modification.getGradeName()); | ||
| 884 | + } | ||
| 885 | + gradeClasses.add(gradeClass); | ||
| 886 | + } | ||
| 887 | + builder.setIsUpdated(gradeClassService.saveOrUpdateBatch(gradeClasses)); | ||
| 888 | + } catch (final Exception e) { | ||
| 889 | + log.error("updateGradeClass error;", e); | ||
| 890 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 891 | + } | ||
| 892 | + responseObserver.onNext(builder.build()); | ||
| 893 | + responseObserver.onCompleted(); | ||
| 894 | + } | ||
| 895 | + | ||
| 896 | + @Override | ||
| 897 | + @DS(DATA_SOURCE_MASTER) | ||
| 898 | + public void deleteGradeClassesByIds(final DeleteGradeClassesByIdsRpcRequest request, | ||
| 899 | + final StreamObserver<DeleteGradeClassesRpcResponse> responseObserver) { | ||
| 900 | + final var builder = DeleteGradeClassesRpcResponse.newBuilder(); | ||
| 901 | + try { | ||
| 902 | + builder.setIsDeleted(gradeClassService.removeBatchByIds(request.getIdsList())); | ||
| 903 | + } catch (final Exception e) { | ||
| 904 | + log.error("deleteGradeClassesByIds error;", e); | ||
| 905 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 906 | + } | ||
| 907 | + responseObserver.onNext(builder.build()); | ||
| 908 | + responseObserver.onCompleted(); | ||
| 909 | + } | ||
| 910 | + | ||
| 911 | + @Override | ||
| 912 | + @DS(DATA_SOURCE_MASTER) | ||
| 913 | + @Transactional(rollbackFor = Exception.class) | ||
| 914 | + public void deleteGradeClassesAndDinersByClientIds(final DeleteGradeClassesAndDinersByClientIdsRpcRequest request, | ||
| 915 | + final StreamObserver<DeleteGradeClassesAndDinersByClientIdsRpcResponse> responseObserver) { | ||
| 916 | + final var builder = DeleteGradeClassesAndDinersByClientIdsRpcResponse.newBuilder(); | ||
| 917 | + try { | ||
| 918 | + LambdaQueryWrapper<GradeClass> queryWrapper = Wrappers.lambdaQuery(); | ||
| 919 | + queryWrapper.in(GradeClass::getEnterpriseId, request.getEnterpriseId()); | ||
| 920 | + queryWrapper.in(GradeClass::getClientId, request.getClientIdsList()); | ||
| 921 | + final boolean remove = gradeClassService.remove(queryWrapper); | ||
| 922 | + LambdaQueryWrapper<Diner> dinerLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
| 923 | + dinerLambdaQueryWrapper.in(Diner::getEnterpriseId, request.getEnterpriseId()); | ||
| 924 | + dinerLambdaQueryWrapper.in(Diner::getClientId, request.getClientIdsList()); | ||
| 925 | + final var diners = dinerService.list(dinerLambdaQueryWrapper); | ||
| 926 | + final var remove1 = dinerService.remove(dinerLambdaQueryWrapper); | ||
| 927 | + boolean remove2 = false; | ||
| 928 | + if (!diners.isEmpty()) { | ||
| 929 | + LambdaQueryWrapper<MpAccountDinerRef> mpAccountDinerRefLambdaQueryWrapper = Wrappers.lambdaQuery(); | ||
| 930 | + mpAccountDinerRefLambdaQueryWrapper.in(MpAccountDinerRef::getEnterpriseId, request.getEnterpriseId()); | ||
| 931 | + mpAccountDinerRefLambdaQueryWrapper.in(MpAccountDinerRef::getDinerId, diners.stream().map(Diner::getId).collect(Collectors.toList())); | ||
| 932 | + remove2 = mpAccountDinerRefService.remove(mpAccountDinerRefLambdaQueryWrapper); | ||
| 933 | + } | ||
| 934 | + builder.setIsDeleted(remove && remove1 && remove2); | ||
| 935 | + } catch (final Exception e) { | ||
| 936 | + log.error("deleteGradeClassesAndDinersByClientIds error;", e); | ||
| 937 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 938 | + } | ||
| 939 | + responseObserver.onNext(builder.build()); | ||
| 940 | + responseObserver.onCompleted(); | ||
| 941 | + } | ||
| 942 | + | ||
| 943 | + @Override | ||
| 944 | + @DS(DATA_SOURCE_SLAVE) | ||
| 945 | + public void getMealMenuRecordById(final GetMealMenuRecordByIdRpcRequest request, | ||
| 946 | + final StreamObserver<GetMealMenuRecordByIdRpcResponse> responseObserver) { | ||
| 947 | + final var builder = GetMealMenuRecordByIdRpcResponse.newBuilder(); | ||
| 948 | + try { | ||
| 949 | + final var mealMenuRecord = mealMenuRecordService.getById(request.getId()); | ||
| 950 | + if (mealMenuRecord != null) { | ||
| 951 | + builder.setResponse(ProtoBeanUtil.beanToProto(mealMenuRecord, SingleMealMenuRecordRpcResponse.class)); | ||
| 952 | + } | ||
| 953 | + } catch (final Exception e) { | ||
| 954 | + log.error("getMealMenuRecordById error;", e); | ||
| 955 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 956 | + } | ||
| 957 | + responseObserver.onNext(builder.build()); | ||
| 958 | + responseObserver.onCompleted(); | ||
| 959 | + } | ||
| 960 | + | ||
| 961 | + @Override | ||
| 962 | + @DS(DATA_SOURCE_SLAVE) | ||
| 963 | + public void getMealMenuRecordsByIds(final GetMealMenuRecordsByIdsRpcRequest request, | ||
| 964 | + final StreamObserver<GetMealMenuRecordsByIdsRpcResponse> responseObserver) { | ||
| 965 | + final var builder = GetMealMenuRecordsByIdsRpcResponse.newBuilder(); | ||
| 966 | + try { | ||
| 967 | + final var mealMenuRecords = mealMenuRecordService.listByIds(request.getIdsList()); | ||
| 968 | + if (!mealMenuRecords.isEmpty()) { | ||
| 969 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(mealMenuRecords, SingleMealMenuRecordRpcResponse.class)); | ||
| 970 | + } | ||
| 971 | + } catch (final Exception e) { | ||
| 972 | + log.error("getMealMenuRecordsByIds error;", e); | ||
| 973 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 974 | + } | ||
| 975 | + responseObserver.onNext(builder.build()); | ||
| 976 | + responseObserver.onCompleted(); | ||
| 977 | + } | ||
| 978 | + | ||
| 979 | + @Override | ||
| 980 | + @DS(DATA_SOURCE_SLAVE) | ||
| 981 | + public void queryMealMenuRecordsByCondition(final QueryMealMenuRecordsByConditionRpcRequest request, | ||
| 982 | + final StreamObserver<QueryMealMenuRecordsByConditionRpcResponse> responseObserver) { | ||
| 983 | + final var builder = QueryMealMenuRecordsByConditionRpcResponse.newBuilder(); | ||
| 984 | + try { | ||
| 985 | + LambdaQueryWrapper<MealMenuRecord> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 986 | + queryWrapper.eq(MealMenuRecord::getEnterpriseId, request.getEnterpriseId()); | ||
| 987 | + if (request.getShouldFilterClientIds()) { | ||
| 988 | + queryWrapper.in(!request.getClientIdsList().isEmpty(), MealMenuRecord::getClientId, request.getClientIdsList()); | ||
| 989 | + } | ||
| 990 | + if (request.getShouldFilterName()) { | ||
| 991 | + queryWrapper.eq(MealMenuRecord::getName, request.getName()); | ||
| 992 | + } | ||
| 993 | + final var diners = mealMenuRecordService.list(queryWrapper); | ||
| 994 | + if (!diners.isEmpty()) { | ||
| 995 | + builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(diners, SingleMealMenuRecordRpcResponse.class)); | ||
| 996 | + } | ||
| 997 | + } catch (final Exception e) { | ||
| 998 | + log.error("queryMealMenuRecordsByCondition error;", e); | ||
| 999 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 1000 | + } | ||
| 1001 | + responseObserver.onNext(builder.build()); | ||
| 1002 | + responseObserver.onCompleted(); | ||
| 1003 | + } | ||
| 1004 | + | ||
| 1005 | + @Override | ||
| 1006 | + @DS(DATA_SOURCE_SLAVE) | ||
| 1007 | + public void queryLatestMealMenuRecordByClientId(final QueryLatestMealMenuRecordByClientIdRpcRequest request, | ||
| 1008 | + final StreamObserver<QueryLatestMealMenuRecordByClientIdRpcResponse> responseObserver) { | ||
| 1009 | + final var builder = QueryLatestMealMenuRecordByClientIdRpcResponse.newBuilder(); | ||
| 1010 | + try { | ||
| 1011 | + LambdaQueryWrapper<MealMenuRecord> queryWrapper = new LambdaQueryWrapper<>(); | ||
| 1012 | + queryWrapper.eq(MealMenuRecord::getEnterpriseId, request.getEnterpriseId()); | ||
| 1013 | + queryWrapper.eq(MealMenuRecord::getClientId, request.getClientId()); | ||
| 1014 | + queryWrapper.orderByDesc(MealMenuRecord::getCreatedAt); | ||
| 1015 | + queryWrapper.last("limit 1"); | ||
| 1016 | + final var mealMenuRecord = mealMenuRecordService.getOne(queryWrapper); | ||
| 1017 | + if (mealMenuRecord != null) { | ||
| 1018 | + builder.setResponse(ProtoBeanUtil.beanToProto(mealMenuRecord, SingleMealMenuRecordRpcResponse.class)); | ||
| 1019 | + } | ||
| 1020 | + } catch (final Exception e) { | ||
| 1021 | + log.error("queryLatestMealMenuRecordByClientId error;", e); | ||
| 1022 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 1023 | + } | ||
| 1024 | + responseObserver.onNext(builder.build()); | ||
| 1025 | + responseObserver.onCompleted(); | ||
| 1026 | + } | ||
| 1027 | + | ||
| 1028 | + @Override | ||
| 1029 | + @DS(DATA_SOURCE_MASTER) | ||
| 1030 | + public void createMealMenuRecord(final CreateMealMenuRecordRpcRequest request, | ||
| 1031 | + final StreamObserver<CreateMealMenuRecordRpcResponse> responseObserver) { | ||
| 1032 | + final var builder = CreateMealMenuRecordRpcResponse.newBuilder(); | ||
| 1033 | + try { | ||
| 1034 | + MealMenuRecord mealMenuRecord = new MealMenuRecord(); | ||
| 1035 | + mealMenuRecord.setEnterpriseId(request.getEnterpriseId()); | ||
| 1036 | + mealMenuRecord.setCreatedBy(request.getCreatedBy()); | ||
| 1037 | + mealMenuRecord.setCreationSource(request.getCreationSource()); | ||
| 1038 | + mealMenuRecord.setClientId(request.getCreation().getClientId()); | ||
| 1039 | + mealMenuRecord.setName(request.getCreation().getName()); | ||
| 1040 | + mealMenuRecord.setImageUrl(request.getCreation().getImageUrl()); | ||
| 1041 | + builder.setIsCreated(mealMenuRecordService.save(mealMenuRecord)).setId(mealMenuRecord.getId()); | ||
| 1042 | + } catch (final Exception e) { | ||
| 1043 | + log.error("createMealMenuRecord error;", e); | ||
| 1044 | + responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException()); | ||
| 1045 | + } | ||
| 1046 | + responseObserver.onNext(builder.build()); | ||
| 1047 | + responseObserver.onCompleted(); | ||
| 1048 | + } | ||
| 1049 | +} |
| 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对象 | ... | ... |
src/main/proto/MealOrderService.proto
0 → 100644
| 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 QueryReserveMealOrdersByDinerIds (QueryReserveMealOrdersByDinerIdsRpcRequest) returns (QueryReserveMealOrdersByDinerIdsRpcResponse) {} | ||
| 15 | + rpc CreateMealOrder (CreateMealOrderRpcRequest) returns (CreateMealOrderRpcResponse) {} | ||
| 16 | + rpc DeleteMealOrdersByIds (DeleteMealOrdersByIdsRpcRequest) returns (DeleteMealOrdersRpcResponse) {} | ||
| 17 | + | ||
| 18 | + rpc GetMpAccountById (GetMpAccountByIdRpcRequest) returns (GetMpAccountByIdRpcResponse) {} | ||
| 19 | + rpc GetMpAccountByOpenId (GetMpAccountByOpenIdRpcRequest) returns (GetMpAccountByOpenIdRpcResponse) {} | ||
| 20 | + rpc GetMpAccountsByIds (GetMpAccountsByIdsRpcRequest) returns (GetMpAccountsByIdsRpcResponse) {} | ||
| 21 | + rpc QueryMpAccountsByCondition (QueryMpAccountsByConditionRpcRequest) returns (QueryMpAccountsByConditionRpcResponse) {} | ||
| 22 | + rpc CreateMpAccount (CreateMpAccountRpcRequest) returns (CreateMpAccountRpcResponse) {} | ||
| 23 | + rpc UpdateMpAccount (UpdateMpAccountRpcRequest) returns (UpdateMpAccountRpcResponse) {} | ||
| 24 | + rpc DeleteMpAccountsByIds (DeleteMpAccountsByIdsRpcRequest) returns (DeleteMpAccountsRpcResponse) {} | ||
| 25 | + | ||
| 26 | + rpc GetDinerById (GetDinerByIdRpcRequest) returns (GetDinerByIdRpcResponse) {} | ||
| 27 | + rpc GetDinersByIds (GetDinersByIdsRpcRequest) returns (GetDinersByIdsRpcResponse) {} | ||
| 28 | + rpc QueryDinersByCondition (QueryDinersByConditionRpcRequest) returns (QueryDinersByConditionRpcResponse) {} | ||
| 29 | + rpc CreateDiner (CreateDinerRpcRequest) returns (CreateDinerRpcResponse) {} | ||
| 30 | + rpc UpdateDiner (UpdateDinerRpcRequest) returns (UpdateDinerRpcResponse) {} | ||
| 31 | + rpc BatchSaveOrUpdateDiners (BatchSaveOrUpdateDinersRpcRequest) returns (BatchSaveOrUpdateDinersRpcResponse) {} | ||
| 32 | + rpc DeleteDinersByIds (DeleteDinersByIdsRpcRequest) returns (DeleteDinersRpcResponse) {} | ||
| 33 | + | ||
| 34 | + rpc GetMpAccountDinerRefsByIds (GetMpAccountDinerRefsByIdsRpcRequest) returns (GetMpAccountDinerRefsByIdsRpcResponse) {} | ||
| 35 | + rpc QueryMpAccountDinerRefsByCondition (QueryMpAccountDinerRefsByConditionRpcRequest) returns (QueryMpAccountDinerRefsByConditionRpcResponse) {} | ||
| 36 | + rpc CreateMpAccountDinerRef (CreateMpAccountDinerRefRpcRequest) returns (CreateMpAccountDinerRefRpcResponse) {} | ||
| 37 | + rpc DeleteMpAccountDinerRefsByIds (DeleteMpAccountDinerRefsByIdsRpcRequest) returns (DeleteMpAccountDinerRefsRpcResponse) {} | ||
| 38 | + | ||
| 39 | + rpc GetGradeClassById (GetGradeClassByIdRpcRequest) returns (GetGradeClassByIdRpcResponse) {} | ||
| 40 | + rpc GetGradeClassesByIds (GetGradeClassesByIdsRpcRequest) returns (GetGradeClassesByIdsRpcResponse) {} | ||
| 41 | + rpc QueryGradeClassesByCondition (QueryGradeClassesByConditionRpcRequest) returns (QueryGradeClassesByConditionRpcResponse) {} | ||
| 42 | + rpc CreateGradeClass (CreateGradeClassRpcRequest) returns (CreateGradeClassRpcResponse) {} | ||
| 43 | + rpc BatchCreateGradeClasses (BatchCreateGradeClassesRpcRequest) returns (BatchCreateGradeClassesRpcResponse) {} | ||
| 44 | + rpc UpdateGradeClass (UpdateGradeClassRpcRequest) returns (UpdateGradeClassRpcResponse) {} | ||
| 45 | + rpc BatchSaveOrUpdateGradeClasses (BatchSaveOrUpdateGradeClassesRpcRequest) returns (BatchSaveOrUpdateGradeClassesRpcResponse) {} | ||
| 46 | + rpc DeleteGradeClassesByIds (DeleteGradeClassesByIdsRpcRequest) returns (DeleteGradeClassesRpcResponse) {} | ||
| 47 | + rpc DeleteGradeClassesAndDinersByClientIds (DeleteGradeClassesAndDinersByClientIdsRpcRequest) returns (DeleteGradeClassesAndDinersByClientIdsRpcResponse) {} | ||
| 48 | + | ||
| 49 | + rpc GetMealMenuRecordById (GetMealMenuRecordByIdRpcRequest) returns (GetMealMenuRecordByIdRpcResponse) {} | ||
| 50 | + rpc GetMealMenuRecordsByIds (GetMealMenuRecordsByIdsRpcRequest) returns (GetMealMenuRecordsByIdsRpcResponse) {} | ||
| 51 | + rpc QueryMealMenuRecordsByCondition (QueryMealMenuRecordsByConditionRpcRequest) returns (QueryMealMenuRecordsByConditionRpcResponse) {} | ||
| 52 | + rpc CreateMealMenuRecord (CreateMealMenuRecordRpcRequest) returns (CreateMealMenuRecordRpcResponse) {} | ||
| 53 | + rpc QueryLatestMealMenuRecordByClientId (QueryLatestMealMenuRecordByClientIdRpcRequest) returns (QueryLatestMealMenuRecordByClientIdRpcResponse) {} | ||
| 54 | +} | ||
| 55 | + | ||
| 56 | +enum MealOrderOrderMethodEnum { | ||
| 57 | + MEAL_ORDER_METHOD_SYSTEM = 0; | ||
| 58 | + MEAL_ORDER_METHOD_MICRO = 1; | ||
| 59 | +} | ||
| 60 | + | ||
| 61 | +message SingleMealOrderRpcResponse { | ||
| 62 | + int32 id = 1; | ||
| 63 | + int32 enterpriseId = 2; | ||
| 64 | + int32 clientId = 3; | ||
| 65 | + int32 menuId = 4; | ||
| 66 | + int32 accountId = 5; | ||
| 67 | + MealOrderOrderMethodEnum orderMethod = 6; | ||
| 68 | + int32 dinerId = 7; | ||
| 69 | + string dinerName = 8; | ||
| 70 | + string clientName = 9; | ||
| 71 | + string gradeName = 10; | ||
| 72 | + string className = 11; | ||
| 73 | + string studentNo = 12; | ||
| 74 | + int64 reserveDate = 13; | ||
| 75 | + repeated MenuSchedule meals = 14; | ||
| 76 | + int32 createdBy = 15; | ||
| 77 | + int64 createdAt = 16; | ||
| 78 | + int32 creationSource = 17; | ||
| 79 | + int32 updatedBy = 18; | ||
| 80 | + int64 updatedAt = 19; | ||
| 81 | + int32 updateSource = 20; | ||
| 82 | + bool isDeleted = 21; | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +message GetMealOrderByIdRpcRequest { | ||
| 86 | + int32 id = 1; | ||
| 87 | + int32 enterpriseId = 2; | ||
| 88 | + bool includeDeleted = 3; | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +message GetMealOrderByIdRpcResponse { | ||
| 92 | + SingleMealOrderRpcResponse response = 1; | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +message GetMealOrdersByIdsRpcRequest { | ||
| 96 | + repeated int32 ids = 1; | ||
| 97 | + int32 enterpriseId = 2; | ||
| 98 | + bool includeDeleted = 3; | ||
| 99 | +} | ||
| 100 | + | ||
| 101 | +message GetMealOrdersByIdsRpcResponse { | ||
| 102 | + repeated SingleMealOrderRpcResponse responses = 1; | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +message QueryMealOrdersByConditionRpcRequest { | ||
| 106 | + int32 enterpriseId = 1; | ||
| 107 | + bool shouldFilterClientIds = 2; | ||
| 108 | + repeated int32 clientIds = 3; | ||
| 109 | + bool shouldFilterMenuIds = 4; | ||
| 110 | + repeated int32 menuIds = 5; | ||
| 111 | + bool shouldFilterAccountIds = 6; | ||
| 112 | + repeated int32 accountIds = 7; | ||
| 113 | + bool shouldFilterOrderMethod = 8; | ||
| 114 | + MealOrderOrderMethodEnum orderMethod = 9; | ||
| 115 | + bool shouldFilterDinerIds = 10; | ||
| 116 | + repeated int32 dinerIds = 11; | ||
| 117 | + bool shouldFilterReserveDateStart = 12; | ||
| 118 | + int64 reserveDateStart = 13; | ||
| 119 | + bool shouldFilterReserveDateEnd = 14; | ||
| 120 | + int64 reserveDateEnd = 15; | ||
| 121 | + bool includeDeleted = 16; | ||
| 122 | +} | ||
| 123 | + | ||
| 124 | +message QueryMealOrdersByConditionRpcResponse { | ||
| 125 | + repeated SingleMealOrderRpcResponse responses = 1; | ||
| 126 | +} | ||
| 127 | + | ||
| 128 | +message QueryReserveMealOrdersByDinerIdsRpcRequest { | ||
| 129 | + int32 enterpriseId = 1; | ||
| 130 | + repeated int32 dinerIds = 2; | ||
| 131 | +} | ||
| 132 | + | ||
| 133 | +message QueryReserveMealOrdersByDinerIdsRpcResponse { | ||
| 134 | + repeated SingleMealOrderRpcResponse responses = 1; | ||
| 135 | +} | ||
| 136 | + | ||
| 137 | +message MealOrderCreation{ | ||
| 138 | + int32 clientId = 1; | ||
| 139 | + int32 menuId = 2; | ||
| 140 | + int32 accountId = 3; | ||
| 141 | + MealOrderOrderMethodEnum orderMethod = 4; | ||
| 142 | + int32 dinerId = 5; | ||
| 143 | + string dinerName = 6; | ||
| 144 | + string clientName = 7; | ||
| 145 | + string gradeName = 8; | ||
| 146 | + string className = 9; | ||
| 147 | + string studentNo = 10; | ||
| 148 | + int64 reserveDate = 11; | ||
| 149 | + repeated MenuSchedule meals = 12; | ||
| 150 | +} | ||
| 151 | + | ||
| 152 | +message MenuSchedule { | ||
| 153 | + string date = 1; // 日期字段,类型是 string | ||
| 154 | + string menu = 2; // 菜单字段,类型是 string | ||
| 155 | +} | ||
| 156 | + | ||
| 157 | +message CreateMealOrderRpcRequest { | ||
| 158 | + MealOrderCreation creation = 1; | ||
| 159 | + int32 enterpriseId = 2; | ||
| 160 | + int32 createdBy = 3; | ||
| 161 | + int32 creationSource = 4; | ||
| 162 | +} | ||
| 163 | + | ||
| 164 | +message CreateMealOrderRpcResponse { | ||
| 165 | + int32 id = 1; | ||
| 166 | + bool isCreated = 2; | ||
| 167 | +} | ||
| 168 | + | ||
| 169 | +message BatchCreateMealOrdersRpcRequest { | ||
| 170 | + repeated MealOrderCreation creations = 1; | ||
| 171 | + int32 enterpriseId = 2; | ||
| 172 | + int32 createdBy = 3; | ||
| 173 | + int32 creationSource = 4; | ||
| 174 | +} | ||
| 175 | + | ||
| 176 | +message BatchCreateMealOrdersRpcResponse { | ||
| 177 | + repeated int32 ids = 1; | ||
| 178 | + bool isCreated = 2; | ||
| 179 | +} | ||
| 180 | + | ||
| 181 | +message MealOrderModification { | ||
| 182 | + int32 id = 1; | ||
| 183 | + bool shouldUpdateClientId = 2; | ||
| 184 | + int32 clientId = 3; | ||
| 185 | + bool shouldUpdateMenuId = 4; | ||
| 186 | + int32 menuId = 5; | ||
| 187 | + bool shouldUpdateAccountId = 6; | ||
| 188 | + int32 accountId = 7; | ||
| 189 | + bool shouldUpdateOrderMethod = 8; | ||
| 190 | + MealOrderOrderMethodEnum orderMethod = 9; | ||
| 191 | + bool shouldUpdateDinerId = 10; | ||
| 192 | + int32 dinerId = 11; | ||
| 193 | + bool shouldUpdateDinerName = 12; | ||
| 194 | + string dinerName = 13; | ||
| 195 | + bool shouldUpdateClientName = 14; | ||
| 196 | + string clientName = 15; | ||
| 197 | + bool shouldUpdateGradeName = 16; | ||
| 198 | + string gradeName = 17; | ||
| 199 | + bool shouldUpdateClassName = 18; | ||
| 200 | + string className = 19; | ||
| 201 | + bool shouldUpdateStudentNo = 20; | ||
| 202 | + string studentNo = 21; | ||
| 203 | + bool shouldUpdateReserveDate = 22; | ||
| 204 | + int64 reserveDate = 23; | ||
| 205 | + bool shouldUpdateMeals = 24; | ||
| 206 | + repeated MenuSchedule meals = 25; | ||
| 207 | +} | ||
| 208 | + | ||
| 209 | +message UpdateMealOrderRpcRequest { | ||
| 210 | + MealOrderModification modification = 1; | ||
| 211 | + int32 enterpriseId = 2; | ||
| 212 | + int32 updatedBy = 3; | ||
| 213 | + int32 updateSource = 4; | ||
| 214 | +} | ||
| 215 | + | ||
| 216 | +message UpdateMealOrderRpcResponse { | ||
| 217 | + bool isUpdated = 1; | ||
| 218 | +} | ||
| 219 | + | ||
| 220 | +message BatchUpdateMealOrdersRpcRequest { | ||
| 221 | + repeated MealOrderModification modifications = 1; | ||
| 222 | + int32 enterpriseId = 2; | ||
| 223 | + int32 updatedBy = 3; | ||
| 224 | + int32 updateSource = 4; | ||
| 225 | +} | ||
| 226 | + | ||
| 227 | +message BatchUpdateMealOrdersRpcResponse { | ||
| 228 | + bool isUpdated = 1; | ||
| 229 | +} | ||
| 230 | + | ||
| 231 | +message DeleteMealOrdersByIdsRpcRequest { | ||
| 232 | + repeated int32 ids = 1; | ||
| 233 | + int32 enterpriseId = 2; | ||
| 234 | + int32 updatedBy = 3; | ||
| 235 | + int32 updateSource = 4; | ||
| 236 | +} | ||
| 237 | + | ||
| 238 | +message DeleteMealOrdersRpcResponse { | ||
| 239 | + bool isDeleted = 1; | ||
| 240 | +} | ||
| 241 | + | ||
| 242 | +message SingleDinerRpcResponse { | ||
| 243 | + int32 id = 1; | ||
| 244 | + int32 enterpriseId = 2; | ||
| 245 | + int32 clientId = 3; | ||
| 246 | + int32 classId = 4; | ||
| 247 | + string studentNo = 5; | ||
| 248 | + string name = 6; | ||
| 249 | + int32 createdBy = 7; | ||
| 250 | + int64 createdAt = 8; | ||
| 251 | + int32 creationSource = 9; | ||
| 252 | + int32 updatedBy = 10; | ||
| 253 | + int64 updatedAt = 11; | ||
| 254 | + int32 updateSource = 12; | ||
| 255 | + bool isDeleted = 13; | ||
| 256 | +} | ||
| 257 | + | ||
| 258 | +message GetDinerByIdRpcRequest { | ||
| 259 | + int32 id = 1; | ||
| 260 | + int32 enterpriseId = 2; | ||
| 261 | + bool includeDeleted = 3; | ||
| 262 | +} | ||
| 263 | + | ||
| 264 | +message GetDinerByIdRpcResponse { | ||
| 265 | + SingleDinerRpcResponse response = 1; | ||
| 266 | +} | ||
| 267 | + | ||
| 268 | +message GetDinersByIdsRpcRequest { | ||
| 269 | + repeated int32 ids = 1; | ||
| 270 | + int32 enterpriseId = 2; | ||
| 271 | + bool includeDeleted = 3; | ||
| 272 | +} | ||
| 273 | + | ||
| 274 | +message GetDinersByIdsRpcResponse { | ||
| 275 | + repeated SingleDinerRpcResponse responses = 1; | ||
| 276 | +} | ||
| 277 | + | ||
| 278 | +message QueryDinersByConditionRpcRequest { | ||
| 279 | + int32 enterpriseId = 1; | ||
| 280 | + bool shouldFilterClientIds = 2; | ||
| 281 | + repeated int32 clientIds = 3; | ||
| 282 | + bool shouldFilterClassIds = 4; | ||
| 283 | + repeated int32 classIds = 5; | ||
| 284 | + bool shouldFilterStudentNo = 6; | ||
| 285 | + string studentNo = 7; | ||
| 286 | + bool shouldFilterName = 8; | ||
| 287 | + string name = 9; | ||
| 288 | + bool includeDeleted = 10; | ||
| 289 | +} | ||
| 290 | + | ||
| 291 | +message QueryDinersByConditionRpcResponse { | ||
| 292 | + repeated SingleDinerRpcResponse responses = 1; | ||
| 293 | +} | ||
| 294 | + | ||
| 295 | +message DinerCreation{ | ||
| 296 | + int32 clientId = 1; | ||
| 297 | + int32 classId = 2; | ||
| 298 | + string studentNo = 3; | ||
| 299 | + string name = 4; | ||
| 300 | +} | ||
| 301 | + | ||
| 302 | +message CreateDinerRpcRequest { | ||
| 303 | + DinerCreation creation = 1; | ||
| 304 | + int32 enterpriseId = 2; | ||
| 305 | + int32 createdBy = 3; | ||
| 306 | + int32 creationSource = 4; | ||
| 307 | +} | ||
| 308 | + | ||
| 309 | +message CreateDinerRpcResponse { | ||
| 310 | + int32 id = 1; | ||
| 311 | + bool isCreated = 2; | ||
| 312 | +} | ||
| 313 | + | ||
| 314 | +message DinerModification { | ||
| 315 | + int32 id = 1; | ||
| 316 | + bool shouldUpdateClientId = 2; | ||
| 317 | + int32 clientId = 3; | ||
| 318 | + bool shouldUpdateClassId = 4; | ||
| 319 | + int32 classId = 5; | ||
| 320 | + bool shouldUpdateStudentNo = 6; | ||
| 321 | + string studentNo = 7; | ||
| 322 | + bool shouldUpdateName = 8; | ||
| 323 | + string name = 9; | ||
| 324 | +} | ||
| 325 | + | ||
| 326 | +message UpdateDinerRpcRequest { | ||
| 327 | + DinerModification modification = 1; | ||
| 328 | + int32 enterpriseId = 2; | ||
| 329 | + int32 updatedBy = 3; | ||
| 330 | + int32 updateSource = 4; | ||
| 331 | +} | ||
| 332 | + | ||
| 333 | +message UpdateDinerRpcResponse { | ||
| 334 | + bool isUpdated = 1; | ||
| 335 | +} | ||
| 336 | + | ||
| 337 | +message BatchSaveOrUpdateDinersRpcRequest { | ||
| 338 | + repeated DinerModification modifications = 1; | ||
| 339 | + int32 enterpriseId = 2; | ||
| 340 | + int32 updatedBy = 3; | ||
| 341 | + int32 updateSource = 4; | ||
| 342 | +} | ||
| 343 | + | ||
| 344 | +message BatchSaveOrUpdateDinersRpcResponse { | ||
| 345 | + bool isUpdated = 1; | ||
| 346 | +} | ||
| 347 | + | ||
| 348 | +message DeleteDinersByIdsRpcRequest { | ||
| 349 | + repeated int32 ids = 1; | ||
| 350 | + int32 enterpriseId = 2; | ||
| 351 | + int32 updatedBy = 3; | ||
| 352 | + int32 updateSource = 4; | ||
| 353 | +} | ||
| 354 | + | ||
| 355 | +message DeleteDinersRpcResponse { | ||
| 356 | + bool isDeleted = 1; | ||
| 357 | +} | ||
| 358 | + | ||
| 359 | +enum MpAccountGenderEnum { | ||
| 360 | + MP_ACCOUNT_GENDER_MAN = 0; | ||
| 361 | + MP_ACCOUNT_GENDER_WOMAN = 1; | ||
| 362 | +} | ||
| 363 | +enum MpAccountStatusEnum { | ||
| 364 | + MP_ACCOUNT_STATUS_ENABLE = 0; | ||
| 365 | + MP_ACCOUNT_STATUS_DISABLE = 1; | ||
| 366 | +} | ||
| 367 | + | ||
| 368 | +message SingleMpAccountRpcResponse { | ||
| 369 | + int32 id = 1; | ||
| 370 | + int32 enterpriseId = 2; | ||
| 371 | + string openId = 3; | ||
| 372 | + string unionId = 4; | ||
| 373 | + string nickname = 5; | ||
| 374 | + string avatarUrl = 6; | ||
| 375 | + MpAccountGenderEnum gender = 7; | ||
| 376 | + string phoneNumber = 8; | ||
| 377 | + MpAccountStatusEnum status = 9; | ||
| 378 | + int32 createdBy = 10; | ||
| 379 | + int64 createdAt = 11; | ||
| 380 | + int32 creationSource = 12; | ||
| 381 | + int32 updatedBy = 13; | ||
| 382 | + int64 updatedAt = 14; | ||
| 383 | + int32 updateSource = 15; | ||
| 384 | + bool isDeleted = 16; | ||
| 385 | +} | ||
| 386 | + | ||
| 387 | +message GetMpAccountByIdRpcRequest { | ||
| 388 | + int32 id = 1; | ||
| 389 | + int32 enterpriseId = 2; | ||
| 390 | + bool includeDeleted = 3; | ||
| 391 | +} | ||
| 392 | + | ||
| 393 | +message GetMpAccountByIdRpcResponse { | ||
| 394 | + SingleMpAccountRpcResponse response = 1; | ||
| 395 | +} | ||
| 396 | + | ||
| 397 | +message GetMpAccountByOpenIdRpcRequest { | ||
| 398 | + string openId = 1; | ||
| 399 | +} | ||
| 400 | + | ||
| 401 | +message GetMpAccountByOpenIdRpcResponse { | ||
| 402 | + SingleMpAccountRpcResponse response = 1; | ||
| 403 | +} | ||
| 404 | + | ||
| 405 | +message GetMpAccountsByIdsRpcRequest { | ||
| 406 | + repeated int32 ids = 1; | ||
| 407 | + int32 enterpriseId = 2; | ||
| 408 | + bool includeDeleted = 3; | ||
| 409 | +} | ||
| 410 | + | ||
| 411 | +message GetMpAccountsByIdsRpcResponse { | ||
| 412 | + repeated SingleMpAccountRpcResponse responses = 1; | ||
| 413 | +} | ||
| 414 | + | ||
| 415 | +message QueryMpAccountsByConditionRpcRequest { | ||
| 416 | + int32 enterpriseId = 1; | ||
| 417 | + bool shouldFilterOpenId = 2; | ||
| 418 | + string openId = 3; | ||
| 419 | + bool shouldFilterUnionId = 4; | ||
| 420 | + string unionId = 5; | ||
| 421 | + bool shouldFilterPhoneNumber = 6; | ||
| 422 | + string phoneNumber = 7; | ||
| 423 | + bool shouldFilterStatus = 8; | ||
| 424 | + MpAccountStatusEnum status = 9; | ||
| 425 | + bool includeDeleted = 10; | ||
| 426 | +} | ||
| 427 | + | ||
| 428 | +message QueryMpAccountsByConditionRpcResponse { | ||
| 429 | + repeated SingleMpAccountRpcResponse responses = 1; | ||
| 430 | +} | ||
| 431 | + | ||
| 432 | +message MpAccountCreation{ | ||
| 433 | + string openId = 1; | ||
| 434 | + bool shouldCreateUnionId = 2; | ||
| 435 | + string unionId = 3; | ||
| 436 | + bool shouldCreateNickname = 4; | ||
| 437 | + string nickname = 5; | ||
| 438 | + bool shouldCreateAvatarUrl = 6; | ||
| 439 | + string avatarUrl = 7; | ||
| 440 | + MpAccountGenderEnum gender = 8; | ||
| 441 | + string phoneNumber = 9; | ||
| 442 | + MpAccountStatusEnum status = 10; | ||
| 443 | +} | ||
| 444 | + | ||
| 445 | +message CreateMpAccountRpcRequest { | ||
| 446 | + MpAccountCreation creation = 1; | ||
| 447 | + int32 enterpriseId = 2; | ||
| 448 | + int32 createdBy = 3; | ||
| 449 | + int32 creationSource = 4; | ||
| 450 | +} | ||
| 451 | + | ||
| 452 | +message CreateMpAccountRpcResponse { | ||
| 453 | + int32 id = 1; | ||
| 454 | + bool isCreated = 2; | ||
| 455 | +} | ||
| 456 | + | ||
| 457 | +message MpAccountModification { | ||
| 458 | + int32 id = 1; | ||
| 459 | + bool shouldUpdateOpenId = 2; | ||
| 460 | + string openId = 3; | ||
| 461 | + bool shouldUpdateUnionId = 4; | ||
| 462 | + string unionId = 5; | ||
| 463 | + bool shouldUpdateNickname = 6; | ||
| 464 | + string nickname = 7; | ||
| 465 | + bool shouldUpdateAvatarUrl = 8; | ||
| 466 | + string avatarUrl = 9; | ||
| 467 | + bool shouldUpdateGender = 10; | ||
| 468 | + MpAccountGenderEnum gender = 11; | ||
| 469 | + bool shouldUpdatePhoneNumber = 12; | ||
| 470 | + string phoneNumber = 13; | ||
| 471 | + bool shouldUpdateStatus = 14; | ||
| 472 | + MpAccountStatusEnum status = 15; | ||
| 473 | +} | ||
| 474 | + | ||
| 475 | +message UpdateMpAccountRpcRequest { | ||
| 476 | + MpAccountModification modification = 1; | ||
| 477 | + int32 enterpriseId = 2; | ||
| 478 | + int32 updatedBy = 3; | ||
| 479 | + int32 updateSource = 4; | ||
| 480 | +} | ||
| 481 | + | ||
| 482 | +message UpdateMpAccountRpcResponse { | ||
| 483 | + bool isUpdated = 1; | ||
| 484 | +} | ||
| 485 | + | ||
| 486 | +message DeleteMpAccountsByIdsRpcRequest { | ||
| 487 | + repeated int32 ids = 1; | ||
| 488 | + int32 enterpriseId = 2; | ||
| 489 | + int32 updatedBy = 3; | ||
| 490 | + int32 updateSource = 4; | ||
| 491 | +} | ||
| 492 | + | ||
| 493 | +message DeleteMpAccountsRpcResponse { | ||
| 494 | + bool isDeleted = 1; | ||
| 495 | +} | ||
| 496 | + | ||
| 497 | +message SingleMpAccountDinerRefRpcResponse { | ||
| 498 | + int32 id = 1; | ||
| 499 | + int32 enterpriseId = 2; | ||
| 500 | + int32 accountId = 3; | ||
| 501 | + int32 dinerId = 4; | ||
| 502 | + int32 createdBy = 5; | ||
| 503 | + int64 createdAt = 6; | ||
| 504 | + int32 creationSource = 7; | ||
| 505 | +} | ||
| 506 | + | ||
| 507 | +message GetMpAccountDinerRefsByIdsRpcRequest { | ||
| 508 | + repeated int32 ids = 1; | ||
| 509 | + int32 enterpriseId = 2; | ||
| 510 | +} | ||
| 511 | + | ||
| 512 | +message GetMpAccountDinerRefsByIdsRpcResponse { | ||
| 513 | + repeated SingleMpAccountDinerRefRpcResponse responses = 1; | ||
| 514 | +} | ||
| 515 | + | ||
| 516 | +message QueryMpAccountDinerRefsByConditionRpcRequest { | ||
| 517 | + int32 enterpriseId = 1; | ||
| 518 | + bool shouldFilterAccountIds = 2; | ||
| 519 | + repeated int32 accountIds = 3; | ||
| 520 | + bool shouldFilterDinerIds = 4; | ||
| 521 | + repeated int32 dinerIds = 5; | ||
| 522 | +} | ||
| 523 | + | ||
| 524 | +message QueryMpAccountDinerRefsByConditionRpcResponse { | ||
| 525 | + repeated SingleMpAccountDinerRefRpcResponse responses = 1; | ||
| 526 | +} | ||
| 527 | + | ||
| 528 | +message MpAccountDinerRefCreation{ | ||
| 529 | + int32 accountId = 1; | ||
| 530 | + int32 dinerId = 2; | ||
| 531 | +} | ||
| 532 | + | ||
| 533 | +message CreateMpAccountDinerRefRpcRequest { | ||
| 534 | + MpAccountDinerRefCreation creation = 1; | ||
| 535 | + int32 enterpriseId = 2; | ||
| 536 | + int32 createdBy = 3; | ||
| 537 | + int32 creationSource = 4; | ||
| 538 | +} | ||
| 539 | + | ||
| 540 | +message CreateMpAccountDinerRefRpcResponse { | ||
| 541 | + int32 id = 1; | ||
| 542 | + bool isCreated = 2; | ||
| 543 | +} | ||
| 544 | + | ||
| 545 | +message BatchCreateMpAccountDinerRefsRpcRequest { | ||
| 546 | + repeated MpAccountDinerRefCreation creations = 1; | ||
| 547 | + int32 enterpriseId = 2; | ||
| 548 | + int32 createdBy = 3; | ||
| 549 | + int32 creationSource = 4; | ||
| 550 | +} | ||
| 551 | + | ||
| 552 | +message BatchCreateMpAccountDinerRefsRpcResponse { | ||
| 553 | + repeated int32 ids = 1; | ||
| 554 | + bool isCreated = 2; | ||
| 555 | +} | ||
| 556 | + | ||
| 557 | +message DeleteMpAccountDinerRefsByIdsRpcRequest { | ||
| 558 | + repeated int32 ids = 1; | ||
| 559 | + int32 enterpriseId = 2; | ||
| 560 | +} | ||
| 561 | + | ||
| 562 | +message DeleteMpAccountDinerRefsRpcResponse { | ||
| 563 | + bool isDeleted = 1; | ||
| 564 | +} | ||
| 565 | + | ||
| 566 | +message SingleGradeClassRpcResponse { | ||
| 567 | + int32 id = 1; | ||
| 568 | + int32 enterpriseId = 2; | ||
| 569 | + int32 clientId = 3; | ||
| 570 | + string gradeName = 4; | ||
| 571 | + string className = 5; | ||
| 572 | + string fullName = 6; | ||
| 573 | + int32 createdBy = 7; | ||
| 574 | + int64 createdAt = 8; | ||
| 575 | + int32 creationSource = 9; | ||
| 576 | + int32 updatedBy = 10; | ||
| 577 | + int64 updatedAt = 11; | ||
| 578 | + int32 updateSource = 12; | ||
| 579 | + bool isDeleted = 13; | ||
| 580 | +} | ||
| 581 | + | ||
| 582 | +message GetGradeClassByIdRpcRequest { | ||
| 583 | + int32 id = 1; | ||
| 584 | + int32 enterpriseId = 2; | ||
| 585 | + bool includeDeleted = 3; | ||
| 586 | +} | ||
| 587 | + | ||
| 588 | +message GetGradeClassByIdRpcResponse { | ||
| 589 | + SingleGradeClassRpcResponse response = 1; | ||
| 590 | +} | ||
| 591 | + | ||
| 592 | +message GetGradeClassesByIdsRpcRequest { | ||
| 593 | + repeated int32 ids = 1; | ||
| 594 | + int32 enterpriseId = 2; | ||
| 595 | + bool includeDeleted = 3; | ||
| 596 | +} | ||
| 597 | + | ||
| 598 | +message GetGradeClassesByIdsRpcResponse { | ||
| 599 | + repeated SingleGradeClassRpcResponse responses = 1; | ||
| 600 | +} | ||
| 601 | + | ||
| 602 | +message GetAllGradeClassesRpcRequest { | ||
| 603 | + int32 enterpriseId = 1; | ||
| 604 | + bool includeDeleted = 2; | ||
| 605 | +} | ||
| 606 | + | ||
| 607 | +message GetAllGradeClassesRpcResponse { | ||
| 608 | + repeated SingleGradeClassRpcResponse responses = 1; | ||
| 609 | +} | ||
| 610 | + | ||
| 611 | +message QueryGradeClassesByConditionRpcRequest { | ||
| 612 | + int32 enterpriseId = 1; | ||
| 613 | + bool shouldFilterClientIds = 2; | ||
| 614 | + repeated int32 clientIds = 3; | ||
| 615 | + bool shouldFilterGradeName = 4; | ||
| 616 | + string gradeName = 5; | ||
| 617 | + bool includeDeleted = 6; | ||
| 618 | +} | ||
| 619 | + | ||
| 620 | +message QueryGradeClassesByConditionRpcResponse { | ||
| 621 | + repeated SingleGradeClassRpcResponse responses = 1; | ||
| 622 | +} | ||
| 623 | + | ||
| 624 | +message GradeClassCreation{ | ||
| 625 | + int32 clientId = 1; | ||
| 626 | + string gradeName = 2; | ||
| 627 | + string className = 3; | ||
| 628 | + bool shouldCreateFullName = 4; | ||
| 629 | + string fullName = 5; | ||
| 630 | +} | ||
| 631 | + | ||
| 632 | +message CreateGradeClassRpcRequest { | ||
| 633 | + GradeClassCreation creation = 1; | ||
| 634 | + int32 enterpriseId = 2; | ||
| 635 | + int32 createdBy = 3; | ||
| 636 | + int32 creationSource = 4; | ||
| 637 | +} | ||
| 638 | + | ||
| 639 | +message CreateGradeClassRpcResponse { | ||
| 640 | + int32 id = 1; | ||
| 641 | + bool isCreated = 2; | ||
| 642 | +} | ||
| 643 | + | ||
| 644 | +message BatchCreateGradeClassesRpcRequest { | ||
| 645 | + repeated GradeClassCreation creations = 1; | ||
| 646 | + int32 enterpriseId = 2; | ||
| 647 | + int32 createdBy = 3; | ||
| 648 | + int32 creationSource = 4; | ||
| 649 | +} | ||
| 650 | + | ||
| 651 | +message BatchCreateGradeClassesRpcResponse { | ||
| 652 | + repeated int32 ids = 1; | ||
| 653 | + bool isCreated = 2; | ||
| 654 | +} | ||
| 655 | + | ||
| 656 | +message GradeClassModification { | ||
| 657 | + int32 id = 1; | ||
| 658 | + bool shouldUpdateClientId = 2; | ||
| 659 | + int32 clientId = 3; | ||
| 660 | + bool shouldUpdateGradeName = 4; | ||
| 661 | + string gradeName = 5; | ||
| 662 | + bool shouldUpdateClassName = 6; | ||
| 663 | + string className = 7; | ||
| 664 | + bool shouldUpdateFullName = 8; | ||
| 665 | + string fullName = 9; | ||
| 666 | +} | ||
| 667 | + | ||
| 668 | +message UpdateGradeClassRpcRequest { | ||
| 669 | + GradeClassModification modification = 1; | ||
| 670 | + int32 enterpriseId = 2; | ||
| 671 | + int32 updatedBy = 3; | ||
| 672 | + int32 updateSource = 4; | ||
| 673 | +} | ||
| 674 | + | ||
| 675 | +message UpdateGradeClassRpcResponse { | ||
| 676 | + bool isUpdated = 1; | ||
| 677 | +} | ||
| 678 | + | ||
| 679 | +message BatchSaveOrUpdateGradeClassesRpcRequest { | ||
| 680 | + repeated GradeClassModification modifications = 1; | ||
| 681 | + int32 enterpriseId = 2; | ||
| 682 | + int32 updatedBy = 3; | ||
| 683 | + int32 updateSource = 4; | ||
| 684 | +} | ||
| 685 | + | ||
| 686 | +message BatchSaveOrUpdateGradeClassesRpcResponse { | ||
| 687 | + bool isUpdated = 1; | ||
| 688 | +} | ||
| 689 | + | ||
| 690 | +message BatchUpdateGradeClassesRpcRequest { | ||
| 691 | + repeated GradeClassModification modifications = 1; | ||
| 692 | + int32 enterpriseId = 2; | ||
| 693 | + int32 updatedBy = 3; | ||
| 694 | + int32 updateSource = 4; | ||
| 695 | +} | ||
| 696 | + | ||
| 697 | +message BatchUpdateGradeClassesRpcResponse { | ||
| 698 | + bool isUpdated = 1; | ||
| 699 | +} | ||
| 700 | + | ||
| 701 | +message DeleteGradeClassesByIdsRpcRequest { | ||
| 702 | + repeated int32 ids = 1; | ||
| 703 | + int32 enterpriseId = 2; | ||
| 704 | + int32 updatedBy = 3; | ||
| 705 | + int32 updateSource = 4; | ||
| 706 | +} | ||
| 707 | + | ||
| 708 | +message DeleteGradeClassesRpcResponse { | ||
| 709 | + bool isDeleted = 1; | ||
| 710 | +} | ||
| 711 | + | ||
| 712 | +message DeleteGradeClassesAndDinersByClientIdsRpcRequest { | ||
| 713 | + repeated int32 clientIds = 1; | ||
| 714 | + int32 enterpriseId = 2; | ||
| 715 | + int32 updatedBy = 3; | ||
| 716 | + int32 updateSource = 4; | ||
| 717 | +} | ||
| 718 | + | ||
| 719 | +message DeleteGradeClassesAndDinersByClientIdsRpcResponse { | ||
| 720 | + bool isDeleted = 1; | ||
| 721 | +} | ||
| 722 | + | ||
| 723 | +message SingleMealMenuRecordRpcResponse { | ||
| 724 | + int32 id = 1; | ||
| 725 | + int32 enterpriseId = 2; | ||
| 726 | + int32 clientId = 3; | ||
| 727 | + string name = 4; | ||
| 728 | + string imageUrl = 5; | ||
| 729 | + int32 createdBy = 6; | ||
| 730 | + int64 createdAt = 7; | ||
| 731 | + int32 creationSource = 8; | ||
| 732 | + int32 updatedBy = 9; | ||
| 733 | + int64 updatedAt = 10; | ||
| 734 | + int32 updateSource = 11; | ||
| 735 | + bool isDeleted = 12; | ||
| 736 | +} | ||
| 737 | + | ||
| 738 | +message GetMealMenuRecordByIdRpcRequest { | ||
| 739 | + int32 id = 1; | ||
| 740 | + int32 enterpriseId = 2; | ||
| 741 | + bool includeDeleted = 3; | ||
| 742 | +} | ||
| 743 | + | ||
| 744 | +message GetMealMenuRecordByIdRpcResponse { | ||
| 745 | + SingleMealMenuRecordRpcResponse response = 1; | ||
| 746 | +} | ||
| 747 | + | ||
| 748 | +message GetMealMenuRecordsByIdsRpcRequest { | ||
| 749 | + repeated int32 ids = 1; | ||
| 750 | + int32 enterpriseId = 2; | ||
| 751 | + bool includeDeleted = 3; | ||
| 752 | +} | ||
| 753 | + | ||
| 754 | +message GetMealMenuRecordsByIdsRpcResponse { | ||
| 755 | + repeated SingleMealMenuRecordRpcResponse responses = 1; | ||
| 756 | +} | ||
| 757 | + | ||
| 758 | +message QueryMealMenuRecordsByConditionRpcRequest { | ||
| 759 | + int32 enterpriseId = 1; | ||
| 760 | + bool shouldFilterClientIds = 2; | ||
| 761 | + repeated int32 clientIds = 3; | ||
| 762 | + bool shouldFilterName = 4; | ||
| 763 | + string name = 5; | ||
| 764 | + bool includeDeleted = 6; | ||
| 765 | +} | ||
| 766 | + | ||
| 767 | +message QueryMealMenuRecordsByConditionRpcResponse { | ||
| 768 | + repeated SingleMealMenuRecordRpcResponse responses = 1; | ||
| 769 | +} | ||
| 770 | + | ||
| 771 | +message MealMenuRecordCreation{ | ||
| 772 | + int32 clientId = 1; | ||
| 773 | + string name = 2; | ||
| 774 | + bool shouldCreateImageUrl = 3; | ||
| 775 | + string imageUrl = 4; | ||
| 776 | +} | ||
| 777 | + | ||
| 778 | +message CreateMealMenuRecordRpcRequest { | ||
| 779 | + MealMenuRecordCreation creation = 1; | ||
| 780 | + int32 enterpriseId = 2; | ||
| 781 | + int32 createdBy = 3; | ||
| 782 | + int32 creationSource = 4; | ||
| 783 | +} | ||
| 784 | + | ||
| 785 | +message CreateMealMenuRecordRpcResponse { | ||
| 786 | + int32 id = 1; | ||
| 787 | + bool isCreated = 2; | ||
| 788 | +} | ||
| 789 | + | ||
| 790 | +message QueryLatestMealMenuRecordByClientIdRpcRequest { | ||
| 791 | + int32 enterpriseId = 1; | ||
| 792 | + int32 clientId = 2; | ||
| 793 | +} | ||
| 794 | + | ||
| 795 | +message QueryLatestMealMenuRecordByClientIdRpcResponse { | ||
| 796 | + SingleMealMenuRecordRpcResponse response = 1; | ||
| 797 | +} |
| ... | @@ -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 | ... | ... |
src/main/resources/mapper/DinerMapper.xml
0 → 100644
| 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> |
-
Please register or login to post a comment