Toggle navigation
Toggle navigation
This project
Loading...
Sign in
jiujian
/
client-customer-order-service
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhuyifan
2024-11-13 09:48:01 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0ee22213e4f9bff79091dc65c7429aced31306cf
0ee22213
1 parent
fa03d4a8
删除test
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
0 additions
and
375 deletions
src/main/java/com/tianting/infoloop/mapper/TestExampleDbMapper.java
src/main/java/com/tianting/infoloop/model/db/TestExampleDb.java
src/main/java/com/tianting/infoloop/service/TestExampleDbService.java
src/main/java/com/tianting/infoloop/service/grpc/ExampleGrpcService.java
src/main/java/com/tianting/infoloop/service/impl/TestExampleDbServiceImpl.java
src/main/proto/ExampleService.proto
src/main/resources/mapper/TestExampleDbMapper.xml
src/main/java/com/tianting/infoloop/mapper/TestExampleDbMapper.java
deleted
100644 → 0
View file @
fa03d4a
package
com
.
tianting
.
infoloop
.
mapper
;
import
com.tianting.infoloop.inject.MyBaseMapper
;
import
com.tianting.infoloop.model.db.TestExampleDb
;
public
interface
TestExampleDbMapper
extends
MyBaseMapper
<
TestExampleDb
>
{
}
src/main/java/com/tianting/infoloop/model/db/TestExampleDb.java
deleted
100644 → 0
View file @
fa03d4a
package
com
.
tianting
.
infoloop
.
model
.
db
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableLogic
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
* 例子DB
* @TableName test_example_db
*/
@Data
@Accessors
(
chain
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
value
=
"test_example_db"
)
public
class
TestExampleDb
extends
Model
<
TestExampleDb
>
implements
Serializable
{
/**
*
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 企业 ID
*/
private
Integer
enterpriseId
;
/**
* 用户昵称
*/
private
String
name
;
/**
* 用户状态;启用:1;停用:2
*/
private
Integer
status
;
/**
* 创建人 ID
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Integer
createdBy
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
LocalDateTime
createdAt
;
/**
* 创建来源
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Integer
creationSource
;
/**
* 修改人 ID
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Integer
updatedBy
;
/**
* 修改时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
LocalDateTime
updatedAt
;
/**
* 修改来源
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Integer
updateSource
;
/**
* 是否删除;0:未删除,1:已删除
*/
@TableLogic
private
Boolean
isDeleted
;
}
\ No newline at end of file
src/main/java/com/tianting/infoloop/service/TestExampleDbService.java
deleted
100644 → 0
View file @
fa03d4a
package
com
.
tianting
.
infoloop
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.tianting.infoloop.grpc.exampleservice.TestExampleDbCreation
;
import
com.tianting.infoloop.grpc.exampleservice.TestExampleDbModification
;
import
com.tianting.infoloop.model.db.TestExampleDb
;
import
java.util.List
;
/**
* @author zhuyf
* @description 针对表【 test_example_db(例子DB)】的数据库操作Service
* @createDate 2024-10-12 13:53:16
*/
public
interface
TestExampleDbService
extends
IService
<
TestExampleDb
>
{
TestExampleDb
createTestExampleDb
(
TestExampleDbCreation
creation
);
List
<
TestExampleDb
>
batchCreateTestExampleDb
(
List
<
TestExampleDbCreation
>
creationsList
);
boolean
updateTestExampleDb
(
TestExampleDbModification
modification
);
boolean
batchUpdateTestExampleDb
(
List
<
TestExampleDbModification
>
modificationsList
);
}
src/main/java/com/tianting/infoloop/service/grpc/ExampleGrpcService.java
deleted
100644 → 0
View file @
fa03d4a
This diff is collapsed. Click to expand it.
src/main/java/com/tianting/infoloop/service/impl/TestExampleDbServiceImpl.java
deleted
100644 → 0
View file @
fa03d4a
package
com
.
tianting
.
infoloop
.
service
.
impl
;
import
cn.hutool.extra.spring.SpringUtil
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.tianting.infoloop.grpc.exampleservice.TestExampleDbCreation
;
import
com.tianting.infoloop.grpc.exampleservice.TestExampleDbModification
;
import
com.tianting.infoloop.mapper.TestExampleDbMapper
;
import
com.tianting.infoloop.model.db.TestExampleDb
;
import
com.tianting.infoloop.service.TestExampleDbService
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.lang.Nullable
;
import
org.springframework.stereotype.Service
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author zhuyf
* @description 针对表【 test_example_db(例子DB)】的数据库操作Service实现
* @createDate 2024-10-12 13:53:16
*/
@Slf4j
@Service
@RequiredArgsConstructor
(
onConstructor_
=
@Autowired
)
public
class
TestExampleDbServiceImpl
extends
ServiceImpl
<
TestExampleDbMapper
,
TestExampleDb
>
implements
TestExampleDbService
{
private
final
TestExampleDbMapper
testExampleDbMapper
;
@Override
@Nullable
public
TestExampleDb
createTestExampleDb
(
TestExampleDbCreation
creation
)
{
TestExampleDb
testExampleDb
=
new
TestExampleDb
();
testExampleDb
.
setName
(
creation
.
getName
());
testExampleDb
.
setStatus
(
creation
.
getStatusValue
());
final
var
insert
=
testExampleDbMapper
.
insert
(
testExampleDb
);
return
insert
>
0
?
testExampleDb
:
null
;
}
@Override
public
List
<
TestExampleDb
>
batchCreateTestExampleDb
(
List
<
TestExampleDbCreation
>
creationsList
)
{
var
list
=
creationsList
.
stream
().
map
(
creation
->
new
TestExampleDb
()
.
setName
(
creation
.
getName
())
.
setStatus
(
creation
.
getStatusValue
())).
collect
(
Collectors
.
toList
());
return
SpringUtil
.
getBean
(
TestExampleDbServiceImpl
.
class
).
saveBatch
(
list
)
?
list
:
Collections
.
emptyList
();
}
@Override
public
boolean
updateTestExampleDb
(
TestExampleDbModification
modification
)
{
var
testExampleDb
=
new
TestExampleDb
();
testExampleDb
.
setId
(
modification
.
getId
());
if
(
modification
.
hasName
())
{
testExampleDb
.
setName
(
modification
.
getName
());
}
if
(
modification
.
hasStatus
())
{
testExampleDb
.
setStatus
(
modification
.
getStatusValue
());
}
return
testExampleDbMapper
.
updateById
(
testExampleDb
)
>
0
;
}
@Override
public
boolean
batchUpdateTestExampleDb
(
List
<
TestExampleDbModification
>
modificationsList
)
{
final
var
list
=
modificationsList
.
stream
().
map
(
modification
->
{
var
testExampleDb
=
new
TestExampleDb
();
testExampleDb
.
setId
(
modification
.
getId
());
if
(
modification
.
hasName
())
{
testExampleDb
.
setName
(
modification
.
getName
());
}
if
(
modification
.
hasStatus
())
{
testExampleDb
.
setStatus
(
modification
.
getStatusValue
());
}
return
testExampleDb
;
}).
collect
(
Collectors
.
toList
());
return
SpringUtil
.
getBean
(
TestExampleDbServiceImpl
.
class
).
updateBatchById
(
list
);
}
}
src/main/proto/ExampleService.proto
deleted
100644 → 0
View file @
fa03d4a
syntax
=
"proto3"
;
option
java_multiple_files
=
true
;
option
java_package
=
"com.tianting.infoloop.grpc.exampleservice"
;
option
java_outer_classname
=
"ExampleServiceProto"
;
option
objc_class_prefix
=
"OP"
;
package
com
.
tianting.infoloop.grpc.exampleservice
;
service
ExampleServiceRpc
{
rpc
GetTestExampleDbById
(
GetTestExampleDbByIdRpcRequest
)
returns
(
GetTestExampleDbByIdRpcResponse
)
{}
rpc
GetTestExampleDbByIds
(
GetTestExampleDbByIdsRpcRequest
)
returns
(
GetTestExampleDbByIdsRpcResponse
)
{}
rpc
GetAllTestExampleDb
(
GetAllTestExampleDbRpcRequest
)
returns
(
GetAllTestExampleDbRpcResponse
)
{}
rpc
QueryTestExampleDbByCondition
(
QueryTestExampleDbByConditionRpcRequest
)
returns
(
QueryTestExampleDbByConditionRpcResponse
)
{}
rpc
QueryTestExampleDbByPagination
(
QueryTestExampleDbByPaginationRpcRequest
)
returns
(
QueryTestExampleDbByPaginationRpcResponse
)
{}
rpc
CreateTestExampleDb
(
CreateTestExampleDbRpcRequest
)
returns
(
CreateTestExampleDbRpcResponse
)
{}
rpc
BatchCreateTestExampleDb
(
BatchCreateTestExampleDbRpcRequest
)
returns
(
BatchCreateTestExampleDbRpcResponse
)
{}
rpc
UpdateTestExampleDb
(
UpdateTestExampleDbRpcRequest
)
returns
(
UpdateTestExampleDbRpcResponse
)
{}
rpc
BatchUpdateTestExampleDb
(
BatchUpdateTestExampleDbRpcRequest
)
returns
(
BatchUpdateTestExampleDbRpcResponse
)
{}
rpc
DeleteTestExampleDbByIds
(
DeleteTestExampleDbByIdsRpcRequest
)
returns
(
DeleteTestExampleDbRpcResponse
)
{}
}
enum
TestExampleDbStatusEnum
{
STATUS_UNKNOWN
=
0
;
STATUS_ENABLED
=
1
;
STATUS_DISABLED
=
2
;
}
message
SingleTestExampleDbRpcResponse
{
int32
id
=
1
;
int32
enterpriseId
=
2
;
string
name
=
3
;
TestExampleDbStatusEnum
status
=
4
;
int32
createdBy
=
5
;
int64
createdAt
=
6
;
int32
creationSource
=
7
;
int32
updatedBy
=
8
;
int64
updatedAt
=
9
;
int32
updateSource
=
10
;
bool
isDeleted
=
11
;
}
message
GetTestExampleDbByIdRpcRequest
{
int32
id
=
1
;
}
message
GetTestExampleDbByIdRpcResponse
{
SingleTestExampleDbRpcResponse
response
=
1
;
}
message
GetTestExampleDbByIdsRpcRequest
{
repeated
int32
ids
=
1
;
}
message
GetTestExampleDbByIdsRpcResponse
{
repeated
SingleTestExampleDbRpcResponse
responses
=
1
;
}
message
GetAllTestExampleDbRpcRequest
{
}
message
GetAllTestExampleDbRpcResponse
{
repeated
SingleTestExampleDbRpcResponse
responses
=
1
;
}
message
QueryTestExampleDbByConditionRpcRequest
{
optional
string
name
=
1
;
optional
TestExampleDbStatusEnum
status
=
2
;
}
message
QueryTestExampleDbByConditionRpcResponse
{
repeated
SingleTestExampleDbRpcResponse
responses
=
1
;
}
message
QueryTestExampleDbByPaginationRpcRequest
{
optional
string
name
=
1
;
optional
TestExampleDbStatusEnum
status
=
2
;
int32
pageNo
=
3
;
int32
pageSize
=
4
;
}
message
QueryTestExampleDbByPaginationRpcResponse
{
int64
total
=
1
;
int64
pages
=
2
;
repeated
SingleTestExampleDbRpcResponse
responses
=
3
;
}
message
TestExampleDbCreation
{
string
name
=
1
;
TestExampleDbStatusEnum
status
=
2
;
}
message
CreateTestExampleDbRpcRequest
{
TestExampleDbCreation
creation
=
1
;
}
message
CreateTestExampleDbRpcResponse
{
int32
id
=
1
;
bool
isCreated
=
2
;
}
message
BatchCreateTestExampleDbRpcRequest
{
repeated
TestExampleDbCreation
creations
=
1
;
}
message
BatchCreateTestExampleDbRpcResponse
{
repeated
int32
ids
=
1
;
bool
isCreated
=
2
;
}
message
TestExampleDbModification
{
int32
id
=
1
;
optional
string
name
=
2
;
optional
TestExampleDbStatusEnum
status
=
3
;
}
message
UpdateTestExampleDbRpcRequest
{
TestExampleDbModification
modification
=
1
;
}
message
UpdateTestExampleDbRpcResponse
{
bool
isUpdated
=
1
;
}
message
BatchUpdateTestExampleDbRpcRequest
{
repeated
TestExampleDbModification
modifications
=
1
;
}
message
BatchUpdateTestExampleDbRpcResponse
{
bool
isUpdated
=
1
;
}
message
DeleteTestExampleDbByIdsRpcRequest
{
repeated
int32
ids
=
1
;
}
message
DeleteTestExampleDbRpcResponse
{
bool
isDeleted
=
1
;
}
src/main/resources/mapper/TestExampleDbMapper.xml
deleted
100644 → 0
View file @
fa03d4a
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.tianting.infoloop.mapper.TestExampleDbMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.tianting.infoloop.model.db.TestExampleDb"
>
<id
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<id
property=
"enterpriseId"
column=
"enterpriseId"
jdbcType=
"INTEGER"
/>
<result
property=
"name"
column=
"name"
jdbcType=
"VARCHAR"
/>
<result
property=
"status"
column=
"status"
jdbcType=
"TINYINT"
/>
<result
property=
"createdBy"
column=
"createdBy"
jdbcType=
"INTEGER"
/>
<result
property=
"createdAt"
column=
"createdAt"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"creationSource"
column=
"creationSource"
jdbcType=
"INTEGER"
/>
<result
property=
"updatedBy"
column=
"updatedBy"
jdbcType=
"INTEGER"
/>
<result
property=
"updatedAt"
column=
"updatedAt"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateSource"
column=
"updateSource"
jdbcType=
"INTEGER"
/>
<result
property=
"isDeleted"
column=
"isDeleted"
jdbcType=
"TINYINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id,enterpriseId,name,status,
createdBy,createdAt,creationSource,
updatedBy,updatedAt,updateSource,
isDeleted
</sql>
</mapper>
Please
register
or
login
to post a comment