系统管理修改
This commit is contained in:
parent
f15e1c9ed8
commit
ce9082e56f
|
|
@ -5,6 +5,7 @@ import java.util.stream.Collectors;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
|
|
@ -53,6 +54,9 @@ public class SysUserController extends BaseController
|
|||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@Value("${app.admin.password}")
|
||||
private String initialPassword;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
|
|
@ -71,6 +75,9 @@ public class SysUserController extends BaseController
|
|||
public void export(HttpServletResponse response, SysUser user)
|
||||
{
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
list.get(i).setSerialNumber(i + 1); // 从1开始
|
||||
}
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
util.exportExcel(response, list, "用户数据");
|
||||
}
|
||||
|
|
@ -124,6 +131,7 @@ public class SysUserController extends BaseController
|
|||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
user.setPassword(initialPassword);
|
||||
deptService.checkDeptDataScope(user.getDeptId());
|
||||
roleService.checkRoleDataScope(user.getRoleIds());
|
||||
if (!userService.checkUserNameUnique(user))
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
aaa.image,
|
||||
aaa.version,
|
||||
aaa.description,
|
||||
aaa.type_id,
|
||||
aaa.type_name,
|
||||
bbb.file_type,
|
||||
bbb.file_path
|
||||
from tb_promotion_material aaa
|
||||
|
|
|
|||
|
|
@ -21,8 +21,20 @@ public class SysUser extends BaseEntity
|
|||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 自增长序号,用于导出 */
|
||||
@Excel(name = "用户序号", type = Type.EXPORT)
|
||||
private Integer serialNumber;
|
||||
|
||||
public Integer getSerialNumber() {
|
||||
return serialNumber;
|
||||
}
|
||||
|
||||
public void setSerialNumber(Integer serialNumber) {
|
||||
this.serialNumber = serialNumber;
|
||||
}
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
// @Excel(name = "用户序号", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "用户编号")
|
||||
private Long userId;
|
||||
|
||||
/** 部门ID */
|
||||
|
|
@ -35,15 +47,15 @@ public class SysUser extends BaseEntity
|
|||
private String isAdmin;
|
||||
|
||||
/** 用户账号 */
|
||||
@Excel(name = "登录名称")
|
||||
@Excel(name = "用户名称")
|
||||
private String userName;
|
||||
|
||||
/** 用户昵称 */
|
||||
@Excel(name = "用户名称")
|
||||
// @Excel(name = "用户名称")
|
||||
private String nickName;
|
||||
|
||||
/** 用户邮箱 */
|
||||
@Excel(name = "用户邮箱")
|
||||
// @Excel(name = "用户邮箱")
|
||||
private String email;
|
||||
|
||||
/** 手机号码 */
|
||||
|
|
@ -51,7 +63,7 @@ public class SysUser extends BaseEntity
|
|||
private String phonenumber;
|
||||
|
||||
/** 用户性别 */
|
||||
@Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
// @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
|
||||
private String sex;
|
||||
|
||||
/** 用户头像 */
|
||||
|
|
@ -94,6 +106,30 @@ public class SysUser extends BaseEntity
|
|||
/** 角色ID */
|
||||
private Long roleId;
|
||||
|
||||
@Excel(name = "角色", type = Type.EXPORT)
|
||||
private String roleName;
|
||||
|
||||
@Excel(name = "职务", type = Type.EXPORT)
|
||||
private String postName;
|
||||
|
||||
public String getPostName() {
|
||||
return postName;
|
||||
}
|
||||
|
||||
public void setPostName(String postName) {
|
||||
this.postName = postName;
|
||||
}
|
||||
|
||||
public String getRoleName() {
|
||||
return roleName;
|
||||
}
|
||||
|
||||
public void setRoleName(String roleName) {
|
||||
this.roleName = roleName;
|
||||
}
|
||||
|
||||
private String deptName;
|
||||
|
||||
public SysUser()
|
||||
{
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ 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="roleName" column="role_name" />
|
||||
<result property="postName" column="post_name" />
|
||||
<association property="dept" javaType="SysDept" resultMap="deptResult" />
|
||||
<collection property="roles" javaType="java.util.List" resultMap="RoleResult" />
|
||||
</resultMap>
|
||||
|
|
@ -58,12 +60,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</sql>
|
||||
|
||||
<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, d.dept_name, d.leader from sys_user u
|
||||
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, d.dept_name, d.leader,
|
||||
r.role_name, sp.post_name
|
||||
from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
<if test="roleId !=null and userId != 0 and status != '' " >
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
</if>
|
||||
left join sys_user_role ur on u.user_id = ur.user_id
|
||||
left join sys_role r on r.role_id = ur.role_id
|
||||
LEFT JOIN sys_user_post p ON p.user_id = u.user_id
|
||||
LEFT JOIN sys_post sp ON sp.post_id = p.post_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
AND u.user_id = #{userId}
|
||||
|
|
@ -91,9 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and r.role_id = #{roleId}
|
||||
</if>
|
||||
|
||||
<if test="roleId !=null and userId != 0 and status != '' " >
|
||||
GROUP BY u.user_id
|
||||
</if>
|
||||
GROUP BY u.user_id
|
||||
|
||||
<!-- 数据范围过滤 -->
|
||||
${params.dataScope}
|
||||
|
|
|
|||
Loading…
Reference in New Issue