diff --git a/config/db/V7.8__role_user_add_col.sql b/config/db/V7.8__role_user_add_col.sql new file mode 100644 index 00000000..628b0b3c --- /dev/null +++ b/config/db/V7.8__role_user_add_col.sql @@ -0,0 +1,5 @@ +ALTER TABLE sys_role_user + ADD COLUMN `del_flag` INT NOT NULL DEFAULT 0 COMMENT '删除标志:0正常,1删除', + ADD COLUMN `updater` BIGINT NULL COMMENT '修改人', + ADD COLUMN `update_date` datetime(0) NULL COMMENT '修改时间'; + diff --git a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysUserController.java b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysUserController.java index dfaa4fb5..b104d5fd 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/controller/SysUserController.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/controller/SysUserController.java @@ -196,4 +196,27 @@ public class SysUserController { } } + + + @GetMapping("/getApproverUnconfiguredDepartment") + @ApiOperation("查询未配置部门审核人部门列表") + @LogOperation("查询未配置部门审核人部门列表") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "当前页码,从1开始", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "int") + }) + public Result getApproverUnconfiguredDepartment(@ApiIgnore @RequestParam Map params) { + return new Result().ok(sysUserService.getApproverUnconfiguredDepartment(params)); + } + + @GetMapping("/getApproverUnconfiguredRegion") + @ApiOperation("查询未配置区市审核人区市列表") + @LogOperation("查询未配置区市审核人区市列表") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pageNum", value = "当前页码,从1开始", paramType = "query", dataType = "int"), + @ApiImplicitParam(name = "pageSize", value = "每页显示记录数", paramType = "query", dataType = "int") + }) + public Result getApproverUnconfiguredRegion(@ApiIgnore @RequestParam Map params) { + return new Result().ok(sysUserService.getApproverUnconfiguredRegion(params)); + } } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/dao/SysRoleUserDao.java b/renren-admin/src/main/java/io/renren/modules/sys/dao/SysRoleUserDao.java index 98884ca7..4e7ee94f 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/dao/SysRoleUserDao.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/dao/SysRoleUserDao.java @@ -3,6 +3,7 @@ package io.renren.modules.sys.dao; import io.renren.common.dao.BaseDao; import io.renren.modules.sys.entity.SysRoleUserEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -26,7 +27,7 @@ public interface SysRoleUserDao extends BaseDao { * * @param userIds 用户ids */ - void deleteByUserIds(Long[] userIds); + void deleteByUserIds(@Param("userIds") Long[] userIds, @Param("updater") Long updater); /** * 角色ID列表 diff --git a/renren-admin/src/main/java/io/renren/modules/sys/dao/SysUserDao.java b/renren-admin/src/main/java/io/renren/modules/sys/dao/SysUserDao.java index d6ce1e18..5d084954 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/dao/SysUserDao.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/dao/SysUserDao.java @@ -5,6 +5,7 @@ import io.renren.modules.sys.entity.SysUserEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -48,4 +49,8 @@ public interface SysUserDao extends BaseDao { SysUserEntity getUserByName(@Param("username") String username); String getDeptNameByUserId(@Param("id") String id); + + List getApproverUnconfiguredDepartment(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize); + + List getApproverUnconfiguredRegion(@Param("pageNum") int pageNum, @Param("pageSize") int pageSize); } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/dto/SysRoleDTO.java b/renren-admin/src/main/java/io/renren/modules/sys/dto/SysRoleDTO.java index 82e9e91d..ab6a2901 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/dto/SysRoleDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/dto/SysRoleDTO.java @@ -47,4 +47,13 @@ public class SysRoleDTO implements Serializable { @ApiModelProperty(value = "部门ID列表") private List deptIdList; + @ApiModelProperty(value = "删除标志") + private Integer delFlag; + + @ApiModelProperty(value = "修改时间") + private Date updateDate; + + @ApiModelProperty(value = "修改人") + private Long updater; + } \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/sys/entity/SysRoleUserEntity.java b/renren-admin/src/main/java/io/renren/modules/sys/entity/SysRoleUserEntity.java index 2626bbe7..75a77710 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/entity/SysRoleUserEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/entity/SysRoleUserEntity.java @@ -1,10 +1,15 @@ package io.renren.modules.sys.entity; +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import io.renren.common.entity.BaseEntity; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.Date; + /** * 角色用户关系 * @@ -25,4 +30,12 @@ public class SysRoleUserEntity extends BaseEntity { */ private Long userId; + private Integer delFlag; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Date updateDate; + + @TableField(fill = FieldFill.INSERT_UPDATE) + private Long updater; + } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/SysUserService.java b/renren-admin/src/main/java/io/renren/modules/sys/service/SysUserService.java index 5e0b3357..e155b9fb 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/SysUserService.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/SysUserService.java @@ -62,4 +62,7 @@ public interface SysUserService extends BaseService { int backSysUser(); + Object getApproverUnconfiguredDepartment(Map params); + + Object getApproverUnconfiguredRegion(Map params); } diff --git a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java index 12010ebd..52a17c85 100644 --- a/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java +++ b/renren-admin/src/main/java/io/renren/modules/sys/service/impl/SysRoleUserServiceImpl.java @@ -2,10 +2,12 @@ package io.renren.modules.sys.service.impl; import cn.hutool.core.collection.CollUtil; import io.renren.common.service.impl.BaseServiceImpl; +import io.renren.modules.security.user.SecurityUser; import io.renren.modules.sys.dao.SysRoleUserDao; import io.renren.modules.sys.entity.SysRoleUserEntity; import io.renren.modules.sys.service.SysRoleUserService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -18,6 +20,7 @@ import java.util.List; public class SysRoleUserServiceImpl extends BaseServiceImpl implements SysRoleUserService { @Override + @Transactional public void saveOrUpdate(Long userId, List roleIdList) { //先删除角色用户关系 deleteByUserIds(new Long[]{userId}); @@ -45,7 +48,9 @@ public class SysRoleUserServiceImpl extends BaseServiceImpl params) { + int pageNum = 1; + int pageSize = 10; + if (params.get("pageNum") != null && StringUtils.isNumber(params.get("pageNum").toString())) { + pageNum = Integer.parseInt(params.get("pageNum").toString()); + } + if (params.get("pageSize") != null && StringUtils.isNumber(params.get("pageSize").toString())) { + pageSize = Integer.parseInt(params.get("pageSize").toString()); + } + ArrayList resultList = new ArrayList<>(); + resultList.addAll(sysUserDao.getApproverUnconfiguredDepartment(pageNum, pageSize)); + return resultList; + } + + @Override + public Object getApproverUnconfiguredRegion(Map params) { + int pageNum = 1; + int pageSize = 10; + if (params.get("pageNum") != null && StringUtils.isNumber(params.get("pageNum").toString())) { + pageNum = Integer.parseInt(params.get("pageNum").toString()); + } + if (params.get("pageSize") != null && StringUtils.isNumber(params.get("pageSize").toString())) { + pageSize = Integer.parseInt(params.get("pageSize").toString()); + } + ArrayList resultList = new ArrayList<>(); + resultList.addAll(sysUserDao.getApproverUnconfiguredRegion(pageNum, pageSize)); + return resultList; + } } diff --git a/renren-admin/src/main/resources/mapper/sys/SysMenuDao.xml b/renren-admin/src/main/resources/mapper/sys/SysMenuDao.xml index 8832dd90..d46e66fb 100644 --- a/renren-admin/src/main/resources/mapper/sys/SysMenuDao.xml +++ b/renren-admin/src/main/resources/mapper/sys/SysMenuDao.xml @@ -39,6 +39,7 @@ left join sys_role_menu t2 on t1.role_id = t2.role_id left join sys_menu t3 on t2.menu_id = t3.id where t1.user_id = #{userId} + AND t1.del_flag = 0 and t3.type = #{type} @@ -48,7 +49,7 @@ select t2.dept_id from sys_role_user t1, sys_role_data_scope t2 - where t1.user_id = #{value} and t1.role_id = t2.role_id + where t1.user_id = #{value} and t1.role_id = t2.role_id AND t1.del_flag = 0 diff --git a/renren-admin/src/main/resources/mapper/sys/SysRoleUserDao.xml b/renren-admin/src/main/resources/mapper/sys/SysRoleUserDao.xml index de36800f..42bea077 100644 --- a/renren-admin/src/main/resources/mapper/sys/SysRoleUserDao.xml +++ b/renren-admin/src/main/resources/mapper/sys/SysRoleUserDao.xml @@ -9,6 +9,7 @@ #{roleId} + + + UPDATE sys_role_user SET del_flag = 0, update_date = NOW(), updater = #{updater} + where user_id in + + #{userId} + + + \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml b/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml index ebdeb622..6d85b91e 100644 --- a/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml +++ b/renren-admin/src/main/resources/mapper/sys/SysUserDao.xml @@ -33,7 +33,7 @@ AND EXISTS(SELECT 1 FROM sys_role_user WHERE sys_role_user.user_id = t1.id AND sys_role_user.role_id = - #{role_id}) + #{role_id}) AND sys_role_user.del_flag = 0 @@ -71,6 +71,7 @@ AND t1.role_id = #{roleId} AND t2.dept_id = #{deptId} AND t2.status = 1 + AND t1.del_flag = 0 ORDER BY update_date DESC LIMIT 1 @@ -102,4 +103,73 @@ SELECT name FROM sys_dept LEFT JOIN sys_user ON sys_user.dept_id = sys_dept.id WHERE sys_user.id = #{id} + + + + \ No newline at end of file