feat(hiddenDangerPlan): 新增隐患排查计划的完成未完成数量统计
为隐患排查计划VO新增已完成数、未完成数统计字段,编写自定义XML SQL统计各计划的完成情况,更新Mapper和Service使用新的查询逻辑
This commit is contained in:
@@ -97,5 +97,17 @@ public class HotHiddenDangerPlanVo implements Serializable {
|
|||||||
@ExcelProperty(value = "计划周期Key")
|
@ExcelProperty(value = "计划周期Key")
|
||||||
private String planDateKey;
|
private String planDateKey;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已完成数
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "已完成数")
|
||||||
|
private Long completedCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未完成数
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "未完成数")
|
||||||
|
private Long pendingCount;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,15 @@ package com.hotwj.platform.securityManagement.hiddenDangerPlan.mapper;
|
|||||||
|
|
||||||
import com.hotwj.platform.securityManagement.hiddenDangerPlan.domain.HotHiddenDangerPlan;
|
import com.hotwj.platform.securityManagement.hiddenDangerPlan.domain.HotHiddenDangerPlan;
|
||||||
import com.hotwj.platform.securityManagement.hiddenDangerPlan.domain.vo.HotHiddenDangerPlanVo;
|
import com.hotwj.platform.securityManagement.hiddenDangerPlan.domain.vo.HotHiddenDangerPlanVo;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 隐患排查Mapper接口
|
* 隐患排查Mapper接口
|
||||||
*
|
*
|
||||||
@@ -14,4 +20,8 @@ import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface HotHiddenDangerPlanMapper extends BaseMapperPlus<HotHiddenDangerPlan, HotHiddenDangerPlanVo> {
|
public interface HotHiddenDangerPlanMapper extends BaseMapperPlus<HotHiddenDangerPlan, HotHiddenDangerPlanVo> {
|
||||||
|
|
||||||
|
Page<HotHiddenDangerPlanVo> queryPageList(Page<HotHiddenDangerPlanVo> page,
|
||||||
|
@Param(Constants.WRAPPER) Wrapper<HotHiddenDangerPlan> queryWrapper);
|
||||||
|
|
||||||
|
List<HotHiddenDangerPlanVo> queryList(@Param(Constants.WRAPPER) Wrapper<HotHiddenDangerPlan> queryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ public class HotHiddenDangerPlanServiceImpl implements IHotHiddenDangerPlanServi
|
|||||||
@Override
|
@Override
|
||||||
public TableDataInfo<HotHiddenDangerPlanVo> queryPageList(HotHiddenDangerPlanBo bo, PageQuery pageQuery) {
|
public TableDataInfo<HotHiddenDangerPlanVo> queryPageList(HotHiddenDangerPlanBo bo, PageQuery pageQuery) {
|
||||||
LambdaQueryWrapper<HotHiddenDangerPlan> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<HotHiddenDangerPlan> lqw = buildQueryWrapper(bo);
|
||||||
Page<HotHiddenDangerPlanVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
Page<HotHiddenDangerPlanVo> result = baseMapper.queryPageList(pageQuery.build(), lqw);
|
||||||
return TableDataInfo.build(result);
|
return TableDataInfo.build(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ public class HotHiddenDangerPlanServiceImpl implements IHotHiddenDangerPlanServi
|
|||||||
@Override
|
@Override
|
||||||
public List<HotHiddenDangerPlanVo> queryList(HotHiddenDangerPlanBo bo) {
|
public List<HotHiddenDangerPlanVo> queryList(HotHiddenDangerPlanBo bo) {
|
||||||
LambdaQueryWrapper<HotHiddenDangerPlan> lqw = buildQueryWrapper(bo);
|
LambdaQueryWrapper<HotHiddenDangerPlan> lqw = buildQueryWrapper(bo);
|
||||||
return baseMapper.selectVoList(lqw);
|
return baseMapper.queryList(lqw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,4 +3,41 @@
|
|||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.hotwj.platform.securityManagement.hiddenDangerPlan.mapper.HotHiddenDangerPlanMapper">
|
<mapper namespace="com.hotwj.platform.securityManagement.hiddenDangerPlan.mapper.HotHiddenDangerPlanMapper">
|
||||||
|
<sql id="baseSelectWithStats">
|
||||||
|
SELECT
|
||||||
|
p.id,
|
||||||
|
p.company_id,
|
||||||
|
p.inspect_id,
|
||||||
|
p.inspect_name,
|
||||||
|
p.plan_name,
|
||||||
|
p.start_date,
|
||||||
|
p.end_date,
|
||||||
|
p.progress,
|
||||||
|
p.remark,
|
||||||
|
p.is_deleted,
|
||||||
|
p.is_auto_generated_by_backend,
|
||||||
|
p.plan_date_key,
|
||||||
|
COALESCE(stats.completed_count, 0) AS completedCount,
|
||||||
|
COALESCE(stats.pending_count, 0) AS pendingCount
|
||||||
|
FROM hot_hidden_danger_plan p
|
||||||
|
LEFT JOIN (
|
||||||
|
SELECT
|
||||||
|
i.plan_id,
|
||||||
|
SUM(CASE WHEN i.status IN (3, 9) THEN 1 ELSE 0 END) AS completed_count,
|
||||||
|
SUM(CASE WHEN i.status IS NULL OR i.status NOT IN (3, 9) THEN 1 ELSE 0 END) AS pending_count
|
||||||
|
FROM hot_hidden_danger_inspection i
|
||||||
|
WHERE i.is_deleted = 0
|
||||||
|
GROUP BY i.plan_id
|
||||||
|
) stats ON stats.plan_id = p.id
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="queryPageList" resultType="com.hotwj.platform.securityManagement.hiddenDangerPlan.domain.vo.HotHiddenDangerPlanVo">
|
||||||
|
<include refid="baseSelectWithStats"/>
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryList" resultType="com.hotwj.platform.securityManagement.hiddenDangerPlan.domain.vo.HotHiddenDangerPlanVo">
|
||||||
|
<include refid="baseSelectWithStats"/>
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user