zhuyifan

农信点餐小程序

Showing 37 changed files with 914 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.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对象
......
This diff is collapsed. Click to expand it.
...@@ -7,20 +7,13 @@ spring.main.web-application-type=none ...@@ -7,20 +7,13 @@ spring.main.web-application-type=none
7 spring.application.name=order-service 7 spring.application.name=order-service
8 spring.datasource.driver-class-name=com.mysql.jdbc.Driver 8 spring.datasource.driver-class-name=com.mysql.jdbc.Driver
9 9
10 -spring.datasource.dynamic.datasource.master.url=jdbc:mysql://localhost:3306/cater?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false 10 +spring.datasource.dynamic.datasource.master.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
11 spring.datasource.dynamic.datasource.master.username=root 11 spring.datasource.dynamic.datasource.master.username=root
12 -spring.datasource.dynamic.datasource.master.password=QAZwsx098 12 +spring.datasource.dynamic.datasource.master.password=123456
13 -spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://localhost:3306/cater_slave?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false 13 +spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://localhost:3306/test?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
14 spring.datasource.dynamic.datasource.slave.username=root 14 spring.datasource.dynamic.datasource.slave.username=root
15 -spring.datasource.dynamic.datasource.slave.password=QAZwsx098 15 +spring.datasource.dynamic.datasource.slave.password=123456
16 spring.datasource.dynamic.primary=master 16 spring.datasource.dynamic.primary=master
17 -#spring.datasource.dynamic.datasource.master.url=jdbc:mysql://rm-uf63gfjzejp163e3g4o.mysql.rds.aliyuncs.com:3306/qingniu?autoReconnect=true&tcpKeepAlive=true&rewriteBatchedStatements=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
18 -#spring.datasource.dynamic.datasource.master.username=jj_infoloop_stage
19 -#spring.datasource.dynamic.datasource.master.password=H8kjNeChi1wimXw
20 -#spring.datasource.dynamic.datasource.slave.url=jdbc:mysql://rm-uf63gfjzejp163e3g4o.mysql.rds.aliyuncs.com:3306/qingniu?autoReconnect=true&tcpKeepAlive=true&statementInterceptors=com.tianting.infoloop.tracing.MysqlZipkinInterceptor&useSSL=false
21 -#spring.datasource.dynamic.datasource.slave.username=jj_infoloop_stage
22 -#spring.datasource.dynamic.datasource.slave.password=H8kjNeChi1wimXw
23 -#spring.datasource.dynamic.primary=master
24 17
25 logging.config=classpath:logback-spring.xml 18 logging.config=classpath:logback-spring.xml
26 19
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.DinerMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.Diner">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="classId" column="classId" jdbcType="INTEGER"/>
12 + <result property="studentNo" column="studentNo" jdbcType="VARCHAR"/>
13 + <result property="name" column="name" jdbcType="VARCHAR"/>
14 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
15 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
16 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
17 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
18 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
19 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
20 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
21 + </resultMap>
22 +
23 + <sql id="Base_Column_List">
24 + id,enterpriseId,clientId,
25 + classId,studentNo,name,
26 + createdBy,createdAt,creationSource,
27 + updatedBy,updatedAt,updateSource,
28 + isDeleted
29 + </sql>
30 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.GradeClassMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.GradeClass">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="gradeName" column="gradeName" jdbcType="VARCHAR"/>
12 + <result property="className" column="className" jdbcType="VARCHAR"/>
13 + <result property="fullName" column="fullName" jdbcType="VARCHAR"/>
14 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
15 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
16 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
17 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
18 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
19 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
20 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
21 + </resultMap>
22 +
23 + <sql id="Base_Column_List">
24 + id,enterpriseId,clientId,
25 + gradeName,className,fullName,
26 + createdBy,createdAt,creationSource,
27 + updatedBy,updatedAt,updateSource,
28 + isDeleted
29 + </sql>
30 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MealMenuRecordMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MealMenuRecord">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="name" column="name" jdbcType="VARCHAR"/>
12 + <result property="imageUrl" column="imageUrl" jdbcType="VARCHAR"/>
13 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
14 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
15 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
16 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
17 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
18 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
19 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
20 + </resultMap>
21 +
22 + <sql id="Base_Column_List">
23 + id,enterpriseId,clientId,
24 + name,imageUrl,createdBy,
25 + createdAt,creationSource,updatedBy,
26 + updatedAt,updateSource,isDeleted
27 + </sql>
28 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MealOrderMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MealOrder">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="clientId" column="clientId" jdbcType="INTEGER"/>
11 + <result property="menuId" column="menuId" jdbcType="INTEGER"/>
12 + <result property="accountId" column="accountId" jdbcType="INTEGER"/>
13 + <result property="orderMethod" column="orderMethod" jdbcType="TINYINT"/>
14 + <result property="dinerId" column="dinerId" jdbcType="INTEGER"/>
15 + <result property="dinerName" column="dinerName" jdbcType="VARCHAR"/>
16 + <result property="clientName" column="clientName" jdbcType="VARCHAR"/>
17 + <result property="gradeName" column="gradeName" jdbcType="VARCHAR"/>
18 + <result property="className" column="className" jdbcType="VARCHAR"/>
19 + <result property="studentNo" column="studentNo" jdbcType="VARCHAR"/>
20 + <result property="reserveDate" column="reserveDate" jdbcType="TIMESTAMP"/>
21 + <result property="meals" column="meals" jdbcType="OTHER"/>
22 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
23 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
24 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
25 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
26 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
27 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
28 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
29 + </resultMap>
30 +
31 + <sql id="Base_Column_List">
32 + id,enterpriseId,clientId,
33 + menuId,accountId,orderMethod,
34 + dinerId,dinerName,clientName,
35 + gradeName,className,studentNo,
36 + reserveDate,meals,createdBy,
37 + createdAt,creationSource,updatedBy,
38 + updatedAt,updateSource,isDeleted
39 + </sql>
40 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MpAccountDinerRefMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MpAccountDinerRef">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="accountId" column="accountId" jdbcType="INTEGER"/>
11 + <result property="dinerId" column="dinerId" jdbcType="INTEGER"/>
12 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
13 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
14 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
15 + </resultMap>
16 +
17 + <sql id="Base_Column_List">
18 + id,enterpriseId,accountId,
19 + dinerId,createdBy,createdAt,
20 + creationSource
21 + </sql>
22 +</mapper>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE mapper
3 + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 + "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 +<mapper namespace="com.tianting.infoloop.mapper.MpAccountMapper">
6 +
7 + <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.MpAccount">
8 + <id property="id" column="id" jdbcType="INTEGER"/>
9 + <result property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 + <result property="openId" column="openId" jdbcType="VARCHAR"/>
11 + <result property="unionId" column="unionId" jdbcType="VARCHAR"/>
12 + <result property="nickname" column="nickname" jdbcType="VARCHAR"/>
13 + <result property="avatarUrl" column="avatarUrl" jdbcType="VARCHAR"/>
14 + <result property="gender" column="gender" jdbcType="TINYINT"/>
15 + <result property="phoneNumber" column="phoneNumber" jdbcType="VARCHAR"/>
16 + <result property="status" column="status" jdbcType="TINYINT"/>
17 + <result property="createdBy" column="createdBy" jdbcType="INTEGER"/>
18 + <result property="createdAt" column="createdAt" jdbcType="TIMESTAMP"/>
19 + <result property="creationSource" column="creationSource" jdbcType="INTEGER"/>
20 + <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
21 + <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
22 + <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
23 + <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
24 + </resultMap>
25 +
26 + <sql id="Base_Column_List">
27 + id,enterpriseId,openId,
28 + unionId,nickname,avatarUrl,
29 + gender,phoneNumber,status,
30 + createdBy,createdAt,creationSource,
31 + updatedBy,updatedAt,updateSource,
32 + isDeleted
33 + </sql>
34 +</mapper>