From b71fbb924499a4f19988f0f34bec7e01078a1d64 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期五, 18 八月 2023 08:57:27 +0800
Subject: [PATCH] 计量管理-》计划计量

---
 laboratory-server/src/main/resources/mapper/MeteringPlanMapper.xml |   50 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 46 insertions(+), 4 deletions(-)

diff --git a/laboratory-server/src/main/resources/mapper/MeteringPlanMapper.xml b/laboratory-server/src/main/resources/mapper/MeteringPlanMapper.xml
index efa48a6..762ec4c 100644
--- a/laboratory-server/src/main/resources/mapper/MeteringPlanMapper.xml
+++ b/laboratory-server/src/main/resources/mapper/MeteringPlanMapper.xml
@@ -19,15 +19,57 @@
         LEFT JOIN `user` u ON u.id = m.user_id
         LEFT JOIN instrument i ON i.`id` = m.`instrument_id`
         WHERE 1=1
-        and (m.state=1 and i.state=1)
+        and (m.state=1 and i.state=1 and m.result is not null)
         <if test="dto.code!=null and dto.code!=''">
-         and    i.`equipment_code` like concat('%',#{dto.code},'%')
+            and i.`equipment_code` like concat('%',#{dto.code},'%')
         </if>
         <if test="dto.name!=null and dto.name!=''">
-          and   i.`equipment_name` like concat('%',#{dto.name},'%')
+            and i.`equipment_name` like concat('%',#{dto.name},'%')
         </if>
         <if test="dto.name!=null and dto.name!=''">
-          and   i.measurement_unit like concat('%',#{dto.unit},'%')
+            and i.measurement_unit like concat('%',#{dto.unit},'%')
         </if>
     </select>
+
+    <select id="limitConditionMeteringPlan" resultMap="MeteringPlanAndInfoMap">
+        SELECT p.id id,
+        u.`name` createName,
+        p.planned_order_number plannedOrderNumber,
+        p.begin_time beginTime,
+        p.end_time endTime,
+        IF(IFNULL(i.result, 0) > 0, 1, 0) status,
+        (SELECT name FROM `user` u WHERE p.measure_person = u.id) measureName,
+        i.`code` iCode,
+        p.create_time createTime
+        FROM (SELECT id, measure_person, create_Person, begin_Time, end_Time, planned_order_number, create_time
+        from metering_plan
+        where 1=1
+        <if test="dto.plannedOrderNumber!=null and dto.plannedOrderNumber!=''">
+            and planned_order_number=#{plannedOrderNumber}
+        </if>
+        LIMIT #{limitPage.start},#{limitPage.end}) p
+        LEFT JOIN metrical_information i ON p.id = i.plan
+        LEFT JOIN `user` u ON p.create_Person = u.id
+        where 1 = 1
+    </select>
+    <select id="getTotal" resultType="java.util.Map">
+        select count(id) num from metering_plan where 1=1
+        <if test="dto.plannedOrderNumber!=null and dto.plannedOrderNumber!=''">
+            and planned_order_number=#{plannedOrderNumber}
+        </if>
+    </select>
+
+    <resultMap id="MeteringPlanAndInfoMap" type="meteringPlanAndInfo">
+        <result property="id" column="id"/>
+        <result property="createPerson" column="createName"/>
+        <result property="beginTime" column="beginTime"/>
+        <result property="endTime" column="endTime"/>
+        <result property="plannedOrderNumber" column="plannedOrderNumber"/>
+        <result property="measurePerson" column="measureName"/>
+        <result property="createTime" column="createTime"/>
+        <collection property="resultList" ofType="MetricalInformation">
+            <result property="code" column="iCode"/>
+            <result property="result" column="status"/>
+        </collection>
+    </resultMap>
 </mapper>

--
Gitblit v1.9.3