zhuyifan

删除test

1 -package com.tianting.infoloop.mapper;
2 -
3 -import com.tianting.infoloop.inject.MyBaseMapper;
4 -import com.tianting.infoloop.model.db.TestExampleDb;
5 -
6 -public interface TestExampleDbMapper extends MyBaseMapper<TestExampleDb> {
7 -
8 -}
9 -
10 -
11 -
12 -
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 - * 例子DB
19 - * @TableName test_example_db
20 - */
21 -@Data
22 -@Accessors(chain = true)
23 -@EqualsAndHashCode(callSuper = true)
24 -@TableName(value ="test_example_db")
25 -public class TestExampleDb extends Model<TestExampleDb> implements Serializable {
26 - /**
27 - *
28 - */
29 - @TableId(type = IdType.AUTO)
30 - private Integer id;
31 -
32 - /**
33 - * 企业 ID
34 - */
35 - private Integer enterpriseId;
36 -
37 - /**
38 - * 用户昵称
39 - */
40 - private String name;
41 -
42 - /**
43 - * 用户状态;启用:1;停用:2
44 - */
45 - private Integer status;
46 -
47 - /**
48 - * 创建人 ID
49 - */
50 - @TableField(fill = FieldFill.INSERT)
51 - private Integer createdBy;
52 -
53 - /**
54 - * 创建时间
55 - */
56 - @TableField(fill = FieldFill.INSERT)
57 - private LocalDateTime createdAt;
58 -
59 - /**
60 - * 创建来源
61 - */
62 - @TableField(fill = FieldFill.INSERT)
63 - private Integer creationSource;
64 -
65 - /**
66 - * 修改人 ID
67 - */
68 - @TableField(fill = FieldFill.INSERT_UPDATE)
69 - private Integer updatedBy;
70 -
71 - /**
72 - * 修改时间
73 - */
74 - @TableField(fill = FieldFill.INSERT_UPDATE)
75 - private LocalDateTime updatedAt;
76 -
77 - /**
78 - * 修改来源
79 - */
80 - @TableField(fill = FieldFill.INSERT_UPDATE)
81 - private Integer updateSource;
82 -
83 - /**
84 - * 是否删除;0:未删除,1:已删除
85 - */
86 - @TableLogic
87 - private Boolean isDeleted;
88 -
89 -}
...\ 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.grpc.exampleservice.TestExampleDbCreation;
5 -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbModification;
6 -import com.tianting.infoloop.model.db.TestExampleDb;
7 -
8 -import java.util.List;
9 -
10 -/**
11 -* @author zhuyf
12 -* @description 针对表【 test_example_db(例子DB)】的数据库操作Service
13 -* @createDate 2024-10-12 13:53:16
14 -*/
15 -public interface TestExampleDbService extends IService<TestExampleDb> {
16 -
17 - TestExampleDb createTestExampleDb(TestExampleDbCreation creation);
18 -
19 - List<TestExampleDb> batchCreateTestExampleDb(List<TestExampleDbCreation> creationsList);
20 -
21 - boolean updateTestExampleDb(TestExampleDbModification modification);
22 -
23 - boolean batchUpdateTestExampleDb(List<TestExampleDbModification> modificationsList);
24 -}
1 -package com.tianting.infoloop.service.grpc;
2 -
3 -import com.baomidou.dynamic.datasource.annotation.DS;
4 -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
5 -import com.baomidou.mybatisplus.core.metadata.IPage;
6 -import com.baomidou.mybatisplus.core.toolkit.Wrappers;
7 -import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 -import com.tianting.infoloop.grpc.exampleservice.BatchCreateTestExampleDbRpcRequest;
9 -import com.tianting.infoloop.grpc.exampleservice.BatchCreateTestExampleDbRpcResponse;
10 -import com.tianting.infoloop.grpc.exampleservice.BatchUpdateTestExampleDbRpcRequest;
11 -import com.tianting.infoloop.grpc.exampleservice.BatchUpdateTestExampleDbRpcResponse;
12 -import com.tianting.infoloop.grpc.exampleservice.CreateTestExampleDbRpcRequest;
13 -import com.tianting.infoloop.grpc.exampleservice.CreateTestExampleDbRpcResponse;
14 -import com.tianting.infoloop.grpc.exampleservice.DeleteTestExampleDbByIdsRpcRequest;
15 -import com.tianting.infoloop.grpc.exampleservice.DeleteTestExampleDbRpcResponse;
16 -import com.tianting.infoloop.grpc.exampleservice.ExampleServiceRpcGrpc;
17 -import com.tianting.infoloop.grpc.exampleservice.GetAllTestExampleDbRpcRequest;
18 -import com.tianting.infoloop.grpc.exampleservice.GetAllTestExampleDbRpcResponse;
19 -import com.tianting.infoloop.grpc.exampleservice.GetTestExampleDbByIdRpcRequest;
20 -import com.tianting.infoloop.grpc.exampleservice.GetTestExampleDbByIdRpcResponse;
21 -import com.tianting.infoloop.grpc.exampleservice.GetTestExampleDbByIdsRpcRequest;
22 -import com.tianting.infoloop.grpc.exampleservice.GetTestExampleDbByIdsRpcResponse;
23 -import com.tianting.infoloop.grpc.exampleservice.QueryTestExampleDbByConditionRpcRequest;
24 -import com.tianting.infoloop.grpc.exampleservice.QueryTestExampleDbByConditionRpcResponse;
25 -import com.tianting.infoloop.grpc.exampleservice.QueryTestExampleDbByPaginationRpcRequest;
26 -import com.tianting.infoloop.grpc.exampleservice.QueryTestExampleDbByPaginationRpcResponse;
27 -import com.tianting.infoloop.grpc.exampleservice.SingleTestExampleDbRpcResponse;
28 -import com.tianting.infoloop.grpc.exampleservice.UpdateTestExampleDbRpcRequest;
29 -import com.tianting.infoloop.grpc.exampleservice.UpdateTestExampleDbRpcResponse;
30 -import com.tianting.infoloop.model.db.TestExampleDb;
31 -import com.tianting.infoloop.service.TestExampleDbService;
32 -import com.tianting.infoloop.utils.ProtoBeanUtil;
33 -import io.grpc.Status;
34 -import io.grpc.stub.StreamObserver;
35 -import lombok.RequiredArgsConstructor;
36 -import lombok.extern.slf4j.Slf4j;
37 -import org.springframework.beans.factory.annotation.Autowired;
38 -import org.springframework.stereotype.Service;
39 -
40 -import java.util.stream.Collectors;
41 -
42 -import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_MASTER;
43 -import static com.tianting.infoloop.constants.ConfigConstants.DATA_SOURCE_SLAVE;
44 -
45 -@Slf4j
46 -@Service
47 -@RequiredArgsConstructor(onConstructor_ = @Autowired)
48 -public class ExampleGrpcService extends ExampleServiceRpcGrpc.ExampleServiceRpcImplBase
49 -{
50 -
51 - private final TestExampleDbService testExampleDbService;
52 -
53 - @Override
54 - @DS(DATA_SOURCE_SLAVE)
55 - public void getTestExampleDbById(final GetTestExampleDbByIdRpcRequest request,
56 - final StreamObserver<GetTestExampleDbByIdRpcResponse> responseObserver) {
57 - final var builder = GetTestExampleDbByIdRpcResponse.newBuilder();
58 - try {
59 - final var data = testExampleDbService.getById(request.getId());
60 - if (data != null) {
61 - builder.setResponse(ProtoBeanUtil.beanToProto(data, SingleTestExampleDbRpcResponse.class));
62 - }
63 - } catch (final Exception e) {
64 - log.error("getTestExampleDbById error;", e);
65 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
66 - }
67 - responseObserver.onNext(builder.build());
68 - responseObserver.onCompleted();
69 - }
70 -
71 - @Override
72 - @DS(DATA_SOURCE_SLAVE)
73 - public void getTestExampleDbByIds(final GetTestExampleDbByIdsRpcRequest request,
74 - final StreamObserver<GetTestExampleDbByIdsRpcResponse> responseObserver) {
75 - final var builder = GetTestExampleDbByIdsRpcResponse.newBuilder();
76 - try {
77 - if (request.getIdsList().isEmpty()) {
78 - responseObserver.onNext(builder.build());
79 - responseObserver.onCompleted();
80 - return;
81 - }
82 - final var list = testExampleDbService.listByIds(request.getIdsList());
83 - if (!list.isEmpty()) {
84 - builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleTestExampleDbRpcResponse.class));
85 - }
86 - } catch (final Exception e) {
87 - log.error("getTestExampleDbByIds error;", e);
88 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
89 - }
90 - responseObserver.onNext(builder.build());
91 - responseObserver.onCompleted();
92 - }
93 -
94 - @Override
95 - @DS(DATA_SOURCE_SLAVE)
96 - public void getAllTestExampleDb(final GetAllTestExampleDbRpcRequest request,
97 - final StreamObserver<GetAllTestExampleDbRpcResponse> responseObserver) {
98 - final var builder = GetAllTestExampleDbRpcResponse.newBuilder();
99 - try {
100 - final var list = testExampleDbService.list();
101 - if (!list.isEmpty()) {
102 - builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleTestExampleDbRpcResponse.class));
103 - }
104 - } catch (final Exception e) {
105 - log.error("getAllTestExampleDb error;", e);
106 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
107 - }
108 - responseObserver.onNext(builder.build());
109 - responseObserver.onCompleted();
110 - }
111 -
112 - @Override
113 - @DS(DATA_SOURCE_SLAVE)
114 - public void queryTestExampleDbByCondition(final QueryTestExampleDbByConditionRpcRequest request,
115 - final StreamObserver<QueryTestExampleDbByConditionRpcResponse> responseObserver) {
116 - final var builder = QueryTestExampleDbByConditionRpcResponse.newBuilder();
117 - try {
118 - LambdaQueryWrapper<TestExampleDb> queryWrapper = Wrappers.lambdaQuery();
119 - if (request.hasName()) {
120 - queryWrapper.like(TestExampleDb::getName, request.getName());
121 - }
122 - if (request.hasStatus()) {
123 - queryWrapper.eq(TestExampleDb::getStatus, request.getStatusValue());
124 - }
125 - final var list = testExampleDbService.list(queryWrapper);
126 - if (!list.isEmpty()) {
127 - builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(list, SingleTestExampleDbRpcResponse.class));
128 - }
129 - } catch (final Exception e) {
130 - log.error("queryTestExampleDbByCondition error;", e);
131 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
132 - }
133 - responseObserver.onNext(builder.build());
134 - responseObserver.onCompleted();
135 - }
136 -
137 - @Override
138 - @DS(DATA_SOURCE_SLAVE)
139 - public void queryTestExampleDbByPagination(final QueryTestExampleDbByPaginationRpcRequest request,
140 - final StreamObserver<QueryTestExampleDbByPaginationRpcResponse> responseObserver) {
141 - final var builder = QueryTestExampleDbByPaginationRpcResponse.newBuilder();
142 - try {
143 - IPage<TestExampleDb> page = new Page<>(request.getPageNo(), request.getPageSize());
144 - LambdaQueryWrapper<TestExampleDb> queryWrapper = Wrappers.lambdaQuery();
145 - if (request.hasName()) {
146 - queryWrapper.like(TestExampleDb::getName, request.getName());
147 - }
148 - if (request.hasStatus()) {
149 - queryWrapper.eq(TestExampleDb::getStatus, request.getStatusValue());
150 - }
151 - final var result = testExampleDbService.page(page, queryWrapper);
152 - builder.setTotal(result.getTotal());
153 - builder.setPages(result.getPages());
154 - if (!result.getRecords().isEmpty()) {
155 - builder.addAllResponses(ProtoBeanUtil.beanListToProtoList(result.getRecords(), SingleTestExampleDbRpcResponse.class));
156 - }
157 - } catch (final Exception e) {
158 - log.error("queryTestExampleDbByCondition error;", e);
159 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
160 - }
161 - responseObserver.onNext(builder.build());
162 - responseObserver.onCompleted();
163 - }
164 -
165 - @Override
166 - @DS(DATA_SOURCE_MASTER)
167 - public void createTestExampleDb(final CreateTestExampleDbRpcRequest request,
168 - final StreamObserver<CreateTestExampleDbRpcResponse> responseObserver) {
169 - final var builder = CreateTestExampleDbRpcResponse.newBuilder();
170 - builder.setIsCreated(false);
171 - try {
172 - final var data = testExampleDbService.createTestExampleDb(request.getCreation());
173 - builder.setIsCreated(data != null).setId(data == null ? 0 : data.getId());
174 - } catch (final Exception e) {
175 - log.error("createTestExampleDb error;", e);
176 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
177 - }
178 - responseObserver.onNext(builder.build());
179 - responseObserver.onCompleted();
180 - }
181 -
182 - @Override
183 - @DS(DATA_SOURCE_MASTER)
184 - public void batchCreateTestExampleDb(final BatchCreateTestExampleDbRpcRequest request,
185 - final StreamObserver<BatchCreateTestExampleDbRpcResponse> responseObserver) {
186 - final var builder = BatchCreateTestExampleDbRpcResponse.newBuilder();
187 - builder.setIsCreated(false);
188 - try {
189 - final var list = testExampleDbService.batchCreateTestExampleDb(request.getCreationsList());
190 - builder.setIsCreated(list.size() == request.getCreationsCount()).addAllIds(list.stream().map(TestExampleDb::getId).collect(Collectors.toList()));
191 - } catch (final Exception e) {
192 - log.error("batchCreateTestExampleDb error;", e);
193 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
194 - }
195 - responseObserver.onNext(builder.build());
196 - responseObserver.onCompleted();
197 - }
198 -
199 - @Override
200 - @DS(DATA_SOURCE_MASTER)
201 - public void updateTestExampleDb(final UpdateTestExampleDbRpcRequest request,
202 - final StreamObserver<UpdateTestExampleDbRpcResponse> responseObserver) {
203 - final var builder = UpdateTestExampleDbRpcResponse.newBuilder();
204 - builder.setIsUpdated(false);
205 - try {
206 - builder.setIsUpdated(testExampleDbService.updateTestExampleDb(request.getModification()));
207 - } catch (final Exception e) {
208 - log.error("updateTestExampleDb error;", e);
209 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
210 - }
211 - responseObserver.onNext(builder.build());
212 - responseObserver.onCompleted();
213 - }
214 -
215 - @Override
216 - @DS(DATA_SOURCE_MASTER)
217 - public void batchUpdateTestExampleDb(final BatchUpdateTestExampleDbRpcRequest request,
218 - final StreamObserver<BatchUpdateTestExampleDbRpcResponse> responseObserver) {
219 - final var builder = BatchUpdateTestExampleDbRpcResponse.newBuilder();
220 - builder.setIsUpdated(false);
221 - try {
222 - builder.setIsUpdated(testExampleDbService.batchUpdateTestExampleDb(request.getModificationsList()));
223 - } catch (final Exception e) {
224 - log.error("batchUpdateTestExampleDb error;", e);
225 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
226 - }
227 - responseObserver.onNext(builder.build());
228 - responseObserver.onCompleted();
229 - }
230 -
231 - @Override
232 - @DS(DATA_SOURCE_MASTER)
233 - public void deleteTestExampleDbByIds(final DeleteTestExampleDbByIdsRpcRequest request,
234 - final StreamObserver<DeleteTestExampleDbRpcResponse> responseObserver) {
235 - final var builder = DeleteTestExampleDbRpcResponse.newBuilder();
236 - builder.setIsDeleted(false);
237 - try {
238 - if (request.getIdsList().isEmpty()) {
239 - responseObserver.onNext(builder.build());
240 - responseObserver.onCompleted();
241 - return;
242 - }
243 - builder.setIsDeleted(testExampleDbService.removeBatchByIds(request.getIdsList()));
244 - } catch (final Exception e) {
245 - log.error("deleteTestExampleDbByIds error;", e);
246 - responseObserver.onError(Status.INTERNAL.withDescription(e.getMessage()).asException());
247 - }
248 - responseObserver.onNext(builder.build());
249 - responseObserver.onCompleted();
250 - }
251 -
252 -}
1 -package com.tianting.infoloop.service.impl;
2 -
3 -
4 -import cn.hutool.extra.spring.SpringUtil;
5 -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
6 -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbCreation;
7 -import com.tianting.infoloop.grpc.exampleservice.TestExampleDbModification;
8 -import com.tianting.infoloop.mapper.TestExampleDbMapper;
9 -import com.tianting.infoloop.model.db.TestExampleDb;
10 -import com.tianting.infoloop.service.TestExampleDbService;
11 -import lombok.RequiredArgsConstructor;
12 -import lombok.extern.slf4j.Slf4j;
13 -import org.springframework.beans.factory.annotation.Autowired;
14 -import org.springframework.lang.Nullable;
15 -import org.springframework.stereotype.Service;
16 -
17 -import java.util.Collections;
18 -import java.util.List;
19 -import java.util.stream.Collectors;
20 -
21 -/**
22 -* @author zhuyf
23 -* @description 针对表【 test_example_db(例子DB)】的数据库操作Service实现
24 -* @createDate 2024-10-12 13:53:16
25 -*/
26 -@Slf4j
27 -@Service
28 -@RequiredArgsConstructor(onConstructor_ = @Autowired)
29 -public class TestExampleDbServiceImpl extends ServiceImpl<TestExampleDbMapper, TestExampleDb> implements TestExampleDbService {
30 -
31 - private final TestExampleDbMapper testExampleDbMapper;
32 -
33 - @Override
34 - @Nullable
35 - public TestExampleDb createTestExampleDb(TestExampleDbCreation creation) {
36 - TestExampleDb testExampleDb = new TestExampleDb();
37 - testExampleDb.setName(creation.getName());
38 - testExampleDb.setStatus(creation.getStatusValue());
39 - final var insert = testExampleDbMapper.insert(testExampleDb);
40 - return insert > 0 ? testExampleDb : null;
41 - }
42 -
43 - @Override
44 - public List<TestExampleDb> batchCreateTestExampleDb(List<TestExampleDbCreation> creationsList) {
45 - var list = creationsList.stream().map(creation -> new TestExampleDb()
46 - .setName(creation.getName())
47 - .setStatus(creation.getStatusValue())).collect(Collectors.toList());
48 - return SpringUtil.getBean(TestExampleDbServiceImpl.class).saveBatch(list) ? list : Collections.emptyList();
49 - }
50 -
51 - @Override
52 - public boolean updateTestExampleDb(TestExampleDbModification modification) {
53 - var testExampleDb = new TestExampleDb();
54 - testExampleDb.setId(modification.getId());
55 - if (modification.hasName()) {
56 - testExampleDb.setName(modification.getName());
57 - }
58 - if (modification.hasStatus()) {
59 - testExampleDb.setStatus(modification.getStatusValue());
60 - }
61 - return testExampleDbMapper.updateById(testExampleDb) > 0;
62 - }
63 -
64 - @Override
65 - public boolean batchUpdateTestExampleDb(List<TestExampleDbModification> modificationsList) {
66 - final var list = modificationsList.stream().map(modification -> {
67 - var testExampleDb = new TestExampleDb();
68 - testExampleDb.setId(modification.getId());
69 - if (modification.hasName()) {
70 - testExampleDb.setName(modification.getName());
71 - }
72 - if (modification.hasStatus()) {
73 - testExampleDb.setStatus(modification.getStatusValue());
74 - }
75 - return testExampleDb;
76 - }).collect(Collectors.toList());
77 - return SpringUtil.getBean(TestExampleDbServiceImpl.class).updateBatchById(list);
78 - }
79 -}
80 -
81 -
82 -
83 -
1 -syntax = "proto3";
2 -
3 -option java_multiple_files = true;
4 -option java_package = "com.tianting.infoloop.grpc.exampleservice";
5 -option java_outer_classname = "ExampleServiceProto";
6 -option objc_class_prefix = "OP";
7 -
8 -package com.tianting.infoloop.grpc.exampleservice;
9 -
10 -service ExampleServiceRpc {
11 - rpc GetTestExampleDbById (GetTestExampleDbByIdRpcRequest) returns (GetTestExampleDbByIdRpcResponse) {}
12 - rpc GetTestExampleDbByIds (GetTestExampleDbByIdsRpcRequest) returns (GetTestExampleDbByIdsRpcResponse) {}
13 - rpc GetAllTestExampleDb (GetAllTestExampleDbRpcRequest) returns (GetAllTestExampleDbRpcResponse) {}
14 - rpc QueryTestExampleDbByCondition (QueryTestExampleDbByConditionRpcRequest) returns (QueryTestExampleDbByConditionRpcResponse) {}
15 - rpc QueryTestExampleDbByPagination (QueryTestExampleDbByPaginationRpcRequest) returns (QueryTestExampleDbByPaginationRpcResponse) {}
16 - rpc CreateTestExampleDb (CreateTestExampleDbRpcRequest) returns (CreateTestExampleDbRpcResponse) {}
17 - rpc BatchCreateTestExampleDb (BatchCreateTestExampleDbRpcRequest) returns (BatchCreateTestExampleDbRpcResponse) {}
18 - rpc UpdateTestExampleDb (UpdateTestExampleDbRpcRequest) returns (UpdateTestExampleDbRpcResponse) {}
19 - rpc BatchUpdateTestExampleDb (BatchUpdateTestExampleDbRpcRequest) returns (BatchUpdateTestExampleDbRpcResponse) {}
20 - rpc DeleteTestExampleDbByIds (DeleteTestExampleDbByIdsRpcRequest) returns (DeleteTestExampleDbRpcResponse) {}
21 -}
22 -
23 -enum TestExampleDbStatusEnum {
24 - STATUS_UNKNOWN = 0;
25 - STATUS_ENABLED = 1;
26 - STATUS_DISABLED = 2;
27 -}
28 -
29 -message SingleTestExampleDbRpcResponse {
30 - int32 id = 1;
31 - int32 enterpriseId = 2;
32 - string name = 3;
33 - TestExampleDbStatusEnum status = 4;
34 - int32 createdBy = 5;
35 - int64 createdAt = 6;
36 - int32 creationSource = 7;
37 - int32 updatedBy = 8;
38 - int64 updatedAt = 9;
39 - int32 updateSource = 10;
40 - bool isDeleted = 11;
41 -}
42 -
43 -message GetTestExampleDbByIdRpcRequest {
44 - int32 id = 1;
45 -}
46 -
47 -message GetTestExampleDbByIdRpcResponse {
48 - SingleTestExampleDbRpcResponse response = 1;
49 -}
50 -
51 -message GetTestExampleDbByIdsRpcRequest {
52 - repeated int32 ids = 1;
53 -}
54 -
55 -message GetTestExampleDbByIdsRpcResponse {
56 - repeated SingleTestExampleDbRpcResponse responses = 1;
57 -}
58 -
59 -message GetAllTestExampleDbRpcRequest {
60 -}
61 -
62 -message GetAllTestExampleDbRpcResponse {
63 - repeated SingleTestExampleDbRpcResponse responses = 1;
64 -}
65 -
66 -message QueryTestExampleDbByConditionRpcRequest {
67 - optional string name = 1;
68 - optional TestExampleDbStatusEnum status = 2;
69 -}
70 -
71 -message QueryTestExampleDbByConditionRpcResponse {
72 - repeated SingleTestExampleDbRpcResponse responses = 1;
73 -}
74 -
75 -message QueryTestExampleDbByPaginationRpcRequest {
76 - optional string name = 1;
77 - optional TestExampleDbStatusEnum status = 2;
78 - int32 pageNo = 3;
79 - int32 pageSize = 4;
80 -}
81 -
82 -message QueryTestExampleDbByPaginationRpcResponse {
83 - int64 total = 1;
84 - int64 pages = 2;
85 - repeated SingleTestExampleDbRpcResponse responses = 3;
86 -}
87 -
88 -message TestExampleDbCreation{
89 - string name = 1;
90 - TestExampleDbStatusEnum status = 2;
91 -}
92 -
93 -message CreateTestExampleDbRpcRequest {
94 - TestExampleDbCreation creation = 1;
95 -}
96 -
97 -message CreateTestExampleDbRpcResponse {
98 - int32 id = 1;
99 - bool isCreated = 2;
100 -}
101 -
102 -message BatchCreateTestExampleDbRpcRequest {
103 - repeated TestExampleDbCreation creations = 1;
104 -}
105 -
106 -message BatchCreateTestExampleDbRpcResponse {
107 - repeated int32 ids = 1;
108 - bool isCreated = 2;
109 -}
110 -
111 -message TestExampleDbModification {
112 - int32 id = 1;
113 - optional string name = 2;
114 - optional TestExampleDbStatusEnum status = 3;
115 -}
116 -
117 -message UpdateTestExampleDbRpcRequest {
118 - TestExampleDbModification modification = 1;
119 -}
120 -
121 -message UpdateTestExampleDbRpcResponse {
122 - bool isUpdated = 1;
123 -}
124 -
125 -message BatchUpdateTestExampleDbRpcRequest {
126 - repeated TestExampleDbModification modifications = 1;
127 -}
128 -
129 -message BatchUpdateTestExampleDbRpcResponse {
130 - bool isUpdated = 1;
131 -}
132 -
133 -message DeleteTestExampleDbByIdsRpcRequest {
134 - repeated int32 ids = 1;
135 -}
136 -
137 -message DeleteTestExampleDbRpcResponse {
138 - bool isDeleted = 1;
139 -}
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.TestExampleDbMapper">
6 -
7 - <resultMap id="BaseResultMap" type="com.tianting.infoloop.model.db.TestExampleDb">
8 - <id property="id" column="id" jdbcType="INTEGER"/>
9 - <id property="enterpriseId" column="enterpriseId" jdbcType="INTEGER"/>
10 - <result property="name" column="name" jdbcType="VARCHAR"/>
11 - <result property="status" column="status" jdbcType="TINYINT"/>
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 - <result property="updatedBy" column="updatedBy" jdbcType="INTEGER"/>
16 - <result property="updatedAt" column="updatedAt" jdbcType="TIMESTAMP"/>
17 - <result property="updateSource" column="updateSource" jdbcType="INTEGER"/>
18 - <result property="isDeleted" column="isDeleted" jdbcType="TINYINT"/>
19 - </resultMap>
20 -
21 - <sql id="Base_Column_List">
22 - id,enterpriseId,name,status,
23 - createdBy,createdAt,creationSource,
24 - updatedBy,updatedAt,updateSource,
25 - isDeleted
26 - </sql>
27 -
28 -</mapper>