2024-07-20 15:18:16 +08:00
|
|
|
<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.bonus.aqgqj.basis.dao.ExperimentalMapper">
|
2024-07-20 17:31:33 +08:00
|
|
|
<!--添加试验信息-->
|
|
|
|
|
<insert id="addExper" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO tb_exper
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="sampleId != null">sample_id,</if>
|
|
|
|
|
<if test="devTypeCode != null and devTypeCode != ''">dev_type_code,</if>
|
|
|
|
|
<if test="devTypeName != null and devTypeName != ''">dev_type_name,</if>
|
|
|
|
|
<if test="sampleQuantity != null">dev_num,</if>
|
|
|
|
|
<if test="devModule != null and devModule!=''">dev_module,</if>
|
|
|
|
|
<if test="sampleDate != null and sampleDate!=''">sample_date,</if>
|
|
|
|
|
<if test="experTime != null and experTime!=''">exper_time,</if>
|
|
|
|
|
<if test="nextExperTime != null and nextExperTime!=''">next_exper_time,</if>
|
|
|
|
|
<if test="customId != null">submit_unit,</if>
|
|
|
|
|
<if test="experLocal != null and experLocal!=''">submit_location,</if>
|
|
|
|
|
<if test="experDev != null and experDev!=''">exper_dev,</if>
|
|
|
|
|
<if test="experModule != null and experModule!=''">exper_module,</if>
|
|
|
|
|
<if test="experCode != null and experCode!=''">exper_code,</if>
|
|
|
|
|
<if test="checkTime != null and checkTime!=''">check_time,</if>
|
|
|
|
|
<if test="experStand != null and experStand!=''">exper_stand,</if>
|
|
|
|
|
<if test="experConclu != null and experConclu!=''">exper_conclu,</if>
|
|
|
|
|
<if test="remarsk != null and remarsk!=''">remarsk,</if>
|
|
|
|
|
audit_status,
|
|
|
|
|
create_time,
|
|
|
|
|
create_user,
|
|
|
|
|
update_time,
|
|
|
|
|
update_user,
|
|
|
|
|
del_flag,
|
|
|
|
|
status,
|
|
|
|
|
id
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="sampleId != null">#{sampleId},</if>
|
|
|
|
|
<if test="devTypeCode != null and devTypeCode != ''">#{devTypeCode},</if>
|
|
|
|
|
<if test="devTypeName != null and devTypeName != ''">#{devTypeName},</if>
|
|
|
|
|
<if test="sampleQuantity != null">#{sampleQuantity},</if>
|
|
|
|
|
<if test="devModule != null and devModule!=''">#{devModule},</if>
|
|
|
|
|
<if test="sampleDate != null and sampleDate!=''">#{sampleDate},</if>
|
|
|
|
|
<if test="experTime != null and experTime!=''">#{experTime},</if>
|
|
|
|
|
<if test="nextExperTime != null and nextExperTime!=''">#{nextExperTime},</if>
|
|
|
|
|
<if test="customId != null">#{customId},</if>
|
|
|
|
|
<if test="experLocal != null and experLocal!=''">#{experLocal},</if>
|
|
|
|
|
<if test="experDev != null and experDev!=''">#{experDev},</if>
|
|
|
|
|
<if test="experModule != null and experModule!=''">#{experModule},</if>
|
|
|
|
|
<if test="experCode != null and experCode!=''">#{experCode},</if>
|
|
|
|
|
<if test="checkTime != null and checkTime!=''">#{checkTime},</if>
|
|
|
|
|
<if test="experStand != null and experStand!=''">#{experStand},</if>
|
|
|
|
|
<if test="experConclu != null and experConclu!=''">#{experConclu},</if>
|
|
|
|
|
<if test="remarsk != null and remarsk!=''">#{remarsk},</if>
|
2024-07-22 09:00:40 +08:00
|
|
|
#{auditStatus},
|
2024-07-20 17:31:33 +08:00
|
|
|
#{createTime},
|
|
|
|
|
#{createUser},
|
|
|
|
|
#{updateTime},
|
|
|
|
|
#{updateUser},
|
|
|
|
|
0,
|
2024-07-22 09:00:40 +08:00
|
|
|
#{status},
|
2024-07-20 17:31:33 +08:00
|
|
|
null
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
<!--添加试验依据信息数据-->
|
|
|
|
|
<insert id="addConfigBasis">
|
|
|
|
|
INSERT INTO tb_config_basis(id,exper_id,exper_basis_name) VALUES
|
|
|
|
|
<foreach collection="list" separator="," item="item">
|
|
|
|
|
(
|
2024-07-22 09:00:40 +08:00
|
|
|
null,#{experId},#{item.basisName}
|
2024-07-20 17:31:33 +08:00
|
|
|
)
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
2024-07-22 09:00:40 +08:00
|
|
|
<!--添加试验项信息-->
|
|
|
|
|
<insert id="addExperItems" useGeneratedKeys="true" keyProperty="params.id">
|
|
|
|
|
INSERT INTO tb_exper_items
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="experId != null">exper_id,</if>
|
|
|
|
|
<if test="params.experTypeCode != null and params.experTypeCode != ''">exper_type_code,</if>
|
|
|
|
|
<if test="params.experTypeName != null and params.experTypeName != ''">exper_type_name,</if>
|
|
|
|
|
<if test="params.experNum != null">exper_num,</if>
|
|
|
|
|
<if test="params.itemsSort != null">items_sort,</if>
|
|
|
|
|
<if test="params.amount != null and params.amount!=''">amount,</if>
|
|
|
|
|
id
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="experId != null">#{experId},</if>
|
|
|
|
|
<if test="params.experTypeCode != null and params.experTypeCode != ''">#{params.experTypeCode},</if>
|
|
|
|
|
<if test="params.experTypeName != null and params.experTypeName != ''">#{params.experTypeName},</if>
|
|
|
|
|
<if test="params.experNum != null">#{params.experNum},</if>
|
|
|
|
|
<if test="params.itemsSort != null">#{params.itemsSort},</if>
|
|
|
|
|
<if test="params.amount != null and params.amount!=''">#{params.amount},</if>
|
|
|
|
|
null
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
<!--添加试验项内容-->
|
|
|
|
|
<insert id="addExperItem" useGeneratedKeys="true" keyProperty="params.id">
|
|
|
|
|
INSERT INTO tb_exper_item
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="experId != null">items_id,</if>
|
|
|
|
|
<if test="params.itemNum != null">item_sort,</if>
|
|
|
|
|
<if test="params.itemName != null and params.itemName != ''">item_name,</if>
|
|
|
|
|
id
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="experId != null">#{experId},</if>
|
|
|
|
|
<if test="params.itemNum != null">#{params.itemNum},</if>
|
|
|
|
|
<if test="params.itemName != null and params.itemName != ''">#{params.itemName},</if>
|
|
|
|
|
null
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
<!--添加试验样品设备-->
|
|
|
|
|
<insert id="addExperDev" useGeneratedKeys="true" keyProperty="params.id">
|
|
|
|
|
INSERT INTO tb_exper_dev
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="experId != null">exper_id,</if>
|
|
|
|
|
<if test="params.devCode != null and params.devCode!=''">dev_code,</if>
|
|
|
|
|
<if test="params.manufacturer != null and params.manufacturer != ''">manufacturer,</if>
|
|
|
|
|
<if test="params.manufactureDate != null and params.manufactureDate != ''">manufacture_date,</if>
|
|
|
|
|
<if test="params.devModule != null and params.devModule != ''">dev_module,</if>
|
|
|
|
|
<if test="params.devStatus != null and params.devStatus != ''">dev_status,</if>
|
|
|
|
|
<if test="params.devData != null and params.devData != ''">dev_data,</if>
|
|
|
|
|
<if test="params.amount != null and params.amount != ''">amount,</if>
|
|
|
|
|
<if test="params.remarks != null and params.remarks != ''">remarks,</if>
|
|
|
|
|
id
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="experId != null">#{experId},</if>
|
|
|
|
|
<if test="params.devCode != null and params.devCode!=''">#{params.devCode},</if>
|
|
|
|
|
<if test="params.manufacturer != null and params.manufacturer != ''">#{params.manufacturer},</if>
|
|
|
|
|
<if test="params.manufactureDate != null and params.manufactureDate != ''">#{params.manufactureDate},</if>
|
|
|
|
|
<if test="params.devModule != null and params.devModule != ''">#{params.devModule},</if>
|
|
|
|
|
<if test="params.devStatus != null and params.devStatus != ''">#{params.devStatus},</if>
|
|
|
|
|
<if test="params.devData != null and params.devData != ''">#{params.devData},</if>
|
|
|
|
|
<if test="params.amount != null and params.amount != ''">#{params.amount},</if>
|
|
|
|
|
<if test="params.remarks != null and params.remarks != ''">#{params.remarks},</if>
|
|
|
|
|
null
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
<!--添加设备试验项信息-->
|
|
|
|
|
<insert id="addExperDevItems" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
INSERT INTO tb_exper_dev_items
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="devId != null">dev_id,</if>
|
|
|
|
|
<if test="itemsId != null">items_id,</if>
|
|
|
|
|
<if test="itemsName != null and itemsName != ''">items_name,</if>
|
|
|
|
|
<if test="valSort != null">val_sort,</if>
|
|
|
|
|
id
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="devId != null">#{devId},</if>
|
|
|
|
|
<if test="itemsId != null">#{itemsId},</if>
|
|
|
|
|
<if test="itemsName != null and itemsName != ''">#{itemsName},</if>
|
|
|
|
|
<if test="valSort != null">#{valSort},</if>
|
|
|
|
|
null
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
<!--添加设备试验项数据-->
|
|
|
|
|
<insert id="addExperDevItem">
|
|
|
|
|
INSERT INTO tb_exper_dev_item (id,items_id,item_id,dev_id,item_name,item_val) VALUES
|
|
|
|
|
<foreach collection="experDevItemVos" separator="," item="item">
|
|
|
|
|
(
|
|
|
|
|
null,#{item.itemsId},#{item.itemId},#{item.devId},#{item.itemName},#{item.itemVal}
|
|
|
|
|
)
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
<!--添加试验设备数据-->
|
|
|
|
|
<insert id="addExperConfigDev">
|
|
|
|
|
INSERT INTO tb_exper_config_dev(id,dev_type_code,dev_type_name,exper_id,dev_name,dev_id) VALUES
|
|
|
|
|
<foreach collection="list" separator="," item="item">
|
|
|
|
|
(
|
|
|
|
|
null,#{item.devTypeCode},#{item.devTypeName},#{experId},#{item.devName},#{item.devId}
|
|
|
|
|
)
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
<!--修改试验信息数据-->
|
|
|
|
|
<update id="updateExper">
|
|
|
|
|
UPDATE tb_exper SET dev_type_code = #{devTypeCode},dev_type_name = #{devTypeName},dev_num = #{sampleQuantity},
|
|
|
|
|
dev_module = #{devModule},sample_date = #{sampleDate},exper_time = #{experTime},next_exper_time = #{nextExperTime},
|
|
|
|
|
submit_unit = #{customId},submit_location = #{experLocal},exper_dev = #{experDev},exper_module = #{experModule},
|
|
|
|
|
exper_code = #{experCode},check_time = #{checkTime},update_time = #{updateTime},update_user = #{updateUser},
|
|
|
|
|
exper_conclu = #{experConclu},remarsk = #{remarsk} WHERE id = #{id}
|
|
|
|
|
</update>
|
2024-07-22 15:45:51 +08:00
|
|
|
<!--更新收样表中的状态为待审阅-->
|
|
|
|
|
<update id="updateSampleStatus">
|
|
|
|
|
UPDATE tb_sample SET audti_status = 0,process_status = 1
|
|
|
|
|
WHERE id IN
|
|
|
|
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
|
|
|
|
<!--更新试验表中数据为待审阅-->
|
|
|
|
|
<update id="updateExperStatus">
|
|
|
|
|
UPDATE tb_exper SET status = 1,audit_status = 0
|
|
|
|
|
WHERE sample_id IN
|
|
|
|
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</update>
|
2024-07-22 09:00:40 +08:00
|
|
|
<!--删除试验依据-->
|
|
|
|
|
<delete id="delConfigBasis">
|
|
|
|
|
DELETE FROM tb_config_basis WHERE exper_id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
<!--删除试验设备-->
|
|
|
|
|
<delete id="delExperConfigDev">
|
|
|
|
|
DELETE FROM tb_exper_config_dev WHERE exper_id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
<!--删除试验样品设备-->
|
|
|
|
|
<delete id="delExperDev">
|
|
|
|
|
DELETE FROM tb_exper_dev WHERE exper_id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
<!--删除设备试验项信息-->
|
|
|
|
|
<delete id="delExperDevItems">
|
|
|
|
|
DELETE FROM tb_exper_dev_items
|
|
|
|
|
WHERE dev_id IN
|
|
|
|
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
<!--删除设备试验项数据-->
|
|
|
|
|
<delete id="delExperDevItem">
|
|
|
|
|
DELETE FROM tb_exper_dev_item
|
|
|
|
|
WHERE dev_id IN
|
|
|
|
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
<!--删除试验信息-->
|
|
|
|
|
<delete id="delExper">
|
|
|
|
|
UPDATE tb_exper SET del_flag = 1 WHERE id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
<!--删除试验项-->
|
|
|
|
|
<delete id="delExperItems">
|
|
|
|
|
DELETE FROM tb_exper_items WHERE exper_id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
<!--删除试验项内容-->
|
|
|
|
|
<delete id="delExperItem">
|
|
|
|
|
DELETE FROM tb_exper_item WHERE items_id IN
|
|
|
|
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2024-07-20 15:18:16 +08:00
|
|
|
|
|
|
|
|
<!--试验列表-->
|
|
|
|
|
<select id="getList" resultType="com.bonus.aqgqj.basis.entity.vo.ExperimentalVo">
|
|
|
|
|
SELECT ts.id,
|
|
|
|
|
tc.custom_name AS customName,
|
|
|
|
|
DATE_FORMAT(ts.sample_time, '%Y-%m-%d') AS sampleTime,
|
|
|
|
|
IFNULL(tsd.num,0) AS customNum,
|
|
|
|
|
tsd.sampleDev,
|
|
|
|
|
su.user_name AS sampleUserName,
|
|
|
|
|
su2.user_name AS dispatchUserName,
|
|
|
|
|
DATE_FORMAT(ts.sample_date, '%Y-%m-%d') AS sampleDate,
|
|
|
|
|
tt.team_name AS teamName,
|
2024-07-22 15:11:50 +08:00
|
|
|
CASE WHEN process_status IS NULL THEN '待试验'
|
|
|
|
|
WHEN process_status = 0 AND audti_status = 0 THEN '待提交'
|
|
|
|
|
WHEN process_status = 1 AND audti_status = 0 THEN '待审阅'
|
|
|
|
|
WHEN process_status = 1 AND audti_status = 2 THEN '审阅不通过'
|
|
|
|
|
WHEN process_status = 2 AND audti_status = 0 THEN '待审核'
|
|
|
|
|
WHEN process_status = 2 AND audti_status = 2 THEN '审核不通过'
|
|
|
|
|
WHEN process_status = 3 AND audti_status = 0 THEN '待审批'
|
|
|
|
|
WHEN process_status = 3 AND audti_status = 2 THEN '审批不通过'
|
|
|
|
|
WHEN process_status = 4 AND audti_status = 1 THEN '试验结束'
|
|
|
|
|
ELSE '待试验'
|
|
|
|
|
END AS audtiStatus,
|
2024-07-20 15:18:16 +08:00
|
|
|
ts.remarks
|
|
|
|
|
FROM tb_sample ts
|
|
|
|
|
LEFT JOIN tb_custom tc ON ts.custom_id = tc.id
|
|
|
|
|
LEFT JOIN sys_user su ON ts.create_user = su.id AND su.del_flag = 0
|
|
|
|
|
LEFT JOIN sys_user su2 ON ts.update_user = su2.id AND su2.del_flag = 0
|
|
|
|
|
LEFT JOIN tb_team tt ON ts.team_id = tt.id AND tt.del_flag = 0
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT sample_id,COUNT(sample_id) AS num,GROUP_CONCAT(DISTINCT dev_type_name) AS sampleDev,GROUP_CONCAT(DISTINCT dev_type_code) AS sampleDevCode
|
|
|
|
|
FROM tb_sample_device
|
|
|
|
|
WHERE del_falg = 0
|
|
|
|
|
GROUP BY sample_id
|
|
|
|
|
) tsd ON tsd.sample_id = ts.id
|
2024-07-22 15:11:50 +08:00
|
|
|
WHERE ts.del_flag = 0
|
2024-07-20 15:18:16 +08:00
|
|
|
<if test="keyWord != null and keyWord!=''">
|
|
|
|
|
AND (
|
|
|
|
|
INSTR(tt.team_name,#{keyWord}) > 0 OR
|
|
|
|
|
INSTR(su2.user_name,#{keyWord}) > 0
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
<if test="sampleUserName != null and sampleUserName!=''">
|
|
|
|
|
AND INSTR(su.user_name,#{sampleUserName}) > 0
|
|
|
|
|
</if>
|
|
|
|
|
<if test="sampleDate != null and sampleDate!=''">
|
|
|
|
|
AND DATE_FORMAT(ts.sample_date, '%Y-%m-%d') = #{sampleDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="devTypeCode != null and devTypeCode!=''">
|
|
|
|
|
AND INSTR(tsd.sampleDevCode,#{devTypeCode})
|
|
|
|
|
</if>
|
2024-07-22 15:11:50 +08:00
|
|
|
ORDER BY FIELD(audtiStatus, '审阅不通过','审核不通过','审批不通过','待试验','待提交','待审阅','待审核','待审批','试验结束') ASC,dispatch_time ASC
|
2024-07-20 15:18:16 +08:00
|
|
|
</select>
|
|
|
|
|
<!--试验详情列表-->
|
|
|
|
|
<select id="getDetailList" resultType="com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo">
|
2024-07-22 14:23:14 +08:00
|
|
|
SELECT ANY_VALUE(tsd.sample_id) AS sampleId,
|
|
|
|
|
ANY_VALUE(tsd.dev_type_name) AS devTypeName,
|
|
|
|
|
tsd.dev_type_code AS devTypeCode,
|
|
|
|
|
ANY_VALUE(te.id) AS experId,
|
|
|
|
|
COUNT(tsd.dev_type_code) AS sampleNum,
|
|
|
|
|
ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_remakr)) AS causeOfRejection,
|
|
|
|
|
CASE WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 0 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 0 THEN '待提交'
|
|
|
|
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 1 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 0 THEN '待审阅'
|
|
|
|
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 1 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 2 THEN '审阅不通过'
|
|
|
|
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 2 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 0 THEN '待审核'
|
|
|
|
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 2 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 3 THEN '审核不通过'
|
|
|
|
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 3 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 0 THEN '待审批'
|
|
|
|
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 3 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 4 THEN '审批不通过'
|
|
|
|
|
WHEN ANY_VALUE(GROUP_CONCAT(DISTINCT te.status)) = 4 AND ANY_VALUE(GROUP_CONCAT(DISTINCT te.audit_status)) = 1 THEN '试验完成'
|
|
|
|
|
ELSE '待试验'
|
|
|
|
|
END AS status
|
|
|
|
|
FROM tb_sample_device tsd
|
|
|
|
|
LEFT JOIN tb_exper te ON tsd.sample_id = te.sample_id AND tsd.dev_type_code = te.dev_type_code AND te.del_flag = 0
|
|
|
|
|
WHERE tsd.sample_id = #{id} AND tsd.del_falg = 0
|
2024-07-20 15:18:16 +08:00
|
|
|
<if test="devTypeCode != null and devTypeCode!=''">
|
2024-07-22 14:23:14 +08:00
|
|
|
AND INSTR(tsd.dev_type_code,#{devTypeCode})
|
2024-07-20 15:18:16 +08:00
|
|
|
</if>
|
2024-07-22 14:23:14 +08:00
|
|
|
GROUP BY tsd.dev_type_code
|
2024-07-20 15:18:16 +08:00
|
|
|
</select>
|
|
|
|
|
<!--查询试验模板数据、基础数据-->
|
|
|
|
|
<select id="getTestBasicInfo" resultType="com.bonus.aqgqj.basis.entity.vo.TestVo">
|
|
|
|
|
SELECT DATE_FORMAT(ts.sample_date, '%Y-%m-%d') AS sampleDate,
|
|
|
|
|
custom_id AS customId,
|
|
|
|
|
custom_name AS customName,
|
2024-07-20 17:31:33 +08:00
|
|
|
a.id AS configId,
|
|
|
|
|
a.dev_type_code AS devTypeCode,
|
|
|
|
|
a.dev_type_name AS devTypeName,
|
|
|
|
|
a.dev_module AS devModule,
|
|
|
|
|
a.exper_local_code AS experLocalCode,
|
|
|
|
|
a.exper_local AS experLocal
|
2024-07-20 15:18:16 +08:00
|
|
|
FROM tb_sample ts
|
|
|
|
|
LEFT JOIN (
|
2024-07-22 09:00:40 +08:00
|
|
|
SELECT tsd.dev_type_code,
|
|
|
|
|
ANY_VALUE(tsc.dev_type_name) AS dev_type_name,
|
|
|
|
|
ANY_VALUE(tsc.dev_module) AS dev_module,
|
|
|
|
|
ANY_VALUE(tsc.exper_local_code) AS exper_local_code,
|
|
|
|
|
ANY_VALUE(tsc.exper_local) AS exper_local,
|
|
|
|
|
ANY_VALUE(tsc.id) AS id,
|
|
|
|
|
ANY_VALUE(tsd.sample_id) AS sample_id
|
2024-07-20 15:18:16 +08:00
|
|
|
FROM tb_sample_device tsd
|
|
|
|
|
LEFT JOIN tb_exper_config tsc ON tsc.dev_type_code = tsd.dev_type_code AND tsc.del_flag = 0
|
|
|
|
|
WHERE tsd.sample_id = #{id} AND tsd.del_falg = 0 AND tsd.dev_type_code = #{devTypeCode}
|
|
|
|
|
GROUP BY tsd.dev_type_code
|
|
|
|
|
) a ON a.sample_id = ts.id
|
|
|
|
|
WHERE ts.id = #{id} AND del_flag = 0
|
|
|
|
|
</select>
|
2024-07-22 09:00:40 +08:00
|
|
|
<!--查询收样设备-根据设备类型-->
|
|
|
|
|
<select id="getSampleDeviceVos" resultType="com.bonus.aqgqj.basis.entity.vo.SampleDeviceVo">
|
|
|
|
|
SELECT id,
|
|
|
|
|
dev_code AS devCode,
|
|
|
|
|
dev_module AS devModule,
|
|
|
|
|
dev_type_code AS devTypeCode,
|
|
|
|
|
dev_type_name AS devTypeName
|
|
|
|
|
FROM tb_sample_device
|
|
|
|
|
WHERE sample_id = #{id}
|
|
|
|
|
AND dev_type_code = #{devTypeCode}
|
|
|
|
|
AND del_falg = 0
|
|
|
|
|
</select>
|
|
|
|
|
<!--试验数据详情-->
|
|
|
|
|
<select id="viewTestData" resultType="com.bonus.aqgqj.basis.entity.vo.TestVo">
|
|
|
|
|
SELECT id,
|
|
|
|
|
sample_id AS sampleId,
|
|
|
|
|
dev_type_code AS devTypeCode,
|
|
|
|
|
dev_type_name AS devTypeName,
|
|
|
|
|
dev_num AS sampleQuantity,
|
|
|
|
|
dev_module AS devModule,
|
|
|
|
|
sample_date AS sampleDate,
|
|
|
|
|
DATE_FORMAT(exper_time, '%Y-%m-%d') AS experTime,
|
|
|
|
|
DATE_FORMAT(next_exper_time, '%Y-%m-%d') AS nextExperTime,
|
|
|
|
|
submit_unit AS customId,
|
|
|
|
|
submit_location AS experLocal,
|
|
|
|
|
exper_dev AS experDev,
|
|
|
|
|
exper_module AS experModule,
|
|
|
|
|
exper_code AS experCode,
|
|
|
|
|
DATE_FORMAT(check_time, '%Y-%m-%d') AS checkTime,
|
|
|
|
|
exper_stand AS experStand,
|
|
|
|
|
exper_conclu AS experConclu,
|
|
|
|
|
remarsk AS remarsk
|
|
|
|
|
FROM tb_exper te
|
|
|
|
|
WHERE te.id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<!--试验依据信息-->
|
|
|
|
|
<select id="getConfigBasis" resultType="com.bonus.aqgqj.basis.entity.vo.ExperBasisVo">
|
|
|
|
|
SELECT id,
|
|
|
|
|
exper_id AS configId,
|
|
|
|
|
exper_basis_name AS basisName
|
|
|
|
|
FROM tb_config_basis WHERE exper_id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<!--试验设备信息-->
|
|
|
|
|
<select id="getExperConfigDevs" resultType="com.bonus.aqgqj.basis.entity.vo.ConfigDevVo">
|
|
|
|
|
SELECT id,
|
|
|
|
|
dev_type_code AS devTypeCode,
|
|
|
|
|
dev_type_name AS devTypeName,
|
|
|
|
|
exper_id AS configId,
|
|
|
|
|
dev_name AS devName,
|
|
|
|
|
dev_id AS devId
|
|
|
|
|
FROM tb_exper_config_dev
|
|
|
|
|
WHERE exper_id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<!--试验项信息-->
|
|
|
|
|
<select id="getExperItems" resultType="com.bonus.aqgqj.basis.entity.vo.ConfigItemsVo">
|
|
|
|
|
SELECT id,
|
|
|
|
|
exper_type_code AS experTypeCode,
|
|
|
|
|
exper_type_name AS experTypeName,
|
|
|
|
|
exper_num AS experNum,
|
|
|
|
|
items_sort AS itemsSort,
|
|
|
|
|
amount
|
|
|
|
|
FROM tb_exper_items
|
|
|
|
|
WHERE exper_id = #{id}
|
|
|
|
|
ORDER BY items_sort
|
|
|
|
|
</select>
|
|
|
|
|
<!--试验项内容信息-->
|
|
|
|
|
<select id="getExperItem" resultType="com.bonus.aqgqj.basis.entity.vo.ConfigItemVo">
|
|
|
|
|
SELECT id,
|
|
|
|
|
items_id AS itemId,
|
|
|
|
|
item_sort AS itemNum,
|
|
|
|
|
item_name AS itemName
|
|
|
|
|
FROM tb_exper_item
|
|
|
|
|
WHERE items_id = #{id}
|
|
|
|
|
ORDER BY item_sort
|
|
|
|
|
</select>
|
|
|
|
|
<!--试验样品设备-->
|
|
|
|
|
<select id="getExperDev" resultType="com.bonus.aqgqj.basis.entity.vo.ExperDevVo">
|
|
|
|
|
SELECT id,
|
|
|
|
|
exper_id AS experId,
|
|
|
|
|
dev_code AS devCode,
|
|
|
|
|
manufacturer,
|
|
|
|
|
manufacture_date AS manufactureDate,
|
|
|
|
|
dev_module AS devModule,
|
|
|
|
|
dev_status AS devStatus,
|
|
|
|
|
dev_data AS devData,
|
|
|
|
|
amount,
|
|
|
|
|
remarks
|
|
|
|
|
FROM tb_exper_dev
|
|
|
|
|
WHERE exper_id = #{id}
|
2024-07-22 14:23:14 +08:00
|
|
|
ORDER BY id
|
2024-07-22 09:00:40 +08:00
|
|
|
</select>
|
|
|
|
|
<!--获取试验样品设备ID-->
|
|
|
|
|
<select id="getExperDevIds" resultType="java.lang.Long">
|
|
|
|
|
SELECT id FROM tb_exper_dev WHERE exper_id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
<!--获取试验样品设备ID-->
|
|
|
|
|
<select id="getExperDevItems" resultType="java.lang.Long">
|
|
|
|
|
SELECT id FROM tb_exper_dev_items WHERE dev_id IN
|
|
|
|
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
</select>
|
|
|
|
|
<!--查询试验项ID-->
|
|
|
|
|
<select id="getExperItemsIds" resultType="java.lang.Long">
|
|
|
|
|
SELECT id FROM tb_exper_items WHERE exper_id = #{id}
|
|
|
|
|
</select>
|
2024-07-22 14:23:14 +08:00
|
|
|
<!--查询试验设备数量-->
|
|
|
|
|
<select id="getExperDevItemsNum" resultType="java.util.Map">
|
|
|
|
|
SELECT dev_code AS devCode,
|
|
|
|
|
dev_data AS testResult
|
|
|
|
|
FROM tb_exper_dev
|
|
|
|
|
WHERE exper_id = #{experId}
|
|
|
|
|
</select>
|
|
|
|
|
<!--判断是否处于审核流程中的数据-->
|
|
|
|
|
<select id="isCheck" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(*)
|
|
|
|
|
FROM tb_exper
|
|
|
|
|
WHERE id = #{id} AND del_flag = 0 AND (
|
|
|
|
|
(status = 0 AND audit_status = 0) OR
|
|
|
|
|
(status = 1 AND audit_status = 2) OR
|
|
|
|
|
(status = 2 AND audit_status = 3) OR
|
|
|
|
|
(status = 3 AND audit_status = 4)
|
|
|
|
|
)
|
|
|
|
|
</select>
|
2024-07-22 15:45:51 +08:00
|
|
|
<!--判断提交数据中是否存在流程数据或者存在待试验项-->
|
|
|
|
|
<select id="isNotEditData" resultType="java.lang.Integer">
|
|
|
|
|
SELECT COUNT(*) FROM tb_sample
|
|
|
|
|
WHERE id IN
|
|
|
|
|
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
|
|
|
|
#{item}
|
|
|
|
|
</foreach>
|
|
|
|
|
AND del_flag = 0
|
|
|
|
|
AND (
|
|
|
|
|
process_status IS NULL
|
|
|
|
|
(audti_status = 0 AND process_status = 1) OR
|
|
|
|
|
(audti_status = 0 AND process_status = 2) OR
|
|
|
|
|
(audti_status = 0 AND process_status = 3) OR
|
|
|
|
|
(audti_status = 1 AND process_status = 4)
|
|
|
|
|
)
|
|
|
|
|
</select>
|
2024-07-20 15:18:16 +08:00
|
|
|
</mapper>
|