forked from Gitlink/microservices
feat(用户身份状态管理): 成员移出组织/项目,原指派给这个成员的工作项/其他该怎么显示
1. 用户身份新增状态字段,默认值为normal 2. 新增用户身份状态枚举
This commit is contained in:
parent
5cb8280ad2
commit
e17de7b194
|
|
@ -2,11 +2,11 @@ package com.microservices.system.api.domain;
|
|||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Objects;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("用户与部门及部门对应角色的关联对象")
|
||||
public class SysUserDeptRole {
|
||||
|
||||
|
|
@ -30,6 +30,9 @@ public class SysUserDeptRole {
|
|||
@ApiModelProperty("角色ID")
|
||||
private Long roleId;
|
||||
|
||||
@ApiModelProperty("身份状态")
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
|
|
@ -45,81 +48,4 @@ public class SysUserDeptRole {
|
|||
*/
|
||||
@ApiModelProperty(value = "角色对象", hidden = true)
|
||||
private SysRole sysRole;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
SysUserDeptRole that = (SysUserDeptRole) o;
|
||||
return deptId.equals(that.deptId) && userId.equals(that.userId) && roleId.equals(that.roleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(deptId, userId, roleId);
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
public SysDept getSysDept() {
|
||||
return sysDept;
|
||||
}
|
||||
|
||||
public void setSysDept(SysDept sysDept) {
|
||||
this.sysDept = sysDept;
|
||||
}
|
||||
|
||||
public SysUser getSysUser() {
|
||||
return sysUser;
|
||||
}
|
||||
|
||||
public void setSysUser(SysUser sysUser) {
|
||||
this.sysUser = sysUser;
|
||||
}
|
||||
|
||||
public SysRole getSysRole() {
|
||||
return sysRole;
|
||||
}
|
||||
|
||||
public void setSysRole(SysRole sysRole) {
|
||||
this.sysRole = sysRole;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "SysUserDeptRole{" +
|
||||
"deptId=" + deptId +
|
||||
", userId=" + userId +
|
||||
", roleId=" + roleId +
|
||||
", sysDept=" + sysDept +
|
||||
", sysUser=" + sysUser +
|
||||
", sysRole=" + sysRole +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.microservices.common.core.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 用户身份状态
|
||||
*
|
||||
* @author OTTO
|
||||
*/
|
||||
@Getter
|
||||
public enum UserIdentityStatus {
|
||||
NORMAL("normal", "正常"),
|
||||
QUIT("quit", "已离职");
|
||||
private final String state;
|
||||
private final String info;
|
||||
|
||||
UserIdentityStatus(String state, String info) {
|
||||
this.state = state;
|
||||
this.info = info;
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
<result property="deptId" column="dept_id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="roleId" column="role_id"/>
|
||||
<result property="state" column="state"/>
|
||||
<association property="sysDept" column="dept_id" javaType="com.microservices.system.api.domain.SysDept"
|
||||
resultMap="deptResult"/>
|
||||
<association property="sysRole" column="role_id" javaType="com.microservices.system.api.domain.SysRole"
|
||||
|
|
@ -49,7 +50,7 @@
|
|||
<result property="status" column="role_status"/>
|
||||
</resultMap>
|
||||
<sql id="selectSysUserDeptRoleVo">
|
||||
select dept_id, user_id, role_id
|
||||
select dept_id, user_id, role_id, state
|
||||
from sys_user_dept_role
|
||||
</sql>
|
||||
<sql id="selectSysUserDeptRoleDetailVo">
|
||||
|
|
@ -76,7 +77,8 @@
|
|||
r.role_key,
|
||||
r.role_sort,
|
||||
r.data_scope,
|
||||
r.status as role_status
|
||||
r.status as role_status,
|
||||
udr.state
|
||||
from sys_user_dept_role udr
|
||||
left join sys_dept d on udr.dept_id = d.dept_id
|
||||
left join sys_role r on r.role_id = udr.role_id
|
||||
|
|
@ -91,12 +93,14 @@
|
|||
<if test="deptId != null">and udr.dept_id=#{deptId}</if>
|
||||
<if test="userId != null">and udr.user_id=#{userId}</if>
|
||||
<if test="roleId != null">and udr.role_id=#{roleId}</if>
|
||||
and udr.state = 'normal'
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSysUserDeptRoleByDeptId" parameterType="Long" resultMap="SysUserDeptRoleResult">
|
||||
<include refid="selectSysUserDeptRoleVo"/>
|
||||
where dept_id = #{deptId}
|
||||
and state = 'normal'
|
||||
</select>
|
||||
<select id="selectSysUserDeptRoleListByDeptId" resultMap="SysUserDeptRoleResult">
|
||||
<include refid="selectSysUserDeptRoleDetailVo"/>
|
||||
|
|
@ -134,6 +138,7 @@
|
|||
#{virtualRoleId}
|
||||
</foreach>
|
||||
</if>
|
||||
and udr.state = 'normal'
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectSysUserDeptRoleListByUserId" resultMap="SysUserDeptRoleResult">
|
||||
|
|
@ -149,6 +154,7 @@
|
|||
<if test="roleName != null and roleName != ''">
|
||||
AND r.role_name like concat('%', #{roleName}, '%')
|
||||
</if>
|
||||
and udr.state = 'normal'
|
||||
</where>
|
||||
ORDER BY udr.dept_id
|
||||
</select>
|
||||
|
|
@ -157,6 +163,7 @@
|
|||
<where>
|
||||
u.user_name = #{userName}
|
||||
and u.del_flag = '0'
|
||||
and udr.state = 'normal'
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectSysUserDeptRoleByUserIdAndDeptId"
|
||||
|
|
@ -165,6 +172,7 @@
|
|||
<where>
|
||||
udr.user_id = #{userId}
|
||||
and udr.dept_id = #{deptId}
|
||||
and udr.state = 'normal'
|
||||
</where>
|
||||
</select>
|
||||
<select id="selectSysUserDeptRoleByDeptIdAndRoleId"
|
||||
|
|
@ -173,6 +181,7 @@
|
|||
<where>
|
||||
udr.role_id = #{roleId}
|
||||
and udr.dept_id = #{deptId}
|
||||
and udr.state = 'normal'
|
||||
</where>
|
||||
|
||||
</select>
|
||||
|
|
@ -180,6 +189,7 @@
|
|||
SELECT COUNT(1)
|
||||
FROM sys_user_dept_role
|
||||
WHERE role_id = #{roleId}
|
||||
and state = 'normal'
|
||||
</select>
|
||||
<select id="searchSysUserDeptRoleListByDeptId" resultMap="SysUserDeptRoleResult">
|
||||
<include refid="selectSysUserDeptRoleDetailVo"/>
|
||||
|
|
@ -198,20 +208,23 @@
|
|||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
and udr.state = 'normal'
|
||||
</where>
|
||||
</select>
|
||||
<select id="countUserDeptRole" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*)
|
||||
FROM `sys_user_dept_role` AS sudr
|
||||
LEFT JOIN sys_role AS sr ON sr.role_id = sudr.`role_id`
|
||||
FROM `sys_user_dept_role` AS udr
|
||||
LEFT JOIN sys_role AS sr ON sr.role_id = udr.`role_id`
|
||||
WHERE
|
||||
sr.`role_key` = #{roleKey}
|
||||
AND sudr.user_id = #{userId}
|
||||
AND sudr.dept_id = #{deptId}
|
||||
AND udr.user_id = #{userId}
|
||||
AND udr.dept_id = #{deptId}
|
||||
and udr.state = 'normal'
|
||||
</select>
|
||||
<select id="selectSysUserDeptRoleListByRoleId" resultMap="SysUserDeptRoleResult">
|
||||
<include refid="selectSysUserDeptRoleVo"/>
|
||||
WHERE role_id = #{roleId}
|
||||
and state = 'normal'
|
||||
</select>
|
||||
|
||||
<insert id="insertSysUserDeptRole" parameterType="com.microservices.system.api.domain.SysUserDeptRole">
|
||||
|
|
|
|||
Loading…
Reference in New Issue