Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yd-csf
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xingmin
yd-csf
Commits
456044a6
Commit
456044a6
authored
Mar 12, 2026
by
zhangxingmin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
push
parent
105ba38a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
11 deletions
+21
-11
yd-csf-service/src/main/java/com/yd/csf/service/config/CsfMybatisPlusConfig.java
+17
-4
yd-csf-service/src/main/java/com/yd/csf/service/model/Appointment.java
+4
-7
No files found.
yd-csf-service/src/main/java/com/yd/csf/service/config/CsfMybatisPlusConfig.java
View file @
456044a6
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.DbType;
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.DbType;
import
com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
;
import
com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
com.yd.auth.core.dto.AuthUserDto
;
import
com.yd.auth.core.utils.SecurityUtil
;
import
org.apache.ibatis.reflection.MetaObject
;
import
org.apache.ibatis.reflection.MetaObject
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -25,7 +27,7 @@ public class CsfMybatisPlusConfig {
...
@@ -25,7 +27,7 @@ public class CsfMybatisPlusConfig {
}
}
/**
/**
* 自动填充字段配置(如创建
时间、更新时间
)
* 自动填充字段配置(如创建
人、更新人等
)
*/
*/
@Bean
@Bean
public
MetaObjectHandler
metaObjectHandler
()
{
public
MetaObjectHandler
metaObjectHandler
()
{
...
@@ -33,13 +35,24 @@ public class CsfMybatisPlusConfig {
...
@@ -33,13 +35,24 @@ public class CsfMybatisPlusConfig {
@Override
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
public
void
insertFill
(
MetaObject
metaObject
)
{
//获取Security上下文当前用户的登录信息
this
.
strictInsertFill
(
metaObject
,
"createTime"
,
LocalDateTime
.
class
,
LocalDateTime
.
now
());
AuthUserDto
authUserDto
=
SecurityUtil
.
getCurrentLoginUser
();
if
(
authUserDto
!=
null
)
{
//自动注入创建人和创建用户名
this
.
strictInsertFill
(
metaObject
,
"creatorId"
,
String
.
class
,
authUserDto
.
getUserBizId
());
this
.
strictInsertFill
(
metaObject
,
"creatorName"
,
String
.
class
,
authUserDto
.
getUsername
());
}
}
}
@Override
@Override
public
void
updateFill
(
MetaObject
metaObject
)
{
public
void
updateFill
(
MetaObject
metaObject
)
{
this
.
strictUpdateFill
(
metaObject
,
"updateTime"
,
LocalDateTime
.
class
,
LocalDateTime
.
now
());
//获取Security上下文当前用户的登录信息
AuthUserDto
authUserDto
=
SecurityUtil
.
getCurrentLoginUser
();
if
(
authUserDto
!=
null
)
{
//自动注入更新人和更新用户名
this
.
strictInsertFill
(
metaObject
,
"updaterId"
,
String
.
class
,
authUserDto
.
getUserBizId
());
this
.
strictInsertFill
(
metaObject
,
"updaterName"
,
String
.
class
,
authUserDto
.
getUsername
());
}
}
}
};
};
}
}
...
...
yd-csf-service/src/main/java/com/yd/csf/service/model/Appointment.java
View file @
456044a6
package
com
.
yd
.
csf
.
service
.
model
;
package
com
.
yd
.
csf
.
service
.
model
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.*
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.Getter
;
import
lombok.Getter
;
import
lombok.Setter
;
import
lombok.Setter
;
...
@@ -342,19 +339,19 @@ public class Appointment implements Serializable {
...
@@ -342,19 +339,19 @@ public class Appointment implements Serializable {
/**
/**
* 创建人ID
* 创建人ID
*/
*/
@TableField
(
"creator_id"
)
@TableField
(
value
=
"creator_id"
,
fill
=
FieldFill
.
INSERT
)
private
String
creatorId
;
private
String
creatorId
;
/**
/**
* 创建人用户名
* 创建人用户名
*/
*/
@TableField
(
"creator_name"
)
@TableField
(
value
=
"creator_name"
,
fill
=
FieldFill
.
INSERT
)
private
String
creatorName
;
private
String
creatorName
;
/**
/**
* 更新人ID
* 更新人ID
*/
*/
@TableField
(
"updater_id"
)
@TableField
(
value
=
"updater_id"
,
fill
=
FieldFill
.
UPDATE
)
private
String
updaterId
;
private
String
updaterId
;
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment