<?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.chinaztt.mes.quality.mapper.TestStandardMapper">
|
|
<resultMap id="qualityTestStandardMap" type="com.chinaztt.mes.quality.dto.TestStandardDTO">
|
<id property="id" column="id"/>
|
<result property="standardNo" column="standard_no"/>
|
<result property="standardName" column="standard_name"/>
|
<result property="remark" column="remark"/>
|
<result property="version" column="version"/>
|
<result property="createTime" column="create_time"/>
|
<result property="updateTime" column="update_time"/>
|
<result property="createUser" column="create_user"/>
|
<result property="updateUser" column="update_user"/>
|
<result property="active" column="active"/>
|
<result property="state" column="state"/>
|
<result property="judgeFormula" column="judge_formula"/>
|
<result property="inspectionType" column="inspection_type"/>
|
<result property="layoutJson" column="layout_json"/>
|
<result property="operationId" column="operation_id"/>
|
<result property="operationName" column="operation_name"/>
|
<result property="operationNo" column="operation_no"/>
|
</resultMap>
|
|
<select id="findMoTestStandardBySystemNo" resultType="com.chinaztt.mes.quality.entity.TestStandard">
|
SELECT pmts.*
|
FROM production_product_output ppo
|
LEFT JOIN production_product_main ppm ON ppm."id" = ppo.product_main_id
|
LEFT JOIN production_operation_task pot ON pot."id" = ppm.operation_task_id
|
LEFT JOIN production_operation_task_supply pots ON pots.operation_task_id = ppm.operation_task_id
|
LEFT JOIN plan_mo_test_standard pmts ON pmts.mo_id = pots.mo_id AND pmts.routing_operation_id = pot.routing_operation_id
|
WHERE ppo.system_no = #{systemNo}
|
</select>
|
|
<delete id="deleteBatchIds">
|
delete from quality_test_standard where id in
|
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<select id="getTestStandard" resultMap="qualityTestStandardMap">
|
SELECT A.*
|
FROM quality_test_standard A
|
LEFT JOIN technology_join_document_test_standard B ON A."id" = B.test_standard_id
|
WHERE B.document_id = #{id}
|
</select>
|
|
<select id="getTestStand" resultMap="qualityTestStandardMap">
|
SELECT A.*
|
FROM quality_test_standard A
|
LEFT JOIN technology_join_document_test_standard B ON A."id" = B.test_standard_id
|
WHERE B.document_id = #{id}
|
<if test="ew.emptyOfWhere == false">
|
and ${ew.SqlSegment}
|
</if>
|
</select>
|
<select id="pageInfo" resultMap="qualityTestStandardMap">
|
select * from (
|
SELECT
|
qts.* ,o.name as operation_name ,o.operation_no
|
FROM
|
quality_test_standard qts
|
LEFT JOIN technology_operation o on qts.operation_id = o.id
|
) a
|
<if test="ew.emptyOfWhere == false">
|
<where>
|
${ew.SqlSegment}
|
</where>
|
</if>
|
</select>
|
<select id="getInfoById" resultType="com.chinaztt.mes.quality.dto.TestStandardDTO">
|
SELECT
|
qts.* ,o.name as operation_name ,o.operation_no
|
FROM
|
quality_test_standard qts
|
LEFT JOIN technology_operation o on qts.operation_id = o.id
|
where qts.id = #{id}
|
</select>
|
|
<select id="getOperationIdByOperationName" resultType="java.lang.Long">
|
SELECT "id" FROM technology_operation WHERE "name" = #{operationName} LIMIT 1
|
</select>
|
|
<select id="selectMoTestStandardDTOList" resultType="com.chinaztt.mes.quality.dto.MoTestStandardDTO">
|
SELECT
|
pmts.*,
|
pmoro.inspection,
|
too.name AS operation_name
|
FROM production_product_output ppo
|
LEFT JOIN production_product_main ppm ON ppm."id" = ppo.product_main_id
|
LEFT JOIN production_operation_task pot ON pot."id" = ppm.operation_task_id
|
LEFT JOIN plan_manufacturing_order_routing_operation pmoro ON pmoro.id = pot.mo_routing_operation_id
|
LEFT JOIN plan_mo_test_standard pmts ON pmts.mo_id = pmoro.mo_id AND pmts.mo_routing_operation_id = pot.mo_routing_operation_id
|
LEFT JOIN technology_operation too ON too.id = pmoro.operation_id
|
WHERE ppo.system_no = #{systemNo}
|
</select>
|
</mapper>
|