|
|
@@ -0,0 +1,84 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="cn.iocoder.yudao.module.pms.dal.mysql.iotrddailyreport.IotRdDailyReportMapper">
|
|
|
+
|
|
|
+
|
|
|
+ <!-- 基础结果映射 -->
|
|
|
+ <resultMap id="BaseResultMap" type="cn.iocoder.yudao.module.pms.dal.dataobject.iotrddailyreport.IotRdDailyReportDO">
|
|
|
+ <!-- 根据实际字段配置 -->
|
|
|
+ <id column="id" property="id" />
|
|
|
+ <result column="dept_id" property="deptId" />
|
|
|
+ <result column="project_id" property="projectId" />
|
|
|
+ <result column="task_id" property="taskId" />
|
|
|
+ <result column="rd_status" property="rdStatus" />
|
|
|
+ <result column="construction_start_date" property="constructionStartDate" />
|
|
|
+ <result column="construction_end_date" property="constructionEndDate" />
|
|
|
+ <!-- 其他字段映射 -->
|
|
|
+ <result column="project_classification" property="projectClassification" />
|
|
|
+ <result column="daily_power_usage" property="dailyPowerUsage" />
|
|
|
+ <!-- 其他字段映射 -->
|
|
|
+ <result column="non_production_time" property="nonProductionTime" />
|
|
|
+ <result column="rd_npt_reason" property="rdNptReason" />
|
|
|
+ <result column="production_status" property="productionStatus" />
|
|
|
+ <result column="next_plan" property="nextPlan" />
|
|
|
+ <result column="personnel" property="personnel" />
|
|
|
+ <!-- 其他字段映射 -->
|
|
|
+ <result column="remark" property="remark" />
|
|
|
+ <result column="status" property="status" />
|
|
|
+ <result column="creator" property="creator" />
|
|
|
+ <result column="create_time" property="createTime" />
|
|
|
+ <result column="updater" property="updater" />
|
|
|
+ <result column="update_time" property="updateTime" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="selectListGrouped" resultMap="BaseResultMap"
|
|
|
+ parameterType="cn.iocoder.yudao.module.pms.controller.admin.iotrddailyreport.vo.IotRdDailyReportPageReqVO">
|
|
|
+ SELECT t1.*, g.min_start_date
|
|
|
+ FROM rq_iot_rd_daily_report t1
|
|
|
+ INNER JOIN (
|
|
|
+ SELECT
|
|
|
+ rd_status,
|
|
|
+ MIN(construction_start_date) as min_start_date
|
|
|
+ FROM rq_iot_rd_daily_report
|
|
|
+ <where>
|
|
|
+ <if test="reqVO.deptId != null">
|
|
|
+ AND dept_id = #{reqVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.projectId != null">
|
|
|
+ AND project_id = #{reqVO.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.taskId != null">
|
|
|
+ AND task_id = #{reqVO.taskId}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY rd_status
|
|
|
+ ) g ON t1.rd_status = g.rd_status
|
|
|
+ AND t1.construction_start_date = g.min_start_date
|
|
|
+ AND t1.rd_status <![CDATA[<>]]> ''
|
|
|
+ WHERE NOT EXISTS (
|
|
|
+ SELECT 1 FROM rq_iot_rd_daily_report t2
|
|
|
+ WHERE t2.rd_status = t1.rd_status
|
|
|
+ AND t2.construction_start_date < t1.construction_start_date
|
|
|
+ <if test="reqVO.deptId != null">
|
|
|
+ AND t2.dept_id = #{reqVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.projectId != null">
|
|
|
+ AND t2.project_id = #{reqVO.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.taskId != null">
|
|
|
+ AND t2.task_id = #{reqVO.taskId}
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ <if test="reqVO.deptId != null">
|
|
|
+ AND t1.dept_id = #{reqVO.deptId}
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.projectId != null">
|
|
|
+ AND t1.project_id = #{reqVO.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="reqVO.taskId != null">
|
|
|
+ AND t1.task_id = #{reqVO.taskId}
|
|
|
+ </if>
|
|
|
+ ORDER BY g.min_start_date ASC
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|