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