You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
224 lines
11 KiB
XML
224 lines
11 KiB
XML
<?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.op.quality.mapper.QcCheckTaskDetailMapper">
|
|
|
|
<resultMap type="QcCheckTaskDetail" id="QcCheckTaskDetailResult">
|
|
<result property="recordId" column="record_id"/>
|
|
<result property="belongTo" column="belong_to"/>
|
|
<result property="orderNum" column="order_num"/>
|
|
<result property="ruleName" column="rule_name"/>
|
|
<result property="propertyCode" column="property_code"/>
|
|
<result property="checkMode" column="check_mode"/>
|
|
<result property="checkTool" column="check_tool"/>
|
|
<result property="unitCode" column="unit_code"/>
|
|
<result property="checkStandard" column="check_standard"/>
|
|
<result property="actualValue" column="actual_value"/>
|
|
<result property="status" column="status"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="attr1" column="attr1"/>
|
|
<result property="attr2" column="attr2"/>
|
|
<result property="attr3" column="attr3"/>
|
|
<result property="attr4" column="attr4"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="factoryCode" column="factory_code"/>
|
|
<result property="delFlag" column="del_flag"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectQcCheckTaskDetailVo">
|
|
select record_id, belong_to, order_num, rule_name, property_code, check_mode, check_tool, unit_code, check_standard,
|
|
actual_value, status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time,
|
|
factory_code, del_flag
|
|
from qc_check_task_detail
|
|
</sql>
|
|
|
|
<select id="selectQcCheckTaskDetailList" parameterType="QcCheckTaskDetail" resultMap="QcCheckTaskDetailResult">
|
|
<include refid="selectQcCheckTaskDetailVo"/>
|
|
<where>
|
|
<if test="belongTo != null and belongTo != ''">and belong_to = #{belongTo}</if>
|
|
<if test="orderNum != null and orderNum != ''">and order_num = #{orderNum}</if>
|
|
<if test="ruleName != null and ruleName != ''">and rule_name like concat('%', #{ruleName}, '%')</if>
|
|
<if test="propertyCode != null and propertyCode != ''">and property_code = #{propertyCode}</if>
|
|
<if test="checkMode != null and checkMode != ''">and check_mode = #{checkMode}</if>
|
|
<if test="checkTool != null and checkTool != ''">and check_tool = #{checkTool}</if>
|
|
<if test="unitCode != null and unitCode != ''">and unit_code = #{unitCode}</if>
|
|
<if test="checkStandard != null and checkStandard != ''">and check_standard = #{checkStandard}</if>
|
|
<if test="actualValue != null ">and actual_value = #{actualValue}</if>
|
|
<if test="status != null and status != ''">and status = #{status}</if>
|
|
<if test="attr1 != null and attr1 != ''">and attr1 = #{attr1}</if>
|
|
<if test="attr2 != null and attr2 != ''">and attr2 = #{attr2}</if>
|
|
<if test="attr3 != null and attr3 != ''">and attr3 = #{attr3}</if>
|
|
<if test="attr4 != null and attr4 != ''">and attr4 = #{attr4}</if>
|
|
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
|
|
and del_flag = '0'
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectQcCheckTaskDetailByRecordId" parameterType="String" resultMap="QcCheckTaskDetailResult">
|
|
<include refid="selectQcCheckTaskDetailVo"/>
|
|
where record_id = #{recordId}
|
|
</select>
|
|
<select id="getProjectStatus" resultType="java.lang.String">
|
|
select
|
|
td.status
|
|
from qc_check_task_detail td
|
|
where td.belong_to = #{belongTo} and td.status = 'N'
|
|
</select>
|
|
|
|
<insert id="insertQcCheckTaskDetail" parameterType="QcCheckTaskDetail">
|
|
insert into qc_check_task_detail
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="recordId != null">record_id,</if>
|
|
<if test="belongTo != null">belong_to,</if>
|
|
<if test="orderNum != null">order_num,</if>
|
|
<if test="ruleName != null">rule_name,</if>
|
|
<if test="propertyCode != null">property_code,</if>
|
|
<if test="checkMode != null">check_mode,</if>
|
|
<if test="checkTool != null">check_tool,</if>
|
|
<if test="unitCode != null">unit_code,</if>
|
|
<if test="checkStandard != null">check_standard,</if>
|
|
<if test="actualValue != null">actual_value,</if>
|
|
<if test="status != null">status,</if>
|
|
<if test="remark != null">remark,</if>
|
|
<if test="attr1 != null">attr1,</if>
|
|
<if test="attr2 != null">attr2,</if>
|
|
<if test="attr3 != null">attr3,</if>
|
|
<if test="attr4 != null">attr4,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code,</if>
|
|
<if test="delFlag != null">del_flag,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="recordId != null">#{recordId},</if>
|
|
<if test="belongTo != null">#{belongTo},</if>
|
|
<if test="orderNum != null">#{orderNum},</if>
|
|
<if test="ruleName != null">#{ruleName},</if>
|
|
<if test="propertyCode != null">#{propertyCode},</if>
|
|
<if test="checkMode != null">#{checkMode},</if>
|
|
<if test="checkTool != null">#{checkTool},</if>
|
|
<if test="unitCode != null">#{unitCode},</if>
|
|
<if test="checkStandard != null">#{checkStandard},</if>
|
|
<if test="actualValue != null">#{actualValue},</if>
|
|
<if test="status != null">#{status},</if>
|
|
<if test="remark != null">#{remark},</if>
|
|
<if test="attr1 != null">#{attr1},</if>
|
|
<if test="attr2 != null">#{attr2},</if>
|
|
<if test="attr3 != null">#{attr3},</if>
|
|
<if test="attr4 != null">#{attr4},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
<if test="factoryCode != null and factoryCode != ''">#{factoryCode},</if>
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
</trim>
|
|
</insert>
|
|
<insert id="addBatch">
|
|
insert into qc_check_task_detail(
|
|
record_id,belong_to,
|
|
project_id,project_no,rule_name,order_num,
|
|
property_code,check_mode,
|
|
check_tool,unit_code,
|
|
check_standard,actual_value,
|
|
status,create_by,create_time,
|
|
factory_code,del_flag,type_project_id
|
|
) values
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
(
|
|
#{item.recordId},#{item.belongTo},
|
|
#{item.projectId},#{item.projectNo},#{item.ruleName},#{item.sort},
|
|
#{item.propertyCode},#{item.checkMode},
|
|
#{item.checkTool},#{item.unitCode},
|
|
#{item.standardValue},#{item.actualValue},
|
|
#{item.status},#{item.createBy},#{item.createTime},
|
|
#{item.factoryCode},'0',#{item.typeProjectId}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updateQcCheckTaskDetail" parameterType="QcCheckTaskDetail">
|
|
update qc_check_task_detail
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="belongTo != null">belong_to = #{belongTo},</if>
|
|
<if test="orderNum != null">order_num = #{orderNum},</if>
|
|
<if test="ruleName != null">rule_name = #{ruleName},</if>
|
|
<if test="propertyCode != null">property_code = #{propertyCode},</if>
|
|
<if test="checkMode != null">check_mode = #{checkMode},</if>
|
|
<if test="checkTool != null">check_tool = #{checkTool},</if>
|
|
<if test="unitCode != null">unit_code = #{unitCode},</if>
|
|
<if test="checkStandard != null">check_standard = #{checkStandard},</if>
|
|
<if test="actualValue != null">actual_value = #{actualValue},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
<if test="attr1 != null">attr1 = #{attr1},</if>
|
|
<if test="attr2 != null">attr2 = #{attr2},</if>
|
|
<if test="attr3 != null">attr3 = #{attr3},</if>
|
|
<if test="attr4 != null">attr4 = #{attr4},</if>
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
<if test="factoryCode != null and factoryCode != ''">factory_code = #{factoryCode},</if>
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
<if test="defectCode != null">defect_code = #{defectCode},</if>
|
|
<if test="defectQuality != null">defect_quality = #{defectQuality},</if>
|
|
</trim>
|
|
where record_id = #{recordId}
|
|
</update>
|
|
|
|
<delete id="deleteQcCheckTaskDetailByRecordId" parameterType="String">
|
|
delete from qc_check_task_detail where record_id = #{recordId}
|
|
</delete>
|
|
|
|
<update id="deleteQcCheckTaskDetailByBelongTo" parameterType="String">
|
|
update qc_check_task_detail
|
|
set del_flag = '1'
|
|
where belong_to = #{recordId}
|
|
</update>
|
|
|
|
<delete id="deleteQcCheckTaskDetailByRecordIds" parameterType="String">
|
|
delete from qc_check_task_detail where record_id in
|
|
<foreach item="recordId" collection="array" open="(" separator="," close=")">
|
|
#{recordId}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="selectNoCheckList" resultType="com.op.quality.domain.QcCheckReportIncome">
|
|
select
|
|
record_id as recordId,
|
|
check_no as checkNo,
|
|
income_batch_no as incomeBatchNo,
|
|
order_no as orderNo,
|
|
material_code as materialCode,
|
|
material_name as materialName,
|
|
check_type as checkType,
|
|
check_status as checkStatus,
|
|
confirm_time as confirmTime
|
|
from qc_check_task
|
|
where del_flag = '0'
|
|
and check_status = '0'
|
|
and datediff( hour, create_time,CONVERT(varchar(10),GETDATE())) > 1
|
|
and confirm_time is null
|
|
</select>
|
|
|
|
<!-- 批量更新 -->
|
|
<update id="updateBatchConfirmTime" parameterType="java.util.List">
|
|
<foreach collection="list" item="item" separator=";">
|
|
UPDATE qc_check_task
|
|
set confirm_time = getdate()
|
|
WHERE record_id = #{item.recordId}
|
|
and del_flag = '0'
|
|
and check_status = '0'
|
|
and confirm_time is null
|
|
</foreach>
|
|
</update>
|
|
|
|
</mapper>
|