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/InsOrderMapper.xml | 341 +++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 271 insertions(+), 70 deletions(-) diff --git a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml index 66b992d..a0b49ae 100644 --- a/inspect-server/src/main/resources/mapper/InsOrderMapper.xml +++ b/inspect-server/src/main/resources/mapper/InsOrderMapper.xml @@ -3,24 +3,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.yuanchu.mom.mapper.InsOrderMapper"> - <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.InsOrder"> <id property="id" column="id" jdbcType="INTEGER"/> <result property="entrustCode" column="entrust_code" jdbcType="VARCHAR"/> - <result property="sampleCode" column="sample_code" jdbcType="VARCHAR"/> <result property="custom" column="custom" jdbcType="VARCHAR"/> <result property="company" column="company" jdbcType="VARCHAR"/> <result property="code" column="code" jdbcType="VARCHAR"/> <result property="type" column="type" jdbcType="INTEGER"/> - <result property="appointedTime" column="appointed_time" jdbcType="TIMESTAMP"/> - <result property="laboratory" column="laboratory" jdbcType="VARCHAR"/> - <result property="smapleType" column="smaple_type" jdbcType="VARCHAR"/> - <result property="model" column="model" jdbcType="VARCHAR"/> - <result property="sample" column="sample" jdbcType="VARCHAR"/> - <result property="sampleNum" column="sample_num" jdbcType="DOUBLE"/> - <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="appointed" column="appointed" jdbcType="TIMESTAMP"/> <result property="state" column="state" jdbcType="INTEGER"/> <result property="remark" column="remark" jdbcType="VARCHAR"/> <result property="otcCode" column="otc_code" jdbcType="VARCHAR"/> @@ -29,17 +19,6 @@ <result property="updateUser" column="update_user" jdbcType="INTEGER"/> <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> </resultMap> - - <sql id="Base_Column_List"> - id,entrust_code,sample_code, - custom,company,code, - type,appointed_time,laboratory, - smaple_type,model,sample, - sample_num,is_leave,leave_num, - ins_progress,state,remark, - otc_code,create_user,create_time, - update_user,update_time - </sql> <resultMap id="OrderThingDto" type="com.yuanchu.mom.dto.OrderThingDto"> <result property="id" column="id"/> @@ -71,76 +50,298 @@ <result property="remark" column="remark"/> </resultMap> - <select id="getOrderThing" resultMap="OrderThingDto"> - select * - from ins_order io - left join ins_product ip on ip.ins_order_id = io.id - left join ins_product_result ipr on ip.id = ipr.ins_product_id - </select> + <resultMap id="selectSampleDefectsMap" type="com.yuanchu.mom.vo.SampleDefectsFatherVo"> + <id column="id" property="id"/> + <result column="sample" property="sample"/> + <association property="children" resultMap="SampleDefectsChildrenMap" javaType="java.util.List"/> + </resultMap> + <select id="selectInsOrderPage" resultType="com.yuanchu.mom.dto.SampleOrderDto"> + select * + from ( + SELECT + io.*, + ir.id report_id, + ir.url, + ir.url_s, + (select count(*) from ins_sample isa2 + where isa2.ins_order_id = io.id and isa2.sample_code NOT REGEXP '/') sample_num, + concat(ROUND((select count(*) from ins_product ip + where state = 1 and ins_result is not null and ip.ins_sample_id in (select id from ins_sample where + ins_sample.ins_order_id= io.id )) / (select count(*) from ins_product ip2 + where state = 1 and ip2.ins_sample_id in (select id from ins_sample where ins_sample.ins_order_id= io.id )) * + 100, 2), '%') insProgress, + group_concat(distinct isa.sample_code,' ') sample_code, + group_concat(distinct isa.sample,' ') sample_name, + group_concat(distinct isa.model,' ') sample_model, + u.name + FROM + ins_order io + LEFT JOIN ins_sample isa ON io.id = isa.ins_order_id + LEFT JOIN ( SELECT id, ins_order_id, is_ratify, url,url_s FROM ins_report WHERE is_ratify = 1 ) ir ON io.id = + ir.ins_order_id + left join user u on io.create_user = u.id + where 1=1 + <if test="laboratory!=null and laboratory!=''"> + and io.laboratory=#{laboratory} + </if> + GROUP BY + io.id + ) a + <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> + ${ew.customSqlSegment} + </if> + </select> + <resultMap id="SampleDefectsChildrenMap" type="com.yuanchu.mom.vo.SampleDefectsChildrenVo"> + <result column="entrust_code" property="entrust_code"/> + <result column="inspection_item" property="inspection_item"/> + <result column="name" property="name"/> + <result column="create_time" property="create_time"/> + </resultMap> <select id="selectInsOrderParameter" resultType="com.yuanchu.mom.pojo.InsOrder"> select * from ( select id, - entrust_code, - sample_code, - custom, - company, - code, - type, - appointed_time, - laboratory, - smaple_type, - model, - sample, - sample_num, - is_leave, - leave_num, - ins_progress, - state, - remark, - otc_code, + appointed, + user_id, create_user, - create_time, + otc_code, + code, + custom, update_user, - update_time + update_time, + type, + entrust_code, + company, + remark, + create_time, + state from ins_order ) a <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> ${ew.customSqlSegment} </if> </select> + <select id="getLaboratoryCode" resultType="java.lang.String"> + select laboratory_number + from laboratory + where laboratory_name = #{name} + </select> + <select id="selectSampleAndProductByOrderId" resultType="com.yuanchu.mom.dto.SampleProductDto2"> + select * + from ( + select + i.id,isa.sample_code,isa.sample,isa.model,isa.ins_state,ip.state,ip.unit,ip.inspection_item,ip.inspection_item_subclass, + ip.son_laboratory,ip.inspection_item_type,ip.inspection_value_type,ip.ask,ip.`last_value`,ip.ins_result,ipr.equip_value + from ins_sample isa + left join ins_order i on isa.ins_order_id = i.id + 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 ip.state = 1 + ) a + <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> + ${ew.customSqlSegment} + </if> + </select> + <select id="selectCostStatistics" resultType="com.yuanchu.mom.dto.CostStatisticsDto"> + select * from ( + SELECT + i.id, + i.entrust_code, + i.create_time, + isa.sample, + isa.model, + c.price, + c.cost, + c.inspection_item, + cus.company, + u.`name`, + i.create_user, + c.ins_sample_id + FROM + ins_order i + LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id + LEFT JOIN `user` u ON u.id = i.user_id + left join custom cus on cus.id = u.company + LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item2 + SEPARATOR ',') + inspection_item from (select *,GROUP_CONCAT(inspection_item + SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP + BY b.ins_sample_id) c ON c.ins_sample_id = isa.id + where (i.state = 1 or i.state = 3 or i.state = 4) + ) a + <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> + ${ew.customSqlSegment} + </if> + </select> + <select id="selectDeviceList" resultType="java.util.Map"> + select device_name,specification_model,management_number,<!--DATE_ADD(date_format(last_calibration_date, + '%Y-%m-%d'),INTERVAL calibration_date month)--> date_format(next_calibration_date,'%Y-%m-%d') + latest_traceability + from device + where device.management_number in + <foreach collection="names" index="index" open="(" separator="," close=")" item="val"> + #{val} + </foreach> + </select> <update id="upInsOrderParameter" parameterType="com.yuanchu.mom.pojo.InsOrder"> UPDATE ins_order <set> - <if test="entrustCode!=null and entrustCode!='' ">entrust_code=#{entrustCode},</if> - <if test="sample_Code!=null ">sample_code=#{sampleCode},</if> - <if test="custom!=null ">custom=#{custom},</if> - <if test="company!=null ">company=#{company}</if> - <if test="code!=null ">code=#{code}</if> - <if test="type!=null ">type=#{type}</if> - <if test="appointedTime!=null ">appointed_time=#{appointedTime}</if> - <if test="laboratory!=null ">laboratory=#{laboratory}</if> - <if test="smapleType!=null ">smaple_type=#{smapleType}</if> - <if test="model!=null ">model=#{model}</if> - <if test="sample!=null ">sample=#{sample}</if> - <if test="sampleNum!=null ">sample_num=#{sampleNum}</if> - <if test="isLeave!=null ">is_leave=#{isLeave}</if> - <if test="leaveNum!=null ">leave_num=#{leaveNum}</if> - <if test="insProgress!=null ">ins_progress=#{insProgress}</if> - <if test="state!=null ">state=#{state}</if> - <if test="remark!=null ">remark=#{remark}</if> - <if test="otcCode!=null ">otc_code=#{otcCode}</if> - <if test="createUser!=null ">create_user=#{createUser}</if> - <if test="createTime!=null ">create_time=#{createTime}</if> - <if test="updateUser!=null ">update_user=#{updateUser}</if> - <if test="updateTime!=null ">update_time=#{updateTime}</if> + <if test="appointed!=null and appointed!='' "> + appointed=#{appointed}, + </if> + <if test="userId!=null "> + user_id=#{userId}, + </if> + <if test="createUser!=null "> + create_user=#{createUser} + </if> + <if test="otcCode!=null "> + otc_code=#{otcCode} + </if> + <if test="code!=null "> + code=#{code} + </if> + <if test="custom!=null "> + custom=#{custom} + </if> + <if test="updateUser!=null "> + update_user=#{updateUser} + </if> + <if test="updateTime!=null "> + update_time=#{updateTime} + </if> + <if test="type!=null "> + type=#{type} + </if> + <if test="entrustCode!=null "> + entrust_code=#{entrustCode} + </if> + <if test="company!=null "> + company=#{company} + </if> + <if test="remark!=null "> + remark=#{remark} + </if> + <if test="createTime!=null "> + create_time=#{createTime} + </if> + <if test="state!=null "> + state=#{state} + </if> </set> <where> id=#{id} </where> </update> + <update id="updateStatus"> + update ins_order + set state=3 + where id = #{id} + </update> + <select id="selectSampleDefects" resultMap="selectSampleDefectsMap"> + SELECT io.entrust_code,sam.sample,ip.inspection_item,u.name,b.create_time, sam.id + from ins_order io + left JOIN ins_sample sam on io.id=sam.ins_order_id + LEFT JOIN ins_product ip on ip.ins_sample_id=sam.id + LEFT JOIN + (SELECT create_time,create_user,ins_product_id FROM + (select * FROM ins_product_user ORDER BY ins_product_user.create_time DESC) a + GROUP BY a.ins_product_id) b + on b.ins_product_id=ip.id + left JOIN `user` u on u.id=b.create_user + WHERE (ip.ins_result=0 OR ip.state=0) + <if test="inspectionItems != null and inspectionItems != ''"> + and inspection_item like concat('%', #{inspectionItems}, '%') + </if> + <if test="orderNumber != null and orderNumber != ''"> + and io.entrust_code like concat('%', #{orderNumber}, '%') + </if> + </select> + + <select id="getCount" resultType="long"> + select count(1) + from ( + SELECT io.entrust_code,sam.sample,ip.inspection_item,u.name,b.create_time, sam.id + from ins_order io + left JOIN ins_sample sam on io.id=sam.ins_order_id + LEFT JOIN ins_product ip on ip.ins_sample_id=sam.id + LEFT JOIN + (SELECT create_time,create_user,ins_product_id FROM (select * FROM ins_product_user ORDER BY + ins_product_user.create_time DESC) a GROUP BY a.ins_product_id) b + on b.ins_product_id=ip.id + left JOIN `user` u on u.id=b.create_user + where (ip.ins_result=0 OR ip.state=0) + <if test="inspectionItems != null and inspectionItems != ''"> + and inspection_item like concat('%', #{inspectionItems}, '%') + </if> + <if test="orderNumber != null and orderNumber != ''"> + and io.entrust_code like concat('%', #{orderNumber}, '%') + </if> + ) temp + </select> + <select id="getEnumLabelByValue" resultType="java.lang.String"> + select label + from `center-lims`.enums + where value = #{value} + </select> + <select id="getStandardMethodCode" resultType="java.lang.String"> + select code + from `center-lims`.standard_method + where id = #{id} + </select> + <select id="selLaboratoryCode" resultType="java.lang.String"> + select laboratory_code + from laboratory + where laboratory_name = #{laboratory} + </select> + <select id="selectReportModelByOrderId" resultType="java.util.Map"> + select distinct id, name + from standard_template + where id in (select template_id + from ins_product + where son_laboratory = #{laboratory} + and ins_sample_id in + (select id from ins_sample where ins_order_id = #{id})) + </select> + + <select id="selectCostStatistics2" resultType="com.yuanchu.mom.dto.CostStatisticsDto"> + select * from ( + SELECT + i.id, + i.entrust_code, + i.create_time, + isa.sample, + isa.model, + c.price, + c.cost, + c.inspection_item, + u.company, + u.`name`, + i.create_user, + c.ins_sample_id + FROM + ins_order i + LEFT JOIN ins_sample isa ON isa.ins_order_id = i.id + LEFT JOIN `user` u ON u.id = i.user_id + LEFT JOIN (select SUM(b.price) price, sum(b.man_hour) cost,b.ins_sample_id,GROUP_CONCAT(b.inspection_item2 + SEPARATOR ',') + inspection_item from (select *,GROUP_CONCAT(inspection_item + SEPARATOR ',') inspection_item2 from ins_product where state = 1 GROUP BY ins_sample_id,man_hour_group) b GROUP + BY b.ins_sample_id) c ON c.ins_sample_id = isa.id + where (i.state = 1 or i.state = 3 or i.state = 4) + ) a + <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''"> + ${ew.customSqlSegment} + </if> + </select> + + <select id="seldepLimsId" resultType="java.lang.String"> + select name + from department_lims + where id = #{depLimsId} + </select> </mapper> -- Gitblit v1.9.3