diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/AppSwiperController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/AppSwiperController.java index a771df4c..c4c0152f 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/AppSwiperController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/appBase/controller/AppSwiperController.java @@ -151,4 +151,29 @@ public class AppSwiperController extends BaseController map.put("user", sysUser); return CommonResult.success(map); } +// @GetMapping("/getJcWorkerInfo") +// public CommonResult getJcWorkerInfo() +// { +// +// LambdaQueryWrapper queryWrapper =new LambdaQueryWrapper<>(); +// SysUser user = SecurityUtils.getLoginUser().getUser(); +// queryWrapper.eq(PartnerWorker::getUserId,user.getUserId()); +// PartnerWorker worker = jcWorkerService.getOne(queryWrapper); +// if (ObjectUtil.isNotEmpty(worker)){ +// LambdaQueryWrapper queryWrapper1 =new LambdaQueryWrapper<>(); +// queryWrapper1.eq(ShopMallPartners::getPartnerId,worker.getPartnerId()).eq(ShopMallPartners::getType,"jc").eq(ShopMallPartners::getIsBanned,"0"); +// ShopMallPartners partner = partnersService.getOne(queryWrapper1); +// if (ObjectUtil.isEmpty(partner)){ +// return error("信息有误"); +// } +// ajax.put("partnerInfo", partner); +// }else { +// return error("信息有误"); +// } +// SysUser sysUser = userService.selectUserById(user.getUserId()); +// +// ajax.put("user", sysUser); +// +// return ajax; +// } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java index 5fdb1769..735d8c3c 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/controller/InspectionInfoController.java @@ -96,4 +96,13 @@ public class InspectionInfoController extends BaseController { return toAjax(inspectionInfoService.deleteInspectionInfoByIds(id)); } + + /** + * 根据当前登陆人获取可以选择的工单 + * @return + */ + @GetMapping("geStelectInspection") + public CommonResult geStelectInspection(){ + return success(inspectionInfoService.geStelectInspection()); + } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java index 188df0f7..2805635b 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionInfo.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.inspection.entity; import java.util.Date; +import java.util.List; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; @@ -143,4 +144,10 @@ public class InspectionInfo extends TenantBaseDO private String isPayOnline; //是否上门取车0否1是 private String isPickCar; + /** 当前流程节点 */ + private Integer nowOrderNum; + + /** 开始检测时需要 传入 选择项目的id、角色id、排序 */ + private List inspectionWorkNodes; + private String workNodeId; } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionWorkNode.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionWorkNode.java new file mode 100644 index 00000000..3245b5d0 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/entity/InspectionWorkNode.java @@ -0,0 +1,81 @@ +package cn.iocoder.yudao.module.inspection.entity; + +import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.annotation.IdType; +import java.time.LocalDateTime; +import com.baomidou.mybatisplus.annotation.TableId; +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + *

+ * 检测流程表 + *

+ * + * @author dianliang + * @since 2024-10-31 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("inspection_work_node") +public class InspectionWorkNode extends TenantBaseDO { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.ASSIGN_UUID) + private String id; + + /** + * 检测工单主键 + */ + private Long inspectionInfoId; + + /** + * 项目主键 + */ + private String projectId; + + /** + * 角色主键 + */ + private Integer roleId; + + /** + * 排序 + */ + private Integer orderNum; + + /** + * 记录类型(inspection_records_type) + */ + private String type; + + /** + * 记录描述 + */ + private String remark; + + /** + * 维修图片 + */ + private String dealImages; + + /** + * 处理人 + */ + private String dealUserName; + + /** + * 处理人员工表id + */ + private Integer dealUserId; + + +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java new file mode 100644 index 00000000..5209740e --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/mapper/InspectionWorkNodeMapper.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.inspection.mapper; + +import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; + +/** + *

+ * 检测流程表 Mapper 接口 + *

+ * + * @author dianliang + * @since 2024-10-31 + */ +public interface InspectionWorkNodeMapper extends BaseMapper { + +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java index 2f219ee3..5fc966d1 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionInfoService.java @@ -75,4 +75,9 @@ public interface IInspectionInfoService extends IService Map workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime); + /** + * 根据当前登陆人获取可以选择的工单 + * @return + */ + List geStelectInspection(); } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java new file mode 100644 index 00000000..b9697e6e --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/IInspectionWorkNodeService.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.inspection.service; + +import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode; +import com.baomidou.mybatisplus.extension.service.IService; + +/** + *

+ * 检测流程表 服务类 + *

+ * + * @author dianliang + * @since 2024-10-31 + */ +public interface IInspectionWorkNodeService extends IService { + +} diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java index b03566c8..604c05f0 100644 --- a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionInfoServiceImpl.java @@ -2,9 +2,13 @@ package cn.iocoder.yudao.module.inspection.service.impl; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; + +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.security.core.LoginUser; @@ -17,7 +21,9 @@ import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService; import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService; import cn.iocoder.yudao.module.payment.service.OrderInfoService; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.user.AdminUserService; import cn.iocoder.yudao.util.SendSmsUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -49,8 +55,7 @@ import javax.annotation.Resource; * @date 2023-08-13 */ @Service -public class InspectionInfoServiceImpl extends ServiceImpl implements IInspectionInfoService -{ +public class InspectionInfoServiceImpl extends ServiceImpl implements IInspectionInfoService { @Autowired private AdminUserService userService; @Autowired @@ -72,8 +77,15 @@ public class InspectionInfoServiceImpl extends ServiceImpl selectInspectionInfoList(Page page, InspectionInfo inspectionInfo) - { - return baseMapper.selectInspectionInfoList(page,inspectionInfo); + public IPage selectInspectionInfoList(Page page, InspectionInfo inspectionInfo) { + return baseMapper.selectInspectionInfoList(page, inspectionInfo); } /** @@ -109,19 +119,23 @@ public class InspectionInfoServiceImpl extends ServiceImpl workerQueryWrapper =new LambdaQueryWrapper<>(); - workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId()); - PartnerWorker worker = workerService.getOne(workerQueryWrapper); - if (ObjectUtils.isNotEmpty(worker)){ - inspectionInfo.setWorkId(worker.getId()); - }else { - throw new Exception("请先将接待员加入员工"); +// LambdaQueryWrapper workerQueryWrapper =new LambdaQueryWrapper<>(); +// workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId()); +// PartnerWorker worker = workerService.getOne(workerQueryWrapper); +// if (ObjectUtils.isNotEmpty(worker)){ +// inspectionInfo.setWorkId(worker.getId()); +// }else { +// throw new Exception("请先将接待员加入员工"); +// } + if (ObjectUtils.isEmpty(inspectionInfo.getInspectionWorkNodes())) { + throw new RuntimeException("请选择检测项目"); } - AdminUserDO workerUser =userService.getUser(worker.getUserId()); - String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户"; - String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无"; + //当前登陆人 就是检测人 + AdminUserDO workerUser = userService.getUser(loginUser.getId()); + String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户"; + String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "无"; AdminUserDO user = userService.getUserByMobile(buyPhone); - if (ObjectUtils.isEmpty(user)){ + if (ObjectUtils.isEmpty(user)) { //新增用户 UserSaveReqVO userSaveReqVO = new UserSaveReqVO(); userSaveReqVO.setNickname(buyName); @@ -135,13 +149,13 @@ public class InspectionInfoServiceImpl extends ServiceImpl queryWrapper =new LambdaQueryWrapper<>(); - queryWrapper.eq(PartnerCustomerInfo::getPartnerId,inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId,orderInfo.getUserId()); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(PartnerCustomerInfo::getPartnerId, inspectionInfo.getPartnerId()).eq(PartnerCustomerInfo::getUserId, orderInfo.getUserId()); PartnerCustomerInfo customerInfo = customerInfoService.getOne(queryWrapper); - if (ObjectUtil.isEmpty(customerInfo)){ - customerInfo =new PartnerCustomerInfo(); + if (ObjectUtil.isEmpty(customerInfo)) { + customerInfo = new PartnerCustomerInfo(); customerInfo.setPartnerId(inspectionInfo.getPartnerId()); customerInfo.setUserId(user.getId()); customerInfo.setCustomerPhone(user.getMobile()); @@ -206,14 +220,30 @@ public class InspectionInfoServiceImpl extends ServiceImpl inspectionWorkNodes = inspectionInfo.getInspectionWorkNodes(); + //将检测工单流程补充检测工单id + inspectionWorkNodes.stream().forEach(inspectionWorkNode -> inspectionWorkNode.setInspectionInfoId(inspectionInfo.getId())); + workNodeService.saveBatch(inspectionWorkNodes); + + //检测步骤表插入检测开始 + InspectionStepInfo stepInfo = new InspectionStepInfo(); + stepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(inspectionInfo.getId()))); + stepInfo.setTitle("检测开始"); + stepInfo.setContent("检测开始"); + boolean save = inspectionStepInfoService.save(stepInfo); + return save ? 1 : 0; } @Override @@ -243,19 +273,19 @@ public class InspectionInfoServiceImpl extends ServiceImpl workerQueryWrapper =new LambdaQueryWrapper<>(); - workerQueryWrapper.eq(PartnerWorker::getUserId,loginUser.getId()).eq(PartnerWorker::getPartnerId,partners.getPartnerId()); + LambdaQueryWrapper workerQueryWrapper = new LambdaQueryWrapper<>(); + workerQueryWrapper.eq(PartnerWorker::getUserId, loginUser.getId()).eq(PartnerWorker::getPartnerId, partners.getPartnerId()); PartnerWorker worker = workerService.getOne(workerQueryWrapper); - AdminUserDO workerUser =userService.getUser(worker.getUserId()); - if (ObjectUtils.isNotEmpty(worker)){ + AdminUserDO workerUser = userService.getUser(worker.getUserId()); + if (ObjectUtils.isNotEmpty(worker)) { inspectionInfo.setWorkId(worker.getId()); - }else { + } else { throw new Exception("请先将接待员加入员工"); } - String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"未知客户"; - String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone())?inspectionInfo.getBuyPhone():StringUtils.isNotEmpty(inspectionInfo.getBuyName())?inspectionInfo.getBuyName():"无"; + String buyName = StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "未知客户"; + String buyPhone = StringUtils.isNotEmpty(inspectionInfo.getBuyPhone()) ? inspectionInfo.getBuyPhone() : StringUtils.isNotEmpty(inspectionInfo.getBuyName()) ? inspectionInfo.getBuyName() : "无"; AdminUserDO user = userService.getUserByMobile(buyPhone); - if (ObjectUtils.isEmpty(user)){ + if (ObjectUtils.isEmpty(user)) { //新增用户 UserSaveReqVO userSaveReqVO = new UserSaveReqVO(); userSaveReqVO.setNickname(buyName); @@ -264,7 +294,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime){ - return baseMapper.workOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime); + public List workOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) { + return baseMapper.workOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime); } @Override public IPage pageWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page page) { - return baseMapper.pageWorkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime,page); + return baseMapper.pageWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page); } @Override - public List delworkOrder(Long partnerId, String carNum, String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime){ - return baseMapper.delworkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime); + public List delworkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) { + return baseMapper.delworkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime); } @Override public IPage pageDelWorkOrder(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime, Page page) { - return baseMapper.pageDelWorkOrder(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime,page); + return baseMapper.pageDelWorkOrder(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime, page); } @Override public Map workOrderData(Long partnerId, String carNum, String goodsTitle, String customerSource, String payType, String startTime, Long roleId, String endTime) { - return baseMapper.workOrderData(partnerId,carNum,goodsTitle, customerSource, payType, startTime,roleId,endTime); + return baseMapper.workOrderData(partnerId, carNum, goodsTitle, customerSource, payType, startTime, roleId, endTime); + } + + /** + * 根据当前登陆人获取可以选择的工单 + * + * @return + */ + @Override + public List geStelectInspection() { + //获取当前登录人 + LoginUser loginUser = SecurityFrameworkUtils.getLoginUser(); + //获取当前登陆人的角色 + List byUserId = roleService.getByUserId(loginUser.getId()); + List roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList()); + //查询所有工单为进行中的 + List inspectionInfos = baseMapper.selectList(new LambdaQueryWrapper() + .eq(InspectionInfo::getStatus, 0)); + //根据工单id查询工单流程节点 + List infoIds = inspectionInfos.stream().map(inspectionInfo -> inspectionInfo.getId()).collect(Collectors.toList()); + if (ObjectUtils.isNotEmpty(infoIds)) { + List inspectionWorkNodes = workNodeService.list(new LambdaQueryWrapper() + .in(InspectionWorkNode::getInspectionInfoId, infoIds) + .eq(InspectionWorkNode::getDealUserId, null)); + + //工单集合 + List inspectionInfoList = new ArrayList<>(); + + //根据工单id查询工单流程节点 + Map> inspectionWorkNodeMap = inspectionWorkNodes.stream().collect(Collectors.groupingBy(InspectionWorkNode::getInspectionInfoId)); + for (InspectionInfo inspectionInfo : inspectionInfos) { + List inspectionWorkNodeList = inspectionWorkNodeMap.get(inspectionInfo.getId()); + //遍历工单流程节点 流程为key + if (CollectionUtil.isNotEmpty(inspectionWorkNodeList)) { + Map inspectionWorkMap = inspectionWorkNodeList.stream().collect(Collectors.toMap(InspectionWorkNode::getOrderNum, item -> item)); + InspectionWorkNode inspectionWorkNode = inspectionWorkMap.get(inspectionInfo.getNowOrderNum()); + if (inspectionWorkNode != null){ + //判断当前项目 当前登录人员 是否可以处理 + if (roleIds.contains(inspectionWorkNode.getRoleId())){ + inspectionInfo.setWorkNodeId(inspectionWorkNode.getId()); + inspectionInfoList.add(inspectionInfo); + } + } + } + } + return inspectionInfoList; + } + return null; } } diff --git a/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java new file mode 100644 index 00000000..69c91b68 --- /dev/null +++ b/dl-module-inspection/src/main/java/cn/iocoder/yudao/module/inspection/service/impl/InspectionWorkNodeServiceImpl.java @@ -0,0 +1,20 @@ +package cn.iocoder.yudao.module.inspection.service.impl; + +import cn.iocoder.yudao.module.inspection.entity.InspectionWorkNode; +import cn.iocoder.yudao.module.inspection.mapper.InspectionWorkNodeMapper; +import cn.iocoder.yudao.module.inspection.service.IInspectionWorkNodeService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + *

+ * 检测流程表 服务实现类 + *

+ * + * @author dianliang + * @since 2024-10-31 + */ +@Service +public class InspectionWorkNodeServiceImpl extends ServiceImpl implements IInspectionWorkNodeService { + +} diff --git a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/SysConfigServiceImpl.java b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/SysConfigServiceImpl.java index f24faf17..96b372e5 100644 --- a/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/SysConfigServiceImpl.java +++ b/dl-module-rescue/src/main/java/cn/iocoder/yudao/module/rescue/service/impl/SysConfigServiceImpl.java @@ -66,15 +66,11 @@ public class SysConfigServiceImpl implements ISysConfigService { */ @Override public String selectConfigByKey(String configKey) { - String configValue = Convert.toStr(redisCache2.getCacheObject(getCacheKey(configKey))); - if (StringUtils.isNotEmpty(configValue)) { - return configValue; - } + SysConfig config = new SysConfig(); config.setConfigKey(configKey); SysConfig retConfig = configMapper2.selectConfig(config); if (StringUtils.isNotNull(retConfig)) { - redisCache2.setCacheObject(getCacheKey(configKey), retConfig.getConfigValue()); return retConfig.getConfigValue(); } return StringUtils.EMPTY; diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java index 5faa97ad..0c1ac00d 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java @@ -168,4 +168,11 @@ public interface RoleService { List pageByQuery(RoleDO roleDO); IPage selectListByRoleId(RolePageReqVO role); + + /** + * 根据用户id查询角色 + * @param userId + * @return + */ + List getByUserId(Long userId); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java index e0aedbaf..882d326e 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java @@ -359,6 +359,19 @@ public class RoleServiceImpl implements RoleService { return userRoleMapper.selectListByRoleId(page,role); } + /** + * 根据用户id查询角色 + * + * @param userId + * @return + */ + @Override + public List getByUserId(Long userId) { + List userRoleDOS = userRoleMapper.selectList(new LambdaQueryWrapper() + .eq(UserRoleDO::getUserId, userId)); + return userRoleDOS; + } + /** * 获得自身的代理对象,解决 AOP 生效问题 *