From 7b09f233bde70508f6db7e08e983e9a2c4bb3e99 Mon Sep 17 00:00:00 2001
From: XiaoRuby <3114200645@qq.com>
Date: 星期五, 11 八月 2023 17:50:23 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 standard-server/src/main/resources/mapper/DeviceMapper.xml |   30 +++++++++++++++++++++++++-----
 1 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/standard-server/src/main/resources/mapper/DeviceMapper.xml b/standard-server/src/main/resources/mapper/DeviceMapper.xml
index 8320a81..461895f 100644
--- a/standard-server/src/main/resources/mapper/DeviceMapper.xml
+++ b/standard-server/src/main/resources/mapper/DeviceMapper.xml
@@ -10,7 +10,7 @@
     </select>
 
     <resultMap id="deviceTwoTreeOneMap" type="map">
-        <id property="father" column="father"/>
+        <id property="name" column="father"/>
         <collection property="children" resultMap="deviceTwoTreeTwoMap" javaType="List"/>
     </resultMap>
 
@@ -23,15 +23,35 @@
         SELECT d.`id`, d.`name`, d.`father`
         FROM device d
         WHERE d.state = 1
-        AND d.type = #{type}
+          AND d.type = #{type}
+            <if test="search_class !=null and search_class != ''">
+                AND d.`name` like concat('%',#{search_class},'%')
+            </if>
     </select>
 
     <select id="DevicePageList" resultType="Map">
-        SELECT * FROM device d
-                          LEFT JOIN raw_ins_product r
-                                    ON d.`id` = r.`device_id`
+        SELECT d.id, d.`code`, d.`name`, u.`name` keeper, DATE_FORMAT(d.`end_measure`,'%Y-%m-%d') end_measure, d.`device_status`, d.`factory`, r.`name` inspectProject, i.`name` testSample, i.`user_name`
+        FROM (device d, `user` u)
+                 LEFT JOIN raw_ins_product r
+                           ON d.`id` = r.`device_id`
+                 LEFT JOIN raw_inspect i
+                           ON r.`raw_inspect_id` = i.`id`
         WHERE r.`test_state` IS NULL
           AND d.`state` = 1
           AND (r.`state` = 1 OR r.`state` IS NULL)
+          AND d.`keeper` = u.`id`
+          AND d.type = #{type}
+        <if test="codeNameModel != null and codeNameModel != ''">
+            AND (d.`name` LIKE CONCAT('%',#{codeNameModel},'%') OR d.`code` LIKE CONCAT('%',#{codeNameModel},'%') OR i.`specifications` LIKE CONCAT('%',#{codeNameModel},'%'))
+        </if>
+        <if test="deviceStatue != null and deviceStatue != ''">
+            AND d.`device_status` = #{deviceStatue}
+        </if>
+        <if test="deviceId != null and deviceId != ''">
+            AND d.id = #{deviceId}
+        </if>
+        <if test="fatherName != null and fatherName != ''">
+            AND d.`father` = #{fatherName}
+        </if>
     </select>
 </mapper>

--
Gitblit v1.9.3