Commit 83c16e89 by huangjinxin

fix:调整用户组织关联id

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