From 825da6ff9fbab76ca933930e35575cc8b0e811bd Mon Sep 17 00:00:00 2001 From: 李林 <z1292839451@163.com> Date: 星期二, 19 三月 2024 17:11:23 +0800 Subject: [PATCH] 功能大调整 --- inspect-server/src/main/resources/mapper/InsSampleMapper.xml | 230 ++++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 145 insertions(+), 85 deletions(-) diff --git a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml index 35f6dff..ba5484b 100644 --- a/inspect-server/src/main/resources/mapper/InsSampleMapper.xml +++ b/inspect-server/src/main/resources/mapper/InsSampleMapper.xml @@ -5,96 +5,156 @@ <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"/> - <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="isLeave" column="is_leave" jdbcType="INTEGER"/> - <result property="leaveNum" column="leave_num" jdbcType="INTEGER"/> - <result property="insProgress" column="ins_progress" jdbcType="VARCHAR"/> - <result property="insState" column="ins_state" jdbcType="INTEGER"/> - <result property="sendTime" column="send_time" jdbcType="TIMESTAMP"/> - <result property="joinNum" column="join_num" jdbcType="INTEGER"/> - <result property="remark" column="remark" jdbcType="VARCHAR"/> - <result property="appointed" column="appointed" jdbcType="TIMESTAMP"/> - <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"/> + <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="isLeave" column="is_leave" jdbcType="INTEGER"/> + <result property="leaveNum" column="leave_num" jdbcType="INTEGER"/> + <result property="insProgress" column="ins_progress" jdbcType="VARCHAR"/> + <result property="insState" column="ins_state" jdbcType="INTEGER"/> + <result property="sendTime" column="send_time" jdbcType="TIMESTAMP"/> + <result property="joinNum" column="join_num" jdbcType="INTEGER"/> + <result property="remark" column="remark" jdbcType="VARCHAR"/> + <result property="appointed" column="appointed" jdbcType="TIMESTAMP"/> + <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"/> </resultMap> - <sql id="Base_Column_List"> - id,ins_result,ins_order_id, - join_model,join_name,sample_code, - factory,laboratory,sample_type, - sample,model,is_leave, - leave_num,ins_progress,ins_state, - send_time,join_num,remark, - appointed,create_user,update_user, - create_time,update_time - </sql> <select id="findInsSampleAndOrder" resultType="com.yuanchu.mom.vo.InsOrderPlanVO"> SELECT DISTINCT - io.entrust_code, - io.type, - tempA.id, - tempA.sample, - tempA.sample_code, - tempA.send_time, - tempA.appointed, - tempA.ins_state, - tempA.ins_result, - tempA.user_id, - tempA.ins_order_id, - tempA.sample_user_id, - ipr.son_laboratory + io.entrust_code, + io.type, + tempA.id, + tempA.sample, + tempA.sample_code, + tempA.send_time, + tempA.appointed, + tempA.ins_state, + tempA.ins_result, + tempA.user_id, + tempA.ins_order_id, + tempA.sample_user_id, + ipr.son_laboratory FROM - ( - SELECT - temp.* - FROM - ( - SELECT - isa.id, - isa.sample, - isa.sample_code, - isa.send_time, - isa.appointed, - isa.ins_state, - isa.ins_result, - isu.user_id, - isa.ins_order_id, - isu.id as sample_user_id - FROM - ins_sample isa - LEFT JOIN ins_sample_user isu ON isa.id = isu.ins_sample_id - ) AS temp - WHERE - temp.user_id = #{ew.userId} - OR ( SELECT COUNT(*) FROM ins_sample_user WHERE ins_sample_id = temp.id ) = 0 - ) AS tempA - LEFT JOIN ins_order io ON tempA.ins_order_id = io.id - LEFT JOIN ins_product ipr ON tempA.id = ipr.ins_sample_id + ( + SELECT + temp.* + FROM + ( + SELECT + isa.id, + isa.sample, + isa.sample_code, + isa.send_time, + isa.appointed, + isa.ins_state, + isa.ins_result, + isu.user_id, + isa.ins_order_id, + isu.id as sample_user_id + FROM + ins_sample isa + LEFT JOIN ins_sample_user isu ON isa.id = isu.ins_sample_id + ) AS temp WHERE - io.state = #{ew.state} - AND ipr.state = 1 - AND ipr.son_laboratory = #{ew.childrenLaboratory} - <if test="ew.insState!=null and ew.insState!=''"> - AND tempA.ins_state = #{ew.insState} - </if> - <if test="ew.sampleName!=null and ew.sampleName!=''"> - AND tempA.sample like concat('%',#{ew.sampleName},'%') - </if> - <if test="ew.viewSelf==true"> - AND tempA.sample_user_id is not null - </if> - ORDER BY io.type DESC + temp.user_id = #{ew.userId} + OR ( SELECT COUNT(*) FROM ins_sample_user WHERE ins_sample_id = temp.id ) = 0 + ) AS tempA + LEFT JOIN ins_order io ON tempA.ins_order_id = io.id + LEFT JOIN ins_product ipr ON tempA.id = ipr.ins_sample_id + WHERE + io.state = #{ew.state} + AND ipr.state = 1 + AND ipr.son_laboratory = #{ew.childrenLaboratory} + <if test="ew.insState!=null and ew.insState!=''"> + AND tempA.ins_state = #{ew.insState} + </if> + <if test="ew.sampleName!=null and ew.sampleName!=''"> + AND tempA.sample like concat('%',#{ew.sampleName},'%') + </if> + <if test="ew.viewSelf==true"> + AND tempA.sample_user_id is not null + </if> + ORDER BY io.type DESC,tempA.id </select> + + <select id="selectSampleProductListByOrderId" resultMap="sampleDto"> + select isa.*,ip.id, inspection_item, inspection_item_classify, inspection_item_subclass, ip.factory, ip.laboratory, ip.sample_type, ip.sample, ip.model, son_laboratory, 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, state, ins_sample_id, ip.create_user, ip.update_user, ip.create_time, ip.update_time, template_id + from ins_sample isa + left join ins_product ip on isa.id = ip.ins_sample_id + where ins_order_id = #{id} + </select> + + <resultMap id="sampleDto" type="com.yuanchu.mom.dto.SampleProductDto"> + <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="isLeave" column="is_leave" jdbcType="INTEGER"/> + <result property="leaveNum" column="leave_num" jdbcType="INTEGER"/> + <result property="insProgress" column="ins_progress" jdbcType="VARCHAR"/> + <result property="insState" column="ins_state" jdbcType="INTEGER"/> + <result property="sendTime" column="send_time" jdbcType="TIMESTAMP"/> + <result property="joinNum" column="join_num" jdbcType="INTEGER"/> + <result property="remark" column="remark" jdbcType="VARCHAR"/> + <result property="appointed" column="appointed" jdbcType="TIMESTAMP"/> + <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"/> + <collection property="insProduct" resultMap="product"/> + </resultMap> + + <resultMap id="product" type="com.yuanchu.mom.pojo.InsProduct"> + <id property="id" column="ip.id" jdbcType="INTEGER"/> + <result property="inspectionItem" column="inspection_item" jdbcType="VARCHAR"/> + <result property="inspectionItemClassify" column="inspection_item_classify" jdbcType="VARCHAR"/> + <result property="inspectionItemSubclass" column="inspection_item_subclass" jdbcType="VARCHAR"/> + <result property="factory" column="ip.factory" jdbcType="VARCHAR"/> + <result property="laboratory" column="ip.laboratory" jdbcType="VARCHAR"/> + <result property="sampleType" column="ip.sample_type" jdbcType="VARCHAR"/> + <result property="sample" column="ip.sample" jdbcType="VARCHAR"/> + <result property="model" column="ip.model" jdbcType="VARCHAR"/> + <result property="sonLaboratory" column="son_laboratory" jdbcType="VARCHAR"/> + <result property="unit" column="unit" jdbcType="VARCHAR"/> + <result property="price" column="price" jdbcType="DECIMAL"/> + <result property="manHour" column="man_hour" jdbcType="DOUBLE"/> + <result property="manHourGroup" column="man_hour_group" jdbcType="VARCHAR"/> + <result property="inspectionItemType" column="inspection_item_type" jdbcType="VARCHAR"/> + <result property="inspectionValueType" column="inspection_value_type" jdbcType="VARCHAR"/> + <result property="deviceGroup" column="device_group" jdbcType="VARCHAR"/> + <result property="checkoutNumber" column="checkout_number" jdbcType="INTEGER"/> + <result property="section" column="section" jdbcType="VARCHAR"/> + <result property="valueType" column="value_type" jdbcType="VARCHAR"/> + <result property="method" column="method" jdbcType="VARCHAR"/> + <result property="manDay" column="man_day" jdbcType="INTEGER"/> + <result property="bsm" column="bsm" jdbcType="VARCHAR"/> + <result property="ask" column="ask" 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"/> + <result property="insSampleId" column="ins_sample_id" jdbcType="INTEGER"/> + <result property="createUser" column="ip.create_user" jdbcType="INTEGER"/> + <result property="updateUser" column="ip.update_user" jdbcType="INTEGER"/> + <result property="createTime" column="ip.create_time" jdbcType="TIMESTAMP"/> + <result property="updateTime" column="ip.update_time" jdbcType="TIMESTAMP"/> + <result property="templateId" column="ip.template_id" jdbcType="INTEGER"/> + </resultMap> </mapper> -- Gitblit v1.9.3