From 16d63c3d68d131ad0cc4a8bd9f22a0c0515aa6bf Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期三, 17 七月 2024 18:23:57 +0800
Subject: [PATCH] 工时的各需求+检验任务修改

---
 inspect-server/src/main/resources/mapper/InsSampleMapper.xml |  395 +++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 249 insertions(+), 146 deletions(-)

diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
index 32195f8..e822231 100644
--- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
+++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml
@@ -3,7 +3,6 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yuanchu.mom.mapper.InsSampleMapper">
-
     <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.InsSample">
         <id property="id" column="id" jdbcType="INTEGER"/>
         <result property="insResult" column="ins_result" jdbcType="INTEGER"/>
@@ -26,7 +25,7 @@
     </resultMap>
 
     <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO">
-        select * from(
+        select * from(select * from(
         SELECT
         a.*,ios.ins_state,ios.verify_tell,isu2.order_user_id,(ios.verify_user = #{userId}) verify_user
         FROM
@@ -48,7 +47,7 @@
         LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id
         WHERE
         io.state = 1
-#         AND io.ins_state != 5
+        # AND io.ins_state != 5
         and send_time is not null
         and (isu.user_id = #{userId} OR isu.user_id is NULL)
         GROUP BY
@@ -56,12 +55,15 @@
         io.id
         ) a
         LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory
-        left join (SELECT td.user_id order_user_id, td.ins_sample_id FROM ins_sample_user td,(SELECT max(id) id FROM ins_sample_user GROUP BY ins_sample_id) md  where td.id = md.id and user_id = #{userId}) isu2 on isu2.ins_sample_id = a.id
+        left join (SELECT td.user_id order_user_id, td.ins_sample_id FROM ins_sample_user td,(SELECT max(id) id FROM
+        ins_sample_user GROUP BY ins_sample_id) md where td.id = md.id and user_id = #{userId}) isu2 on
+        isu2.ins_sample_id = a.id
         ORDER BY
         a.user_id DESC,
         a.type DESC,
         a.id
         ) b
+        where ins_state is not null)A
         <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
             ${ew.customSqlSegment}
         </if>
@@ -90,7 +92,7 @@
         LEFT JOIN ins_product ip ON ip.ins_sample_id = isa.id
         WHERE
         io.state = 1
-        #         AND io.ins_state != 5
+        # AND io.ins_state != 5
         and send_time is not null
         and (isu.user_id = #{userId} OR isu.user_id is NULL)
         GROUP BY
@@ -98,7 +100,9 @@
         io.id
         ) a
         LEFT JOIN ins_order_state ios ON ios.ins_order_id = a.id AND ios.laboratory = a.son_laboratory
-        left join (SELECT td.user_id order_user_id, td.ins_sample_id FROM ins_sample_user td,(SELECT max(id) id FROM ins_sample_user GROUP BY ins_sample_id) md  where td.id = md.id and user_id = #{userId}) isu2 on isu2.ins_sample_id = a.id
+        left join (SELECT td.user_id order_user_id, td.ins_sample_id FROM ins_sample_user td,(SELECT max(id) id FROM
+        ins_sample_user GROUP BY ins_sample_id) md where td.id = md.id and user_id = #{userId}) isu2 on
+        isu2.ins_sample_id = a.id
         ORDER BY
         a.user_id DESC,
         a.type DESC,
@@ -111,20 +115,20 @@
 
     <select id="selectSampleProductListByOrderId" resultMap="sampleDto">
         select isa.*,
-               ip.id ip_id,
+               ip.id          ip_id,
                inspection_item,
                inspection_item_en,
                inspection_item_class,
                inspection_item_class_en,
                inspection_item_subclass,
                inspection_item_subclass_en,
-               ip.factory ip_factory,
-               ip.laboratory ip_laboratory,
+               ip.factory     ip_factory,
+               ip.laboratory  ip_laboratory,
                ip.sample_type ip_sample_type,
-               ip.sample ip_sample,
-               ip.model ip_model,
+               ip.sample      ip_sample,
+               ip.model       ip_model,
                son_laboratory,
-               ip.unit ip_unit,
+               ip.unit        ip_unit,
                price,
                man_hour,
                man_hour_group,
@@ -138,116 +142,9 @@
                man_day,
                bsm,
                ask,
+               tell,
                `last_value`,
-               ip.ins_result ip_ins_result,
-               state,
-               ins_sample_id,
-               ip.create_user ip_create_user,
-               ip.update_user ip_update_user,
-               ip.create_time ip_create_time,
-               ip.update_time ip_update_time,
-               template_id,
-               ipr.ins_value,
-               ipr.com_value,
-               ipr.equip_value,
-               ip.method_s
-        from ins_sample isa
-        left join ins_product ip on isa.id = ip.ins_sample_id
-        left join ins_product_result ipr on ip.id = ipr.ins_product_id
-        where ins_order_id = #{id}
-        and state = 1
-        and ins_fiber_id is null
-        and ins_fibers_id is null
-    </select>
-    <select id="getInsOrderAndSample" resultMap="sampleDto">
-        select isa.*,
-               ip.id ip_id,
-               inspection_item,
-               inspection_item_en,
-               inspection_item_class,
-               inspection_item_class_en,
-               inspection_item_subclass,
-               inspection_item_subclass_en,
-               ip.factory ip_factory,
-               ip.laboratory ip_laboratory,
-               ip.sample_type ip_sample_type,
-               ip.sample ip_sample,
-               ip.model ip_model,
-               son_laboratory,
-               ip.unit ip_unit,
-               price,
-               man_hour,
-               man_hour_group,
-               inspection_item_type,
-               inspection_value_type,
-               device_group,
-               checkout_number,
-               section,
-               value_type,
-               method,
-               man_day,
-               bsm,
-               ask,
-               `last_value`,
-               ip.ins_result ip_ins_result,
-               state,
-               ins_sample_id,
-               ip.create_user ip_create_user,
-               ip.update_user ip_update_user,
-               ip.create_time ip_create_time,
-               ip.update_time ip_update_time,
-               template_id,
-               ipr.ins_value,
-               ipr.com_value,
-               ipr.equip_value,
-               ipr.equip_name,
-               ip.method_s,
-               ip.tell,
-               ip.dic
-        from ins_sample isa
-        left join ins_product ip on isa.id = ip.ins_sample_id
-        left join ins_product_result ipr on ip.id = ipr.ins_product_id
-        where ins_order_id = #{id}
-        and state = 1
-        and ip.son_laboratory = #{laboratory}
-        and ins_fiber_id is null
-        and ins_fibers_id is null
-    </select>
-    <select id="getSampleEn" resultType="java.lang.String">
-        select name_en from `center-lims`.product
-        where name = #{sample}
-    </select>
-    <select id="selectSampleProductListByOrderId2" resultMap="sampleDto">
-        select isa.*,
-               ip.id ip_id,
-               inspection_item,
-               inspection_item_en,
-               inspection_item_subclass,
-               inspection_item_subclass_en,
-               inspection_item_class,
-               inspection_item_class_en,
-               ip.factory ip_factory,
-               ip.laboratory ip_laboratory,
-               ip.sample_type ip_sample_type,
-               ip.sample ip_sample,
-               ip.model ip_model,
-               son_laboratory,
-               ip.unit ip_unit,
-               price,
-               man_hour,
-               man_hour_group,
-               inspection_item_type,
-               inspection_value_type,
-               device_group,
-               checkout_number,
-               section,
-               value_type,
-               method,
-               man_day,
-               bsm,
-               ask,
-               `last_value`,
-               ip.ins_result ip_ins_result,
+               ip.ins_result  ip_ins_result,
                state,
                ins_sample_id,
                ip.create_user ip_create_user,
@@ -264,20 +161,26 @@
                  left join ins_product_result ipr on ip.id = ipr.ins_product_id
         where ins_order_id = #{id}
           and state = 1
+          and ins_fiber_id is null
+          and ins_fibers_id is null
+        and isa.sample_code NOT REGEXP '/'
     </select>
-    <select id="getInsProduct1" resultMap="product">
-        select ip.id ip_id,
+    <select id="getInsOrderAndSample" resultMap="sampleDto">
+        select isa.*,
+               ip.id          ip_id,
                inspection_item,
                inspection_item_en,
+               inspection_item_class,
+               inspection_item_class_en,
                inspection_item_subclass,
                inspection_item_subclass_en,
-               ip.factory ip_factory,
-               ip.laboratory ip_laboratory,
+               ip.factory     ip_factory,
+               ip.laboratory  ip_laboratory,
                ip.sample_type ip_sample_type,
-               ip.sample ip_sample,
-               ip.model ip_model,
+               ip.sample      ip_sample,
+               ip.model       ip_model,
                son_laboratory,
-               ip.unit ip_unit,
+               ip.unit        ip_unit,
                price,
                man_hour,
                man_hour_group,
@@ -292,7 +195,143 @@
                bsm,
                ask,
                `last_value`,
-               ip.ins_result ip_ins_result,
+               ip.ins_result  ip_ins_result,
+               state,
+               ins_sample_id,
+               ip.create_user ip_create_user,
+               ip.update_user ip_update_user,
+               ip.create_time ip_create_time,
+               ip.update_time ip_update_time,
+               template_id,
+               ipr.ins_value,
+               ipr.com_value,
+               ipr.equip_value,
+               ipr.equip_name,
+               ip.method_s,
+               ip.tell,
+               ip.dic,
+               ip.temperature,
+               ip.humidity
+        from ins_sample isa
+                 left join ins_product ip on isa.id = ip.ins_sample_id
+                 left join ins_product_result ipr on ip.id = ipr.ins_product_id
+        where ins_order_id = #{id}
+          and state = 1
+          and ip.son_laboratory = #{laboratory}
+          and ins_fiber_id is null
+          and ins_fibers_id is null
+    </select>
+    <select id="getSampleEn" resultType="java.lang.String">
+        select name_en
+        from `center-lims`.product
+        where name = #{sample}
+    </select>
+    <select id="selectSampleProductListByOrderId2" resultMap="sampleDto">
+        select isa.*,
+               ip.id          ip_id,
+               inspection_item,
+               inspection_item_en,
+               inspection_item_subclass,
+               inspection_item_subclass_en,
+               inspection_item_class,
+               inspection_item_class_en,
+               ip.factory     ip_factory,
+               ip.laboratory  ip_laboratory,
+               ip.sample_type ip_sample_type,
+               ip.sample      ip_sample,
+               ip.model       ip_model,
+               son_laboratory,
+               ip.unit        ip_unit,
+               price,
+               man_hour,
+               man_hour_group,
+               inspection_item_type,
+               inspection_value_type,
+               device_group,
+               checkout_number,
+               section,
+               value_type,
+               method,
+               man_day,
+               bsm,
+               tell as ask,
+               `last_value`,
+               ip.ins_result  ip_ins_result,
+               state,
+               ins_sample_id,
+               ip.create_user ip_create_user,
+               ip.update_user ip_update_user,
+               ip.create_time ip_create_time,
+               ip.update_time ip_update_time,
+               template_id,
+               ipr.ins_value,
+               ipr.com_value,
+               ipr.equip_value,
+               ip.method_s
+        from ins_sample isa
+                 left join ins_product ip on isa.id = ip.ins_sample_id
+                 left join ins_product_result ipr on ip.id = ipr.ins_product_id
+        where ins_order_id = #{id}
+            and template_id is not null
+          and state = 1
+    </select>
+
+    <select id="selectSampleProductListByOrderId3" resultMap="sampleDto3">
+        select isa.id,
+        sample_code,
+        entrust_code,
+        is_leave,
+        isa.model,
+        isa.ins_state,
+        ip.id ip_id,
+        inspection_item,
+        inspection_item_subclass,
+        io.sample_type io_sample_type,
+        ip.sample ip_sample,
+        ip.model ip_model,
+        ip.state,
+        ins_sample_id
+        from ins_sample isa
+        left join ins_product ip on isa.id = ip.ins_sample_id
+        left join ins_product_result ipr on ip.id = ipr.ins_product_id
+        left join ins_order io on io.id = ins_order_id
+        where ip.state = 1
+        and ins_order_id in
+        <foreach collection="ids" open="(" close=")" item="id" separator=",">
+            #{id}
+        </foreach>
+    </select>
+
+    <select id="getInsProduct1" resultMap="product">
+        select ip.id          ip_id,
+               inspection_item,
+               inspection_item_en,
+               inspection_item_class,
+               inspection_item_class_en,
+               inspection_item_subclass,
+               inspection_item_subclass_en,
+               ip.factory     ip_factory,
+               ip.laboratory  ip_laboratory,
+               ip.sample_type ip_sample_type,
+               ip.sample      ip_sample,
+               ip.model       ip_model,
+               son_laboratory,
+               ip.unit        ip_unit,
+               price,
+               man_hour,
+               man_hour_group,
+               inspection_item_type,
+               inspection_value_type,
+               device_group,
+               checkout_number,
+               section,
+               value_type,
+               method,
+               man_day,
+               bsm,
+               ask,
+               `last_value`,
+               ip.ins_result  ip_ins_result,
                state,
                ins_sample_id,
                ip.create_user ip_create_user,
@@ -308,7 +347,7 @@
                ip.tell,
                ip.dic
         from ins_product ip
-        left join ins_product_result ipr on ip.id = ipr.ins_product_id
+                 left join ins_product_result ipr on ip.id = ipr.ins_product_id
         where ins_sample_id = #{id}
           and state = 1
           and ip.son_laboratory = #{laboratory}
@@ -316,20 +355,20 @@
           and ins_fibers_id is null
     </select>
     <select id="getInsProduct2" resultMap="product">
-        select ip.id ip_id,
+        select ip.id          ip_id,
                inspection_item,
                inspection_item_en,
                inspection_item_class,
                inspection_item_class_en,
                inspection_item_subclass,
                inspection_item_subclass_en,
-               ip.factory ip_factory,
-               ip.laboratory ip_laboratory,
+               ip.factory     ip_factory,
+               ip.laboratory  ip_laboratory,
                ip.sample_type ip_sample_type,
-               ip.sample ip_sample,
-               ip.model ip_model,
+               ip.sample      ip_sample,
+               ip.model       ip_model,
                son_laboratory,
-               ip.unit ip_unit,
+               ip.unit        ip_unit,
                price,
                man_hour,
                man_hour_group,
@@ -344,7 +383,7 @@
                bsm,
                ask,
                `last_value`,
-               ip.ins_result ip_ins_result,
+               ip.ins_result  ip_ins_result,
                state,
                ins_sample_id,
                ip.create_user ip_create_user,
@@ -360,26 +399,26 @@
                ip.tell,
                ip.dic
         from ins_product ip
-        left join ins_product_result ipr on ip.id = ipr.ins_product_id
+                 left join ins_product_result ipr on ip.id = ipr.ins_product_id
         where ins_fibers_id = #{id}
           and state = 1
           and ins_fiber_id is null
     </select>
     <select id="getInsProduct3" resultMap="product">
-        select ip.id ip_id,
+        select ip.id          ip_id,
                inspection_item,
                inspection_item_en,
                inspection_item_class,
                inspection_item_class_en,
                inspection_item_subclass,
                inspection_item_subclass_en,
-               ip.factory ip_factory,
-               ip.laboratory ip_laboratory,
+               ip.factory     ip_factory,
+               ip.laboratory  ip_laboratory,
                ip.sample_type ip_sample_type,
-               ip.sample ip_sample,
-               ip.model ip_model,
+               ip.sample      ip_sample,
+               ip.model       ip_model,
                son_laboratory,
-               ip.unit ip_unit,
+               ip.unit        ip_unit,
                price,
                man_hour,
                man_hour_group,
@@ -394,7 +433,7 @@
                bsm,
                ask,
                `last_value`,
-               ip.ins_result ip_ins_result,
+               ip.ins_result  ip_ins_result,
                state,
                ins_sample_id,
                ip.create_user ip_create_user,
@@ -410,10 +449,12 @@
                ip.tell,
                ip.dic
         from ins_product ip
-        left join ins_product_result ipr on ip.id = ipr.ins_product_id
+                 left join ins_product_result ipr on ip.id = ipr.ins_product_id
         where ins_fiber_id = #{id}
           and state = 1
           and ins_fibers_id is null
+    </select>
+    <select id="getReportModel" resultType="java.util.Map">
     </select>
 
     <resultMap id="sampleDto" type="com.yuanchu.mom.dto.SampleProductDto">
@@ -468,6 +509,7 @@
         <result property="manDay" column="man_day" jdbcType="INTEGER"/>
         <result property="bsm" column="bsm" jdbcType="VARCHAR"/>
         <result property="ask" column="ask" jdbcType="VARCHAR"/>
+        <result property="tell" column="tell" jdbcType="VARCHAR"/>
         <result property="lastValue" column="last_value" jdbcType="VARCHAR"/>
         <result property="insResult" column="ip_ins_result" jdbcType="INTEGER"/>
         <result property="state" column="state" jdbcType="INTEGER"/>
@@ -480,7 +522,36 @@
         <result property="methodS" column="method_s"/>
         <result property="tell" column="tell"/>
         <result property="dic" column="dic"/>
+        <result property="temperature" column="temperature"/>
+        <result property="humidity" column="humidity"/>
         <collection property="insProductResult" resultMap="insProductResult"/>
+    </resultMap>
+
+    <resultMap id="sampleDto3" type="com.yuanchu.mom.dto.SampleProductDto3">
+        <id property="id" column="id" jdbcType="INTEGER"/>
+        <result property="insResult" column="ins_result" jdbcType="INTEGER"/>
+        <result property="insOrderId" column="ins_order_id" jdbcType="INTEGER"/>
+        <result property="joinModel" column="join_model" jdbcType="VARCHAR"/>
+        <result property="joinName" column="join_name" jdbcType="VARCHAR"/>
+        <result property="ioSampleType" column="io_sample_type" jdbcType="VARCHAR"/>
+        <result property="code" column="entrust_code" jdbcType="VARCHAR"/>
+        <result property="isLeave" column="is_leave" jdbcType="VARCHAR"/>
+        <result property="sampleCode" column="sample_code" jdbcType="VARCHAR"/>
+        <result property="factory" column="factory" jdbcType="VARCHAR"/>
+        <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
+        <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
+        <result property="sample" column="sample" jdbcType="VARCHAR"/>
+        <result property="model" column="model" jdbcType="VARCHAR"/>
+        <result property="insState" column="ins_state" jdbcType="INTEGER"/>
+        <result property="joinNum" column="join_num" jdbcType="INTEGER"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="createUser" column="create_user" jdbcType="INTEGER"/>
+        <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="standardMethodListId" column="standard_method_list_id"/>
+        <result property="unit" column="unit"/>
+        <collection property="insProduct" resultMap="product"/>
     </resultMap>
 
     <resultMap id="insProductResult" type="com.yuanchu.mom.pojo.InsProductResult">
@@ -489,4 +560,36 @@
         <result property="equipValue" column="equip_value" jdbcType="VARCHAR"/>
         <result property="equipName" column="equip_name" jdbcType="VARBINARY"/>
     </resultMap>
+
+    <resultMap id="sampleVo" type="com.yuanchu.mom.vo.SampleVo">
+        <id property="id" column="id" jdbcType="INTEGER"/>
+        <result property="insResult" column="ins_result" jdbcType="INTEGER"/>
+        <result property="insOrderId" column="ins_order_id" jdbcType="INTEGER"/>
+        <result property="joinModel" column="join_model" jdbcType="VARCHAR"/>
+        <result property="joinName" column="join_name" jdbcType="VARCHAR"/>
+        <result property="sampleCode" column="sample_code" jdbcType="VARCHAR"/>
+        <result property="factory" column="factory" jdbcType="VARCHAR"/>
+        <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/>
+        <result property="sampleType" column="sample_type" jdbcType="VARCHAR"/>
+        <result property="sample" column="sample" jdbcType="VARCHAR"/>
+        <result property="model" column="model" jdbcType="VARCHAR"/>
+        <result property="insState" column="ins_state" jdbcType="INTEGER"/>
+        <result property="joinNum" column="join_num" jdbcType="INTEGER"/>
+        <result property="remark" column="remark" jdbcType="VARCHAR"/>
+        <result property="createUser" column="create_user" jdbcType="INTEGER"/>
+        <result property="updateUser" column="update_user" jdbcType="INTEGER"/>
+        <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
+        <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
+        <result property="standardMethodListId" column="standard_method_list_id"/>
+        <result property="methodName" column="methodName" jdbcType="VARCHAR"/>
+        <result property="unit" column="unit"/>
+    </resultMap>
+
+    <select id="getDetailById" resultMap="sampleVo">
+        select is2.*,
+               code methodName
+        from ins_sample is2
+                 inner join standard_method sm on standard_method_list_id = sm.id
+        where is2.id=#{sampleId}
+    </select>
 </mapper>

--
Gitblit v1.9.3