更新工作汇报相关代码
This commit is contained in:
parent
9d3aefd4a7
commit
dc28a00757
@ -1,8 +1,6 @@
|
||||
package cn.iocoder.yudao.module.workReport.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.property.entity.Property;
|
||||
import cn.iocoder.yudao.module.workReport.entity.WorkReport;
|
||||
import cn.iocoder.yudao.module.workReport.service.WorkReportService;
|
||||
import cn.iocoder.yudao.module.workReport.vo.WorkReportPageReqVO;
|
||||
@ -21,8 +19,10 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
@ -45,7 +45,7 @@ public class WorkReportController {
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建工作汇报")
|
||||
@PreAuthorize("@ss.hasPermission('work:report:create')")
|
||||
// @PreAuthorize("@ss.hasPermission('work:report:create')")
|
||||
public CommonResult<Integer> createReport(@Valid @RequestBody WorkReportSaveReqVO createReqVO) {
|
||||
createReqVO.setUserId(Objects.requireNonNull(SecurityFrameworkUtils.getLoginUser()).getId());
|
||||
return success(reportService.createReport(createReqVO));
|
||||
@ -53,7 +53,7 @@ public class WorkReportController {
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新工作汇报")
|
||||
@PreAuthorize("@ss.hasPermission('work:report:update')")
|
||||
// @PreAuthorize("@ss.hasPermission('work:report:update')")
|
||||
public CommonResult<Boolean> updateReport(@Valid @RequestBody WorkReportSaveReqVO updateReqVO) {
|
||||
reportService.updateReport(updateReqVO);
|
||||
return success(true);
|
||||
@ -62,7 +62,7 @@ public class WorkReportController {
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除工作汇报")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('work:report:delete')")
|
||||
// @PreAuthorize("@ss.hasPermission('work:report:delete')")
|
||||
public CommonResult<Boolean> deleteReport(@RequestParam("id") Integer id) {
|
||||
reportService.deleteReport(id);
|
||||
return success(true);
|
||||
@ -71,17 +71,22 @@ public class WorkReportController {
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得工作汇报")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('work:report:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('work:report:query')")
|
||||
public CommonResult<WorkReportRespVO> getReport(@RequestParam("id") Integer id) {
|
||||
WorkReport report = reportService.getReport(id);
|
||||
return success(BeanUtils.toBean(report, WorkReportRespVO.class));
|
||||
WorkReportRespVO bean = BeanUtils.toBean(report, WorkReportRespVO.class);
|
||||
//将汇报对象转为数组
|
||||
bean.setReportTos(Arrays.stream(report.getReportTo().split(",")).map(Long::parseLong) // 转换为 Long 类型
|
||||
.collect(Collectors.toList()));
|
||||
return success(bean);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得工作汇报分页")
|
||||
@PreAuthorize("@ss.hasPermission('work:report:query')")
|
||||
// @PreAuthorize("@ss.hasPermission('work:report:query')")
|
||||
public CommonResult<IPage<WorkReportRespVO>> getReportPage(@Valid WorkReportPageReqVO pageReqVO) {
|
||||
Page<WorkReport> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
||||
pageReqVO.setUserId(Objects.requireNonNull(SecurityFrameworkUtils.getLoginUser()).getId());
|
||||
IPage<WorkReportRespVO> pageResult = reportService.getReportPage(page, pageReqVO);
|
||||
return success(pageResult);
|
||||
}
|
||||
@ -99,4 +104,14 @@ public class WorkReportController {
|
||||
ExcelUtils.write(response, "工作汇报.xls", "数据", WorkReportRespVO.class, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇报对象
|
||||
* @param dictType 字典类型
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryReportTo")
|
||||
public CommonResult<?> queryReportTo(String dictType) {
|
||||
return success(reportService.queryReportTo(dictType));
|
||||
}
|
||||
|
||||
}
|
@ -43,9 +43,17 @@ public class WorkReport extends TenantBaseDO {
|
||||
* 汇报内容
|
||||
*/
|
||||
private String reportContent;
|
||||
/**
|
||||
* 汇报对象
|
||||
*/
|
||||
private String reportTo;
|
||||
/**
|
||||
* 汇报人
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
private String filePath;
|
||||
|
||||
}
|
@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 工作汇报 Mapper
|
||||
@ -19,5 +20,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface WorkReportMapper extends BaseMapper<WorkReport> {
|
||||
|
||||
IPage<WorkReportRespVO> selectPage(Page page, WorkReportPageReqVO pageReqVO);
|
||||
IPage<WorkReportRespVO> selectPage(@Param("page") Page page,@Param("pageReqVO") WorkReportPageReqVO pageReqVO);
|
||||
|
||||
Long queryReportCount(@Param("pageReqVO")WorkReportPageReqVO pageReqVO);
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.workReport.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.workReport.entity.WorkReport;
|
||||
import cn.iocoder.yudao.module.workReport.vo.WorkReportPageReqVO;
|
||||
import cn.iocoder.yudao.module.workReport.vo.WorkReportRespVO;
|
||||
@ -57,4 +58,18 @@ public interface WorkReportService extends IService<WorkReport> {
|
||||
*/
|
||||
IPage<WorkReportRespVO> getReportPage(Page<WorkReport> page, WorkReportPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 查询汇报对象
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> queryReportTo(String dictType);
|
||||
|
||||
/**
|
||||
* 查询汇报对象数量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Long queryReportCount(WorkReportPageReqVO pageReqVO);
|
||||
}
|
@ -1,6 +1,10 @@
|
||||
package cn.iocoder.yudao.module.workReport.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.RoleService;
|
||||
import cn.iocoder.yudao.module.workReport.entity.WorkReport;
|
||||
import cn.iocoder.yudao.module.workReport.mapper.WorkReportMapper;
|
||||
import cn.iocoder.yudao.module.workReport.service.WorkReportService;
|
||||
@ -15,6 +19,8 @@ import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@ -29,10 +35,20 @@ public class WorkReportServiceImpl extends ServiceImpl<WorkReportMapper, WorkRep
|
||||
@Resource
|
||||
private WorkReportMapper reportMapper;
|
||||
|
||||
@Resource
|
||||
private DictDataApi dictDataApi;
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@Override
|
||||
public Integer createReport(WorkReportSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
WorkReport report = BeanUtils.toBean(createReqVO, WorkReport.class);
|
||||
|
||||
// 将汇报对象集合转换为字符串
|
||||
report.setReportTo(createReqVO.getReportTos().stream().map(String::valueOf).collect(Collectors.joining(",")));
|
||||
|
||||
reportMapper.insert(report);
|
||||
// 返回
|
||||
return report.getId();
|
||||
@ -71,4 +87,31 @@ public class WorkReportServiceImpl extends ServiceImpl<WorkReportMapper, WorkRep
|
||||
return reportMapper.selectPage(page, pageReqVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇报对象
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserDTO> queryReportTo(String dictType) {
|
||||
//根据dictType查询角色
|
||||
List<DictDataRespDTO> roleList = dictDataApi.getDictDataList(dictType);
|
||||
List<String> codes = roleList.stream().map(DictDataRespDTO::getValue).collect(Collectors.toList());
|
||||
|
||||
//根据角色查询用户
|
||||
return roleService.getUserListByCodes(codes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇报对象数量
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long queryReportCount(WorkReportPageReqVO pageReqVO) {
|
||||
return reportMapper.queryReportCount(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -15,6 +15,9 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class WorkReportPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "服务包id")
|
||||
private String servicePackageId;
|
||||
|
||||
@Schema(description = "汇报主题")
|
||||
private String reportTopic;
|
||||
|
||||
@ -26,7 +29,13 @@ public class WorkReportPageReqVO extends PageParam {
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "汇报人", example = "24401")
|
||||
private Integer userId;
|
||||
@Schema(description = "汇报人")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "汇报主题或汇报人")
|
||||
private String topicOrUserName;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.workReport.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
@ -16,6 +17,9 @@ public class WorkReportRespVO {
|
||||
@ExcelProperty("id")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "服务包id")
|
||||
private String servicePackageId;
|
||||
|
||||
@Schema(description = "汇报主题")
|
||||
@ExcelProperty("汇报主题")
|
||||
private String reportTopic;
|
||||
@ -29,15 +33,22 @@ public class WorkReportRespVO {
|
||||
private String reportContent;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "汇报人", example = "24401")
|
||||
@ExcelProperty("汇报人")
|
||||
private Integer userId;
|
||||
|
||||
@Schema(description = "汇报人姓名", example = "李四")
|
||||
@ExcelProperty("汇报人姓名")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "汇报对象集合")
|
||||
private List<Long> reportTos;
|
||||
|
||||
@Schema(description = "汇报人头像")
|
||||
private String avatar;
|
||||
|
||||
@Schema(description = "附件")
|
||||
private String filePath;
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package cn.iocoder.yudao.module.workReport.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
@ -14,10 +15,14 @@ public class WorkReportSaveReqVO {
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "6601")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "服务套餐id")
|
||||
private String servicePackageId;
|
||||
|
||||
@Schema(description = "汇报主题")
|
||||
private String reportTopic;
|
||||
|
||||
@Schema(description = "汇报时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime reportTime;
|
||||
|
||||
@Schema(description = "汇报内容")
|
||||
@ -26,4 +31,10 @@ public class WorkReportSaveReqVO {
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "附件")
|
||||
private String filePath;
|
||||
|
||||
@Schema(description = "汇报对象集合")
|
||||
private List<Long> reportTos;
|
||||
|
||||
}
|
@ -6,10 +6,11 @@
|
||||
|
||||
|
||||
<select id="selectPage" resultType="cn.iocoder.yudao.module.workReport.vo.WorkReportRespVO">
|
||||
SELECT wr.*,su.nickname as userName
|
||||
SELECT wr.*, su.nickname as userName, su.avatar as avatar
|
||||
FROM work_report wr
|
||||
LEFT JOIN system_users su on su.id = wr.user_id
|
||||
LEFT JOIN system_users su ON su.id = wr.user_id
|
||||
<where>
|
||||
wr.deleted = 0
|
||||
<if test="pageReqVO.reportTopic != null">
|
||||
AND wr.report_topic LIKE CONCAT('%', #{pageReqVO.reportTopic}, '%')
|
||||
</if>
|
||||
@ -19,9 +20,52 @@
|
||||
<if test="pageReqVO.createTime != null">
|
||||
AND wr.create_time BETWEEN #{pageReqVO.createTime[0]} AND #{pageReqVO.createTime[1]}
|
||||
</if>
|
||||
<if test="pageReqVO.userName != null and pageReqVO.userName != ''">
|
||||
AND su.nickname LIKE CONCAT('%', #{pageReqVO.userName}, '%')
|
||||
</if>
|
||||
<if test="pageReqVO.servicePackageId != null and pageReqVO.servicePackageId != ''">
|
||||
AND wr.service_package_id = #{pageReqVO.servicePackageId}
|
||||
</if>
|
||||
<if test="pageReqVO.topicOrUserName != null and pageReqVO.topicOrUserName != ''">
|
||||
AND (wr.report_topic LIKE CONCAT('%', #{pageReqVO.topicOrUserName}, '%')
|
||||
OR su.nickname LIKE CONCAT('%', #{pageReqVO.topicOrUserName}, '%'))
|
||||
</if>
|
||||
<if test="pageReqVO.userId != null">
|
||||
AND wr.user_id = #{pageReqVO.userId}
|
||||
AND (wr.user_id = #{pageReqVO.userId} -- 查询自己的汇报
|
||||
OR FIND_IN_SET(#{pageReqVO.userId}, wr.report_to) > 0) -- 查询汇报给自己的汇报
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="queryReportCount" resultType="java.lang.Long" parameterType="java.lang.Long">
|
||||
SELECT COUNT(*)
|
||||
FROM work_report wr
|
||||
LEFT JOIN system_users su ON su.id = wr.user_id
|
||||
<where>
|
||||
wr.deleted = 0
|
||||
<if test="pageReqVO.reportTopic != null">
|
||||
AND wr.report_topic LIKE CONCAT('%', #{pageReqVO.reportTopic}, '%')
|
||||
</if>
|
||||
<if test="pageReqVO.reportTime != null">
|
||||
AND wr.report_time BETWEEN #{pageReqVO.reportTime[0]} AND #{pageReqVO.reportTime[1]}
|
||||
</if>
|
||||
<if test="pageReqVO.createTime != null">
|
||||
AND wr.create_time BETWEEN #{pageReqVO.createTime[0]} AND #{pageReqVO.createTime[1]}
|
||||
</if>
|
||||
<if test="pageReqVO.userName != null and pageReqVO.userName != ''">
|
||||
AND su.nickname LIKE CONCAT('%', #{pageReqVO.userName}, '%')
|
||||
</if>
|
||||
<if test="pageReqVO.servicePackageId != null and pageReqVO.servicePackageId != ''">
|
||||
AND wr.service_package_id = #{pageReqVO.servicePackageId}
|
||||
</if>
|
||||
<if test="pageReqVO.topicOrUserName != null and pageReqVO.topicOrUserName != ''">
|
||||
AND (wr.report_topic LIKE CONCAT('%', #{pageReqVO.topicOrUserName}, '%')
|
||||
OR su.nickname LIKE CONCAT('%', #{pageReqVO.topicOrUserName}, '%'))
|
||||
</if>
|
||||
<if test="pageReqVO.userId != null">
|
||||
AND (wr.user_id = #{pageReqVO.userId} -- 查询自己的汇报
|
||||
OR FIND_IN_SET(#{pageReqVO.userId}, wr.report_to) > 0) -- 查询汇报给自己的汇报
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -12,6 +12,8 @@ import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
|
||||
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
|
||||
import cn.iocoder.yudao.module.workReport.service.WorkReportService;
|
||||
import cn.iocoder.yudao.module.workReport.vo.WorkReportPageReqVO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -48,6 +50,9 @@ public class InspectionUtilController {
|
||||
@Resource
|
||||
private IInspectionFileService fileService;
|
||||
|
||||
@Resource
|
||||
private WorkReportService workReportService;
|
||||
|
||||
/**
|
||||
* 根据用户取出当前用户的角色,只针对检测
|
||||
*
|
||||
@ -94,6 +99,12 @@ public class InspectionUtilController {
|
||||
map.put("equ", equs.getTotal());
|
||||
long fileCount = fileService.count(new LambdaQueryWrapper<InspectionFile>().eq(InspectionFile::getType, "2"));
|
||||
map.put("file", fileCount);
|
||||
//查询汇报数量
|
||||
WorkReportPageReqVO workReportPageReqVO = new WorkReportPageReqVO();
|
||||
workReportPageReqVO.setUserId(SecurityFrameworkUtils.getLoginUserId());
|
||||
workReportPageReqVO.setServicePackageId("jiance");
|
||||
Long reportCount = workReportService.queryReportCount(workReportPageReqVO);
|
||||
map.put("report", reportCount);
|
||||
return success(map);
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 角色 API 接口
|
||||
* API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@ -15,7 +15,7 @@ public interface RoleApi {
|
||||
|
||||
/**
|
||||
* 校验角色们是否有效。如下情况,视为无效:
|
||||
* 1. 角色编号不存在
|
||||
* 1. 编号不存在
|
||||
* 2. 角色被禁用
|
||||
*
|
||||
* @param ids 角色编号数组
|
||||
|
@ -55,4 +55,6 @@ public interface UserRoleMapper extends BaseMapperX<UserRoleDO> {
|
||||
List<UserRoleDTO> userCodes(@Param("userIds") List<Long> userIds);
|
||||
|
||||
List<UserDTO> selectByRoleIds(@Param("roleIds") List<Integer> roleIds);
|
||||
|
||||
List<UserDTO> selectByRoleCodes(@Param("codes") List<String> codes);
|
||||
}
|
||||
|
@ -50,6 +50,7 @@ public interface RoleService {
|
||||
* @param code 角色编号
|
||||
*/
|
||||
void deleteRole(String code);
|
||||
|
||||
RoleDO queryRole(String code);
|
||||
|
||||
/**
|
||||
@ -148,20 +149,23 @@ public interface RoleService {
|
||||
* @param ids 角色编号数组
|
||||
*/
|
||||
void validateRoleList(Collection<Long> ids);
|
||||
|
||||
@TenantIgnore
|
||||
RoleDO getRoleByCodeWithoutTenant(String rescueOtherNotify);
|
||||
|
||||
/**
|
||||
* 查询某个角色的用户
|
||||
* @author vinjor-M
|
||||
* @date 15:58 2024/10/26
|
||||
*
|
||||
* @param roleCode 角色code
|
||||
* @return java.util.List<cn.iocoder.yudao.module.system.api.user.dto.UserDTO>
|
||||
* @author vinjor-M
|
||||
* @date 15:58 2024/10/26
|
||||
**/
|
||||
List<UserDTO> selectByRoleCode(Long tenantId,String roleCode);
|
||||
List<UserDTO> selectByRoleCode(Long tenantId, String roleCode);
|
||||
|
||||
/**
|
||||
* 根据服务套餐查询角色
|
||||
*
|
||||
* @param roleDO
|
||||
* @return
|
||||
*/
|
||||
@ -171,6 +175,7 @@ public interface RoleService {
|
||||
|
||||
/**
|
||||
* 根据用户id查询角色
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
@ -178,14 +183,25 @@ public interface RoleService {
|
||||
|
||||
/**
|
||||
* 根据角色id查询用户
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> getListByUserId(Integer roleId);
|
||||
|
||||
/**
|
||||
* 根据角色id查询用户
|
||||
*
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> getListByUserIds(List<Integer> roleId);
|
||||
|
||||
/**
|
||||
* 根据角色code查询用户
|
||||
*
|
||||
* @param codes 角色code数组
|
||||
* @return
|
||||
*/
|
||||
List<UserDTO> getUserListByCodes(List<String> codes);
|
||||
}
|
||||
|
@ -400,6 +400,17 @@ public class RoleServiceImpl implements RoleService {
|
||||
return userDTOS;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色code查询用户
|
||||
*
|
||||
* @param codes 角色code数组
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UserDTO> getUserListByCodes(List<String> codes) {
|
||||
return userRoleMapper.selectByRoleCodes(codes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得自身的代理对象,解决 AOP 生效问题
|
||||
*
|
||||
|
@ -80,4 +80,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
)
|
||||
</select>
|
||||
<select id="selectByRoleCodes" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
system_users
|
||||
WHERE
|
||||
id IN (
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
system_user_role sur
|
||||
WHERE
|
||||
sur.role_id IN (
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
system_role
|
||||
WHERE
|
||||
code IN
|
||||
<foreach item="item" collection="codes" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
) AND sur.deleted = 0
|
||||
) AND deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user