角色和用户对内置属性进行开发
This commit is contained in:
parent
e7012cb467
commit
0626b9c47d
|
|
@ -68,6 +68,9 @@ public class SysRole extends BaseEntity
|
|||
/** 角色菜单权限 */
|
||||
private Set<String> permissions;
|
||||
|
||||
/**是否内置,0内置,1非内置*/
|
||||
private String isBuiltIn;
|
||||
|
||||
public SysRole()
|
||||
{
|
||||
|
||||
|
|
@ -242,4 +245,12 @@ public class SysRole extends BaseEntity
|
|||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String getIsBuiltIn() {
|
||||
return isBuiltIn;
|
||||
}
|
||||
|
||||
public void setIsBuiltIn(String isBuiltIn) {
|
||||
this.isBuiltIn = isBuiltIn;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,6 +143,9 @@ public class SysUser extends BaseEntity {
|
|||
*/
|
||||
private String isPermanent;
|
||||
|
||||
/**是否内置,0内置,1非内置*/
|
||||
private String isBuiltIn = "1";
|
||||
|
||||
public SysUser() {
|
||||
|
||||
}
|
||||
|
|
@ -361,4 +364,12 @@ public class SysUser extends BaseEntity {
|
|||
.append("loginType", getLoginType())
|
||||
.toString();
|
||||
}
|
||||
|
||||
public String getIsBuiltIn() {
|
||||
return isBuiltIn;
|
||||
}
|
||||
|
||||
public void setIsBuiltIn(String isBuiltIn) {
|
||||
this.isBuiltIn = isBuiltIn;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.system.controller;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
|
|
@ -106,6 +107,8 @@ public class SysRoleController extends BaseController
|
|||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}else if (Objects.equals(role.getIsBuiltIn(), "0")) {
|
||||
return error("内置角色不允许增加");
|
||||
}
|
||||
role.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
|
@ -129,6 +132,8 @@ public class SysRoleController extends BaseController
|
|||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
} else if (!roleService.checkRoleKeyUnique(role)) {
|
||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}else if (Objects.equals(role.getIsBuiltIn(), "0")) {
|
||||
return error("内置角色不允许修改");
|
||||
}
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(roleService.updateRole(role));
|
||||
|
|
|
|||
|
|
@ -300,6 +300,8 @@ public class SysUserController extends BaseController {
|
|||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
} else if (Objects.equals(user.getIsBuiltIn(), "0")){
|
||||
return error("内置用户不允许添加");
|
||||
}
|
||||
/*String pwd = ValidateUtils.isPwd(user.getPassword());
|
||||
if (StringUtils.isNotEmpty(pwd)) {
|
||||
|
|
@ -337,6 +339,8 @@ public class SysUserController extends BaseController {
|
|||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
|
||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}else if (Objects.equals(user.getIsBuiltIn(), "0")){
|
||||
return error("内置用户不允许修改");
|
||||
}
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import javax.annotation.Resource;
|
|||
import javax.validation.Validator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -19,11 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="isBuiltIn" column="is_built_in"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectRoleVo">
|
||||
select distinct r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.menu_check_strictly, r.dept_check_strictly,
|
||||
r.status, r.del_flag, r.create_time, r.remark
|
||||
r.status, r.del_flag, r.create_time, r.remark, r.is_built_in
|
||||
from sys_role r
|
||||
left join sys_user_role ur on ur.role_id = r.role_id
|
||||
left join sys_user u on u.user_id = ur.user_id
|
||||
|
|
@ -105,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="isBuiltIn != null and isBuiltIn!=''">is_built_in,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="roleId != null and roleId != 0">#{roleId},</if>
|
||||
|
|
@ -117,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="isBuiltIn != null and isBuiltIn!=''">#{isBuiltIn},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
|
@ -133,6 +136,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="status != null and status != ''">status = #{status},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="isBuiltIn != null and isBuiltIn!=''">is_built_in = #{isBuiltIn},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where role_id = #{roleId}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
<result property="loginType" column="login_type"/>
|
||||
<result property="approvalStatus" column="approval_status"/>
|
||||
<result property="isPermanent" column="is_permanent"/>
|
||||
<result property="isBuiltIn" column="is_built_in"/>
|
||||
<association property="dept" javaType="SysDept" resultMap="deptResult"/>
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult"/>
|
||||
|
||||
|
|
@ -82,7 +83,8 @@
|
|||
r.role_sort,
|
||||
r.data_scope,
|
||||
r.status as role_status,
|
||||
u.login_type
|
||||
u.login_type,
|
||||
u.is_built_in
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
|
|
@ -91,7 +93,7 @@
|
|||
|
||||
<select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber,u.sex, u.status,
|
||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.approval_status,u.is_permanent, d.dept_name,
|
||||
u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,u.approval_status,u.is_permanent,u.is_built_in, d.dept_name,
|
||||
d.leader from sys_user
|
||||
u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
|
|
@ -123,7 +125,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time,u.is_built_in
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
|
|
@ -140,7 +142,7 @@
|
|||
</select>
|
||||
|
||||
<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time
|
||||
select distinct u.user_id, u.dept_id, u.user_name, u.nick_name, u.email, u.phonenumber, u.status, u.create_time,u.is_built_in,
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
|
|
@ -221,6 +223,7 @@
|
|||
<if test="loginType != null and loginType!=''">login_type,</if>
|
||||
<if test="approvalStatus != null and approvalStatus!=''">approval_status,</if>
|
||||
<if test="isPermanent != null and isPermanent!=''">is_permanent,</if>
|
||||
<if test="isBuiltIn != null and isBuiltIn!=''">is_built_in,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="userId != null and userId != ''">#{userId},</if>
|
||||
|
|
@ -238,6 +241,7 @@
|
|||
<if test="loginType != null and loginType!=''">#{loginType},</if>
|
||||
<if test="approvalStatus != null and approvalStatus!=''">#{approvalStatus},</if>
|
||||
<if test="isPermanent != null and isPermanent!=''">#{isPermanent},</if>
|
||||
<if test="isBuiltIn != null and isBuiltIn!=''">#{isBuiltIn},</if>
|
||||
sysdate()
|
||||
)
|
||||
</insert>
|
||||
|
|
@ -260,6 +264,7 @@
|
|||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="loginType != null and loginType!=''">login_type = #{loginType},</if>
|
||||
<if test="isPermanent != null and isPermanent!=''">is_permanent = #{isPermanent},</if>
|
||||
<if test="isBuiltIn != null and isBuiltIn!=''">is_built_in = #{isBuiltIn},</if>
|
||||
update_time = sysdate()
|
||||
</set>
|
||||
where user_id = #{userId}
|
||||
|
|
|
|||
Loading…
Reference in New Issue