Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9f5553e6
authored
Oct 07, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:实验代码
1 parent
2acf9bda
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
23 deletions
project-user/src/main/java/com/dituhui/pea/user/entity/RoleEntity.java
project-user/src/main/java/com/dituhui/pea/user/service/RoleService.java
project-user/src/main/java/com/dituhui/pea/user/entity/RoleEntity.java
View file @
9f5553e
...
...
@@ -9,6 +9,7 @@ import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import
javax.persistence.*
;
import
javax.validation.constraints.NotBlank
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
/**
...
...
@@ -54,9 +55,9 @@ public class RoleEntity implements Serializable {
/**
* 创建时间
*/
@Column
(
name
=
"CREATED_TIME"
)
@C
reatedDate
private
Dat
e
createdTime
;
//
@Column(name = "CREATED_TIME")
@C
olumn
(
name
=
"CREATED_TIME"
,
nullable
=
false
,
updatable
=
false
,
columnDefinition
=
"timestamp default current_timestamp"
)
private
LocalDateTim
e
createdTime
;
/**
* 更新人
*/
...
...
@@ -65,9 +66,9 @@ public class RoleEntity implements Serializable {
/**
* 更新时间
*/
@Column
(
name
=
"UPDATED_TIME"
)
@
LastModifiedDate
private
Dat
e
updatedTime
;
//
@Column(name = "UPDATED_TIME")
@
Column
(
name
=
"UPDATED_TIME"
,
nullable
=
false
,
columnDefinition
=
"timestamp default current_timestamp on update current_timestamp"
)
private
LocalDateTim
e
updatedTime
;
/**
* 备注
...
...
project-user/src/main/java/com/dituhui/pea/user/service/RoleService.java
View file @
9f5553e
...
...
@@ -31,6 +31,7 @@ import org.springframework.transaction.TransactionStatus;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.DefaultTransactionDefinition
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
...
...
@@ -63,8 +64,8 @@ public class RoleService {
@Autowired
RedisService
redisService
;
@Autowired
private
DataSourceTransactionManager
dataSourceTransactionManager
;
//
@Autowired
//
private DataSourceTransactionManager dataSourceTransactionManager;
/**
* 失效时间ms
*/
...
...
@@ -79,7 +80,7 @@ public class RoleService {
RoleEntity
roleEntity
=
new
RoleEntity
();
roleEntity
.
setName
(
name
);
roleEntity
.
setCreatedBy
(
createdBy
);
roleEntity
.
setCreatedTime
(
new
Date
());
roleEntity
.
setCreatedTime
(
LocalDateTime
.
now
());
roleEntity
.
setNotes
(
notes
);
// RoleEntity roleEntity = assembleRole(roleInfo);
log
.
info
(
"新增角色入参:"
+
JSONObject
.
toJSONString
(
roleEntity
));
...
...
@@ -133,11 +134,6 @@ public class RoleService {
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
RoleInfo
deleteRole2
(
RoleInfo
roleInfo
)
{
DefaultTransactionDefinition
defaultTransactionDefinition
=
new
DefaultTransactionDefinition
();
defaultTransactionDefinition
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRES_NEW
);
TransactionStatus
transaction
=
dataSourceTransactionManager
.
getTransaction
(
defaultTransactionDefinition
);
String
name
=
roleInfo
.
getName
();
String
createdBy
=
roleInfo
.
getCreatedBy
();
String
notes
=
roleInfo
.
getNotes
();
...
...
@@ -160,15 +156,6 @@ public class RoleService {
}
log
.
info
(
"新增角色信息:"
+
JSONObject
.
toJSONString
(
roleInfo
));
try
{
// 业务代码
// 手动提交事务
dataSourceTransactionManager
.
commit
(
transaction
);
}
catch
(
Exception
e
)
{
// 手动回滚事务
dataSourceTransactionManager
.
rollback
(
transaction
);
}
return
roleInfo
;
}
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment