Browse Source

任务列表优化

master
DX 2 months ago
parent
commit
58e03e9e2b
  1. 8
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java
  2. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java
  3. 13
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeCountResVO.java
  4. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java
  5. 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java
  6. 6
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java
  7. 27
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java
  8. 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java
  9. 70
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java
  10. 126
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java
  11. 51
      yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

8
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/taskinfo/vo/TaskInfoPageReqVO.java

@ -64,6 +64,10 @@ public class TaskInfoPageReqVO extends PageParam {
@Schema(description = "总共几步") @Schema(description = "总共几步")
private Integer taskTotal; private Integer taskTotal;
private LocalDateTime startTime;
private LocalDateTime endTime;
@Schema(description = "企业集合", example = "1") @Schema(description = "企业集合", example = "1")
private List<Long> enterpriseInspectionsIdes; private List<Long> enterpriseInspectionsIdes;
@ -79,10 +83,10 @@ public class TaskInfoPageReqVO extends PageParam {
private Integer selectWeek; private Integer selectWeek;
@Schema(description = "用户id", example = "1") @Schema(description = "用户id", example = "1")
private Integer userId; private Long userId;
@Schema(description = "部门id", example = "1") @Schema(description = "部门id", example = "1")
private Integer deptId; private Long deptId;
@Schema(description = "企业id", example = "1") @Schema(description = "企业id", example = "1")
private Long enterpriseId; private Long enterpriseId;

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/HomeController.java

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.system.controller.home;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO;
import cn.iocoder.yudao.module.system.controller.home.vo.HomeCountResVO;
import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO;
import cn.iocoder.yudao.module.system.service.home.HomeService; import cn.iocoder.yudao.module.system.service.home.HomeService;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
@ -30,7 +31,7 @@ public class HomeController {
@GetMapping("/appCount1") @GetMapping("/appCount1")
@Operation(summary = "app首页统计第一块") @Operation(summary = "app首页统计第一块")
// @PreAuthorize("@ss.hasPermission('system:inspections-log:create')") // @PreAuthorize("@ss.hasPermission('system:inspections-log:create')")
public CommonResult<List<InspectionsLogAppListVO>> signInList(HomeSelectVO homeSelectVO) { public CommonResult<HomeCountResVO> signInList(HomeSelectVO homeSelectVO) {
return success(homeService.appCount1(homeSelectVO)); return success(homeService.appCount1(homeSelectVO));
} }

13
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/home/vo/HomeCountResVO.java

@ -0,0 +1,13 @@
package cn.iocoder.yudao.module.system.controller.home.vo;
import lombok.Data;
@Data
public class HomeCountResVO {
//任务总数
private Long taskCount;
//执法总数
private Long inspectionsCount;
private Long enterpriseCount;
}

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/enterprise/EnterpriseMapper.java

@ -28,7 +28,7 @@ public interface EnterpriseMapper extends BaseMapperX<EnterpriseDO> {
.eqIfPresent(EnterpriseDO::getRegion, reqVO.getRegion()) .eqIfPresent(EnterpriseDO::getRegion, reqVO.getRegion())
.likeIfPresent(EnterpriseDO::getEnterprisesName, reqVO.getEnterprisesName()) .likeIfPresent(EnterpriseDO::getEnterprisesName, reqVO.getEnterprisesName())
.eqIfPresent(EnterpriseDO::getAddress, reqVO.getAddress()) .eqIfPresent(EnterpriseDO::getAddress, reqVO.getAddress())
.eqIfPresent(EnterpriseDO::getIsAudit, 1) .eqIfPresent(EnterpriseDO::getIsAudit, reqVO.getIsAudit())
.eqIfPresent(EnterpriseDO::getEnterprisesStatus, reqVO.getEnterprisesStatus()) .eqIfPresent(EnterpriseDO::getEnterprisesStatus, reqVO.getEnterprisesStatus())
.likeIfPresent(EnterpriseDO::getContactName, reqVO.getContactName()) .likeIfPresent(EnterpriseDO::getContactName, reqVO.getContactName())
.eqIfPresent(EnterpriseDO::getEnvironmentalContactPhone, reqVO.getEnvironmentalContactPhone()) .eqIfPresent(EnterpriseDO::getEnvironmentalContactPhone, reqVO.getEnvironmentalContactPhone())

2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/taskinfo/TaskInfoMapper.java

@ -61,7 +61,7 @@ public interface TaskInfoMapper extends BaseMapperX<TaskInfoDO> {
} }
//优化任务查询 //优化任务查询
PageResult<TaskInfoDO> selectMyPage(TaskInfoPageReqVO reqVO); IPage<TaskInfoDO> selectMyPage(Page<TaskInfoDO> page, @Param("params") TaskInfoPageReqVO reqVO);
//根据企业id查任务 //根据企业id查任务
IPage<TaskInfoDO> selectPageByEnterpriseId(Page<TaskInfoDO> page, @Param("reqVO") TaskInfoPageReqVO reqVO); IPage<TaskInfoDO> selectPageByEnterpriseId(Page<TaskInfoDO> page, @Param("reqVO") TaskInfoPageReqVO reqVO);

6
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.system.framework.datapermission.config; package cn.iocoder.yudao.module.system.framework.datapermission.config;
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer; import cn.iocoder.yudao.framework.datapermission.core.rule.dept.DeptDataPermissionRuleCustomizer;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
@ -22,6 +23,11 @@ public class DataPermissionConfiguration {
rule.addDeptColumn(DeptDO.class, "id"); rule.addDeptColumn(DeptDO.class, "id");
// user // user
rule.addUserColumn(AdminUserDO.class, "id"); rule.addUserColumn(AdminUserDO.class, "id");
//enterprise
rule.addDeptColumn(EnterpriseDO.class, "department_id");
rule.addUserColumn(EnterpriseDO.class, "user_id");
}; };
} }

27
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/enterprise/EnterpriseServiceImpl.java

@ -181,25 +181,24 @@ public class EnterpriseServiceImpl implements EnterpriseService {
return enterpriseMapper.selectList(pageReqVO); return enterpriseMapper.selectList(pageReqVO);
} }
@Override @Override
public PageResult<EnterpriseDO> getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) { public PageResult<EnterpriseDO> getEnterpriseByUserId(EnterprisePageReqVO pageReqVO) {
//根据不同身份查询企业 //根据不同身份查询企业
//专管员查询 user_id //专管员查询 user_id
//队长 查询部门 所有的 user_id in //队长 查询部门 所有的 user_id in
QueryWrapper<UserRoleDO> roleDOQueryWrapper = new QueryWrapper<>(); // QueryWrapper<UserRoleDO> roleDOQueryWrapper = new QueryWrapper<>();
roleDOQueryWrapper.eq("user_id", getLoginUserId()); // roleDOQueryWrapper.eq("user_id", getLoginUserId());
final List<UserRoleDO> userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper); // final List<UserRoleDO> userRoleDOS = userRoleMapper.selectList(roleDOQueryWrapper);
final List<Long> collect = userRoleDOS.stream().map(item -> item.getRoleId()).collect(Collectors.toList()); // final List<Long> collect = userRoleDOS.stream().map(item -> item.getRoleId()).collect(Collectors.toList());
//判断 collect 里面是否包含 roleId = 11 // //判断 collect 里面是否包含 roleId = 11
if (collect.contains(11L)) { // if (collect.contains(11L)) {
// //队长 //// //队长
// pageReqVO.setUserId(null); //// pageReqVO.setUserId(null);
// pageReqVO.setDeptId(null); //// pageReqVO.setDeptId(null);
} else if (collect.contains(155L)) { // } else if (collect.contains(155L)) {
//专管员 // //专管员
pageReqVO.setUserId(getLoginUserId()); // pageReqVO.setUserId(getLoginUserId());
} // }
// pageReqVO.setCreate(getLoginUserId().toString()); // pageReqVO.setCreate(getLoginUserId().toString());
final PageResult<EnterpriseDO> enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO); final PageResult<EnterpriseDO> enterpriseDOPageResult = enterpriseMapper.selectPage(pageReqVO);

3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeService.java

@ -1,10 +1,11 @@
package cn.iocoder.yudao.module.system.service.home; package cn.iocoder.yudao.module.system.service.home;
import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO;
import cn.iocoder.yudao.module.system.controller.home.vo.HomeCountResVO;
import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO;
import java.util.List; import java.util.List;
public interface HomeService { public interface HomeService {
List<InspectionsLogAppListVO> appCount1(HomeSelectVO homeSelectVO); HomeCountResVO appCount1(HomeSelectVO homeSelectVO);
} }

70
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/home/HomeServiceImpl.java

@ -1,15 +1,83 @@
package cn.iocoder.yudao.module.system.service.home; package cn.iocoder.yudao.module.system.service.home;
import cn.iocoder.yudao.module.system.controller.admin.enterprise.vo.EnterprisePageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO; import cn.iocoder.yudao.module.system.controller.admin.inspectionslog.vo.InspectionsLogAppListVO;
import cn.iocoder.yudao.module.system.controller.home.vo.HomeCountResVO;
import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO; import cn.iocoder.yudao.module.system.controller.home.vo.HomeSelectVO;
import cn.iocoder.yudao.module.system.dal.dataobject.enterprise.EnterpriseDO;
import cn.iocoder.yudao.module.system.dal.mysql.enterprise.EnterpriseMapper;
import cn.iocoder.yudao.module.system.dal.mysql.enterprisetag.EnterpriseTagMapper;
import cn.iocoder.yudao.module.system.dal.mysql.taskinfo.TaskInfoMapper;
import cn.iocoder.yudao.module.system.service.dept.DeptService;
import cn.iocoder.yudao.module.system.service.enterprise.EnterpriseService;
import cn.iocoder.yudao.module.system.service.taskinfo.TaskInfoService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@Service @Service
public class HomeServiceImpl implements HomeService{ public class HomeServiceImpl implements HomeService{
@Resource
private EnterpriseMapper enterpriseMapper;
@Resource
private TaskInfoService taskInfoService;
@Resource
private TaskInfoMapper taskInfoMapper;
@Resource
private EnterpriseTagMapper enterpriseTagMapper;
@Resource
private AdminUserService adminUserService;
@Resource
private DeptService deptService;
@Override @Override
public List<InspectionsLogAppListVO> appCount1(HomeSelectVO homeSelectVO) { public HomeCountResVO appCount1(HomeSelectVO homeSelectVO) {
HomeCountResVO homeCountResVO = new HomeCountResVO();
LambdaQueryWrapper<EnterpriseDO> enterpriseDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
//按时间查询
if (homeSelectVO.getSelectWeek() != null) {
LocalDateTime now = LocalDateTime.now();
LocalDateTime[] dateList = new LocalDateTime[2];
switch (homeSelectVO.getSelectWeek()) {
case 1:
dateList[0] = now.minusDays(3); // 三天前
break;
case 2:
dateList[0] = now.minusWeeks(1); // 一周前
break;
case 3:
dateList[0] = now.minusMonths(1); // 一月前
break;
case 4:
dateList[0] = now.minusYears(1); // 一年前
break;
}
dateList[1] = now;
enterpriseDOLambdaQueryWrapper.between(EnterpriseDO::getCreateTime, dateList[0], dateList[1]);
}
final Long enterpriseCount = enterpriseMapper.selectCount(enterpriseDOLambdaQueryWrapper);
homeCountResVO.setEnterpriseCount(enterpriseCount);
// taskInfoService.getTaskInfoAppPage()
//根据不同的身份查询
return null; return null;
// return List.of(); // return List.of();
} }

126
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/taskinfo/TaskInfoServiceImpl.java

@ -207,91 +207,84 @@ public class TaskInfoServiceImpl implements TaskInfoService {
@Override @Override
public PageResult<TaskInfoDO> getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO) { public PageResult<TaskInfoDO> getTaskInfoAppPage(TaskInfoPageReqVO pageReqVO) {
//按标签查询 // //按标签查询
if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) { // if (pageReqVO.getTagList() != null && pageReqVO.getTagList().size() > 0) {
LambdaQueryWrapper<TaskTagDO> wrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<TaskTagDO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(TaskTagDO::getTagId, pageReqVO.getTagList()); // wrapper.in(TaskTagDO::getTagId, pageReqVO.getTagList());
final List<TaskTagDO> taskTagDOS = taskTagMapper.selectList(wrapper); // final List<TaskTagDO> taskTagDOS = taskTagMapper.selectList(wrapper);
if (taskTagDOS != null && taskTagDOS.size() > 0) { // if (taskTagDOS != null && taskTagDOS.size() > 0) {
pageReqVO.setTagList(taskTagDOS.stream().map(item->item.getTaskId()).collect(Collectors.toList())); // pageReqVO.setTagList(taskTagDOS.stream().map(item->item.getTaskId()).collect(Collectors.toList()));
} // }
} // }
//按时间查询 //按时间查询
if (pageReqVO.getSelectWeek() != null) { if (pageReqVO.getSelectWeek() != null) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
LocalDateTime[] dateList = new LocalDateTime[2];
pageReqVO.setEndTime(now);
LocalDateTime startTime = null;
switch (pageReqVO.getSelectWeek()) { switch (pageReqVO.getSelectWeek()) {
case 1: case 1:
dateList[0] = now.minusDays(3); // 三天前 startTime = now.minusDays(3); // 三天前
break; break;
case 2: case 2:
dateList[0] = now.minusWeeks(1); // 一周前 startTime = now.minusWeeks(1); // 一周前
break; break;
case 3: case 3:
dateList[0] = now.minusMonths(1); // 一月前 startTime = now.minusMonths(1); // 一月前
break; break;
case 4: case 4:
dateList[0] = now.minusYears(1); // 一年前 startTime = now.minusYears(1); // 一年前
break; break;
} }
dateList[1] = now;
pageReqVO.setEndDate(dateList); pageReqVO.setStartTime(startTime);
}
//根据不同的角色查询
/*
管理员局长查全部
检查员查自己的
队长 查本部门
*/
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
final AdminUserDO user1 = adminUserService.getUser(loginUserId);
if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) {
//全部
} else if (user1.getPostIds().contains(4l)) {
//本部门
pageReqVO.setDeptId(user1.getDeptId());
} else if (user1.getPostIds().contains(5l)) {
//自己
pageReqVO.setUserId(loginUserId);
} }
final PageResult<TaskInfoDO> taskInfoDOPageResult = taskInfoMapper.selectAppPage(pageReqVO); // final PageResult<TaskInfoDO> taskInfoDOPageResult = taskInfoMapper.selectAppPage(pageReqVO);
if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) {
taskInfoDOPageResult.getList().forEach(item->{
QueryWrapper<EnterpriseInspectionsDO> wrapper = new QueryWrapper<>();
wrapper.eq("task_id", item.getId());
//根据不同的角色查询
/*
管理员局长查全部
检查员查自己的
队长 查本部门
*/
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
final AdminUserDO user1 = adminUserService.getUser(loginUserId);
if (user1.getPostIds().contains(1l) || user1.getPostIds().contains(2l)) {
//全部
} else if (user1.getPostIds().contains(4l)) {
//本部门
final List<AdminUserDO> adminUserDOS = adminUserMapper.selectList(new QueryWrapper<AdminUserDO>().eq("dept_id", user1.getDeptId()));
if (adminUserDOS != null || adminUserDOS.size() > 0) {
final List<Long> collect = adminUserDOS.stream().map(res -> res.getId()).collect(Collectors.toList());
wrapper.in("user_id", collect);
}
} else if (user1.getPostIds().contains(5l)) {
//自己
wrapper.eq("user_id", loginUserId);
}
item.setTaskExecNum(0); Page<TaskInfoDO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
final IPage<TaskInfoDO> taskInfoDOIPage = taskInfoMapper.selectMyPage(page, pageReqVO);
final PageResult<TaskInfoDO> taskInfoDOPageResult = new PageResult<>(taskInfoDOIPage.getRecords(), taskInfoDOIPage.getTotal());
List<EnterpriseInspectionsDO> enterpriseInspectionsDOList = enterpriseInspectionsMapper.selectList(wrapper); if (taskInfoDOPageResult.getList() != null && taskInfoDOPageResult.getList().size() > 0) {
log.info("enterpriseInspectionsDOList:{}", enterpriseInspectionsDOList); taskInfoDOPageResult.getList().forEach(item->{
if (enterpriseInspectionsDOList != null && enterpriseInspectionsDOList.size() > 0) { // item.setTaskExecNum(0);
item.setTaskExecNum(enterpriseInspectionsDOList.size()); //
final List<EnterpriseInspectionsDO> collect = enterpriseInspectionsDOList.stream().filter(res -> res.getStatus() == 5).collect(Collectors.toList()); // List<EnterpriseInspectionsDO> enterpriseInspectionsDOList = enterpriseInspectionsMapper.selectList(wrapper);
item.setTaskFinishNum(collect.size()); // log.info("enterpriseInspectionsDOList:{}", enterpriseInspectionsDOList);
} // if (enterpriseInspectionsDOList != null && enterpriseInspectionsDOList.size() > 0) {
// item.setTaskExecNum(enterpriseInspectionsDOList.size());
// final List<EnterpriseInspectionsDO> collect = enterpriseInspectionsDOList.stream().filter(res -> res.getStatus() == 5).collect(Collectors.toList());
// item.setTaskFinishNum(collect.size());
// }
//获取任务标签 //获取任务标签
QueryWrapper<TaskTagDO> wrapper1 = new QueryWrapper<>(); final List<TagLibraryDO> tagLibraryDOS1 = tagLibraryService.listByTaskId(item.getId());
wrapper1.eq("task_id", item.getId()); if (tagLibraryDOS1 != null && tagLibraryDOS1.size() > 0) {
List<TaskTagDO> taskTagDOList = taskTagMapper.selectList(wrapper1); item.setTagList(tagLibraryDOS1.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList()));
if (taskTagDOList != null && taskTagDOList.size() > 0) {
final List<Long> collect = taskTagDOList.stream().map(TaskTagDO::getTagId).collect(Collectors.toList());
final List<TagLibraryDO> tagLibraryDOS = tagLibraryMapper.selectByIds(collect);
if (tagLibraryDOS != null && tagLibraryDOS.size() > 0) {
item.setTagList(tagLibraryDOS.stream().map(TagLibraryDO::getTagName).collect(Collectors.toList()));
}
} }
enterpriseInspectionsMapper.selectList();
}); });
} }
@ -317,9 +310,10 @@ public class TaskInfoServiceImpl implements TaskInfoService {
LambdaQueryWrapper<EnterpriseInspectionsDO> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<EnterpriseInspectionsDO> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(EnterpriseInspectionsDO::getTaskId, item.getId()); wrapper.eq(EnterpriseInspectionsDO::getTaskId, item.getId());
wrapper.eq(EnterpriseInspectionsDO::getEnterpriseId, pageReqVO.getEnterpriseId()); wrapper.eq(EnterpriseInspectionsDO::getEnterpriseId, pageReqVO.getEnterpriseId());
final EnterpriseInspectionsDO enterpriseInspectionsDO = enterpriseInspectionsMapper.selectOne(wrapper); final List<EnterpriseInspectionsDO> enterpriseInspectionsDO = enterpriseInspectionsMapper.selectList(wrapper);
if (enterpriseInspectionsDO != null && enterpriseInspectionsDO.size() > 0) {
item.setInspectionsId(enterpriseInspectionsDO.getId()); item.setInspectionsId(enterpriseInspectionsDO.get(0).getId());
}
//发布部门, //发布部门,
final Long userId = Long.valueOf(item.getCreator()); final Long userId = Long.valueOf(item.getCreator());

51
yudao-module-system/yudao-module-system-biz/src/main/resources/mapper/taskinfo/TaskInfoMapper.xml

@ -12,33 +12,48 @@
<select id="selectMyPage" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO"> <select id="selectMyPage" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO">
SELECT SELECT
t.*, t.*,
count(ei.task_id), count(ei.task_id) as taskExecNum,
SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) AS status_2_count SUM(CASE WHEN il.status = 2 THEN 1 ELSE 0 END) AS taskFinishNum
FROM task_info t FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id left join enterprise_inspections ei on t.id = ei.task_id
left join inspections_log il on ei.id = il.inspections_id left join inspections_log il on ei.id = il.inspections_id
left join enterprises e on e.id = ei.enterprise_id left join enterprises e on e.id = ei.enterprise_id
left join task_tag tt on t.id = tt.task_id
left join tag_library tl on tl.id = tt.tag_id
WHERE WHERE
t.deleted = 0 and ei.deleted = 0 and il.deleted = 0 GROUP BY t.id t.deleted = 0 and ei.deleted = 0 and t.status = 2
<if test="userId != null and userId != ''"> <if test="params.userId != null and params.userId != ''">
AND t.user_id = #{userId} AND ei.user_id = #{params.userId}
</if> </if>
<if test="deptId != null and deptId != ''"> <if test="params.priority != null and params.priority != ''">
AND e.department_id = #{deptId} AND t.priority = #{params.priority}
</if> </if>
<if test="params.status != null and params.status != ''">
# ORDER BY t.create_time DESC AND t.priority = #{params.status}
# LIMIT #{offset}, #{rows} </if>
<if test="params.deptId != null and params.deptId != ''">
AND e.department_id = #{params.deptId}
</if>
<if test="params.endTime != null and params.endTime != ''">
AND t.end_date between #{params.startTime} and #{params.endTime}
</if>
<if test="params.tagList != null and params. tagList != ''">
AND tl.id in
<foreach collection="params.tagList" item="tagId" open="(" separator="," close=")">
#{tagId}
</foreach>
</if>
GROUP BY t.id
</select> </select>
<select id="selectPageByEnterpriseId" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO"> <select id="selectPageByEnterpriseId" resultType="cn.iocoder.yudao.module.system.dal.dataobject.taskinfo.TaskInfoDO">
SELECT SELECT
t.* t.*
FROM task_info t FROM task_info t
left join enterprise_inspections ei on t.id = ei.task_id left join enterprise_inspections ei on t.id = ei.task_id
WHERE WHERE
t.deleted = 0 and ei.deleted = 0 and ei.enterprise_id = #{reqVO.enterpriseId} t.deleted = 0 and ei.deleted = 0 and ei.enterprise_id = #{reqVO.enterpriseId}
GROUP BY t.id GROUP BY t.id
ORDER BY t.create_time DESC ORDER BY t.create_time DESC
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save