Commit cea6e6e4 by chamberone

Merge branch 'develop' of https://zhangguoping@gitlab.dituhui.com/bsh/project/pr…

…oject.git into develop
2 parents 5001a815 090b3e10
......@@ -122,4 +122,9 @@ public class UserInfoSearch extends PageRequest implements Serializable {
*/
private String notes;
/**
* 是否正常 0: 否 1:是 默认1
*/
private Integer status = 1;
}
......@@ -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);
}
......@@ -700,7 +702,7 @@ public class UserService {
entityManager.clear();
PageResult<UserInfoSearch> pageResult = new PageResult<>();
String count = "select count(*) ";
String select = "SELECT su.*,sr.name roleName ";
String select = "SELECT su.*,sr.name roleName ,sr.id roleId ";
String limit = " ORDER BY su.CREATED_TIME DESC limit " + (search.getPage() - 1) * search.getSize() + "," + search.getSize();
StringBuffer querySql = new StringBuffer("from sys_user su left join sys_user_role sur on su.id =sur.user_id left JOIN sys_role sr on sr.id =sur.role_id left join sys_user_org suo on su.id=suo.user_id where 1=1 ");
if (StringUtils.isNotBlank(search.getRoleId())) {
......@@ -752,10 +754,12 @@ public class UserService {
search.setNickname(map.containsKey("nickname") && ObjectUtil.isNotEmpty(map.get("nickname")) ? map.get("nickname").toString() : null);
search.setBan(map.containsKey("ban") && ObjectUtil.isNotEmpty(map.get("ban")) ? Integer.parseInt(map.get("ban").toString()) : null);
search.setSource(map.containsKey("source") && ObjectUtil.isNotEmpty(map.get("source")) ? Integer.parseInt(map.get("source").toString()) : null);
search.setStatus(map.containsKey("status") && ObjectUtil.isNotEmpty(map.get("status")) ? Integer.parseInt(map.get("status").toString()) : null);
search.setEmail(map.containsKey("email") && ObjectUtil.isNotEmpty(map.get("email")) ? map.get("email").toString() : null);
search.setPhone(map.containsKey("phone") && ObjectUtil.isNotEmpty(map.get("phone")) ? map.get("phone").toString() : null);
search.setEngineerCode(map.containsKey("engineer_code") && ObjectUtil.isNotEmpty(map.get("engineer_code")) ? map.get("engineer_code").toString() : null);
search.setRoleName(map.containsKey("roleName") && ObjectUtil.isNotEmpty(map.get("roleName")) ? map.get("roleName").toString() : null);
search.setRoleId(map.containsKey("roleId") && ObjectUtil.isNotEmpty(map.get("roleId")) ? map.get("roleId").toString() : null);
search.setBan(map.containsKey("ban") && ObjectUtil.isNotEmpty(map.get("ban")) ? Integer.parseInt(map.get("ban").toString()) : null);
search.setCreatedBy(map.containsKey("CREATED_BY") && ObjectUtil.isNotEmpty(map.get("CREATED_BY")) ? map.get("CREATED_BY").toString() : null);
search.setUpdatedBy(map.containsKey("UPDATED_BY") && ObjectUtil.isNotEmpty(map.get("UPDATED_BY")) ? map.get("UPDATED_BY").toString() : null);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!