|
@@ -788,6 +788,77 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
return new MyVOPage<>(sbList);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据登录用户的身份来查询列表
|
|
|
+ * 1:使用人员,看到自己的
|
|
|
+ * 2:维修员,看到自己维修的
|
|
|
+ * 3:维修主管,看到全部的
|
|
|
+ *
|
|
|
+ * @param model
|
|
|
+ * @param pageNum :
|
|
|
+ * @param pageSize :
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public MyVOPage<SbInfoVO> selectVOPageByRole(SbInfoDTO model, int pageNum, int pageSize) {
|
|
|
+
|
|
|
+ UserInfo userInfo = SecurityUtils.getUserInfo();
|
|
|
+ List<String> roleCodes = userInfo.getRoleCodes();
|
|
|
+ int roleType = 1;// 默认使用人员
|
|
|
+ if(roleCodes.contains(SysRoleCodeEnum.MM.name())){
|
|
|
+ roleType = 3;
|
|
|
+ }else if(roleCodes.contains(SysRoleCodeEnum.Maintenance.name())){
|
|
|
+ roleType = 2;
|
|
|
+ }else if(roleCodes.contains(SysRoleCodeEnum.Opreator.name())){
|
|
|
+ roleType = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 选择该用户的设备
|
|
|
+ if (roleType == 1) {
|
|
|
+ model.setSaveUser(userInfo.getUserId());
|
|
|
+ }
|
|
|
+ // 设备的第一维修人员或者第二维修人
|
|
|
+ if (roleType == 2) {
|
|
|
+ model.setRepairUserSearch(userInfo.getUserId());
|
|
|
+ }
|
|
|
+
|
|
|
+ PageHelper.startPage(pageNum, pageSize);
|
|
|
+ List<SbInfoVO> sbList = mapper.selectVOList(model);
|
|
|
+ if(SbInfoChildEnum.IS_PARENT.getValue().equals(model.getIsChild()) && !CollectionUtils.isEmpty(sbList)){
|
|
|
+ for(SbInfoVO vo: sbList){
|
|
|
+ if(SbInfoChildEnum.IS_PARENT.getValue().equals(vo.getIsChild())){
|
|
|
+ SbInfoDTO infoDTO = new SbInfoDTO();
|
|
|
+ infoDTO.setParentId(vo.getId());
|
|
|
+ List<SbInfoVO> childVOList = mapper.selectVOList(infoDTO);
|
|
|
+ if(!CollectionUtils.isEmpty(childVOList)){
|
|
|
+ vo.setChildren(childVOList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<SysUser> userList = sysUserMapper.selectAll();
|
|
|
+ for(SbInfoVO vo:sbList){
|
|
|
+ if (vo.getRepairUser() != null) {
|
|
|
+ userList.forEach(sysUser -> {
|
|
|
+ if (sysUser.getUserId().equals(vo.getRepairUser())) {
|
|
|
+ vo.setRepairUserName(sysUser.getRealName());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (vo.getRepairUserSecond() != null) {
|
|
|
+ userList.forEach(sysUser -> {
|
|
|
+ if (sysUser.getUserId().equals(vo.getRepairUserSecond())) {
|
|
|
+ vo.setRepairUserNameSecond(sysUser.getRealName());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new MyVOPage<>(sbList);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 系统管理员查询全部:查看保养条目的
|
|
|
*
|