Skip to content

Commit

Permalink
创建新实体时,只在CreatedBy为空时才自动设置为当前登录用户
Browse files Browse the repository at this point in the history
  • Loading branch information
phoenix committed Jul 12, 2015
1 parent 8c07f18 commit 365965f
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ public <S extends T> S save(S entity) {
if (entity instanceof Auditable) {
Auditable auditEntity = (Auditable) entity;
if (auditEntity.isNew()) {
auditEntity.setCreatedBy(ContextHolderUtils.getCurrentUser());
if(auditEntity.getCreatedBy() == null){
auditEntity.setCreatedBy(ContextHolderUtils.getCurrentUser());
}
auditEntity.setCreatedDate(new Date());
} else {
if (auditEntity.getCreatedDate() == null) {//可能没有将数据库中的audit信息赋值给要入库的对象
Expand Down

0 comments on commit 365965f

Please sign in to comment.