Commit 83c16e89 by huangjinxin

fix:调整用户组织关联id

1 parent 6e37c205
...@@ -2,21 +2,33 @@ package com.dituhui.pea.user.entity; ...@@ -2,21 +2,33 @@ package com.dituhui.pea.user.entity;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*; import javax.persistence.*;
import java.time.LocalDateTime; import java.util.Date;
@Entity @Entity
@Table(name = "sys_user_org") @Table(name = "sys_user_org")
@Data @Data
@Accessors(chain = true) // @Accessors(chain = true)
@EntityListeners(AuditingEntityListener.class)
public class UserOrgEntity { public class UserOrgEntity {
private static final long serialVersionUID = 595672847439664430L;
/**
* 主键
*/
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(generator = "uuid")
private Integer id; @GenericGenerator(name = "uuid", strategy = "uuid")
@Column(name = "ID", unique = true, nullable = false, length = 32)
private String id;
@Column(name = "user_id", nullable = false, unique = true) // @Column(name = "user_id", nullable = false, unique = true)
@Column(name = "user_id", nullable = false)
private String userId; private String userId;
@Column(name = "org_id", nullable = false) @Column(name = "org_id", nullable = false)
...@@ -27,10 +39,26 @@ public class UserOrgEntity { ...@@ -27,10 +39,26 @@ public class UserOrgEntity {
*/ */
@Column(name = "org_level", nullable = false) @Column(name = "org_level", nullable = false)
private Integer orgLevel; private Integer orgLevel;
/**
@Column(name = "create_time", nullable = false, updatable = false, columnDefinition = "timestamp default current_timestamp") * 创建人
private LocalDateTime createTime; */
@Column(name = "CREATED_BY")
@Column(name = "update_time", nullable = false, columnDefinition = "timestamp default current_timestamp on update current_timestamp") private String createdBy;
private LocalDateTime updateTime; /**
* 创建时间
*/
@Column(name = "create_time")
@CreatedDate
private Date createdTime;
/**
* 更新人
*/
@Column(name = "UPDATED_BY")
private String updatedBy;
/**
* 更新时间
*/
@Column(name = "update_time")
@LastModifiedDate
private Date updatedTime;
} }
...@@ -475,6 +475,7 @@ public class UserService { ...@@ -475,6 +475,7 @@ public class UserService {
UserRoleEntity userRoleEntity = new UserRoleEntity(); UserRoleEntity userRoleEntity = new UserRoleEntity();
userRoleEntity.setUserId(userInfo.getId()); userRoleEntity.setUserId(userInfo.getId());
userRoleEntity.setRoleId(roleId); userRoleEntity.setRoleId(roleId);
userRoleEntity.setCreatedBy(userInfo.getCreatedBy());
userRoleDao.save(userRoleEntity); userRoleDao.save(userRoleEntity);
} }
} }
...@@ -492,6 +493,7 @@ public class UserService { ...@@ -492,6 +493,7 @@ public class UserService {
UserOrgEntity userOrgEntity = new UserOrgEntity(); UserOrgEntity userOrgEntity = new UserOrgEntity();
userOrgEntity.setUserId(userInfo.getId()); userOrgEntity.setUserId(userInfo.getId());
userOrgEntity.setOrgId(orgId); userOrgEntity.setOrgId(orgId);
userOrgEntity.setCreatedBy(userInfo.getCreatedBy());
userOrgEntity.setOrgLevel(userInfo.getOrgLevel()); userOrgEntity.setOrgLevel(userInfo.getOrgLevel());
userOrgDao.save(userOrgEntity); userOrgDao.save(userOrgEntity);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!