2022-07-20 15:14:39 +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.cnbm.basic.mapper.ProductFeaturesMapper">
|
|
|
|
|
2022-08-09 15:16:12 +08:00
|
|
|
<select id="getProductFeaturesByProductId" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
|
2022-09-02 16:21:20 +08:00
|
|
|
select p.*,m.name as measureToolName,u.name as unitName,c.name as controlGraphName
|
2022-08-09 15:16:12 +08:00
|
|
|
from product_features p
|
|
|
|
LEFT JOIN measure_tool m ON p.measure_tool_id=m.id
|
|
|
|
LEFT JOIN unit u ON p.unit_id=u.id
|
|
|
|
LEFT JOIN control_graph c ON p.control_graph_id=c.id
|
|
|
|
<where>
|
|
|
|
p.valid = 1 AND p.product_id = #{id}
|
|
|
|
</where>
|
|
|
|
order by p.id asc
|
|
|
|
</select>
|
|
|
|
|
2022-09-15 09:55:49 +08:00
|
|
|
<select id="getFeaturesByStageProcedure" resultType="com.cnbm.basic.dto.FeaturesProcedureDTO">
|
|
|
|
select pf.id as productFeaturesId, fspr.working_procedure_id as workingProcedureId
|
|
|
|
from features_stage_procedure_relation fspr
|
|
|
|
LEFT JOIN product_features pf ON pf.id=fspr.product_features_id
|
|
|
|
<where>
|
|
|
|
fspr.valid = 1
|
|
|
|
<if test="productId != null">
|
|
|
|
and pf.product_id = #{productId}
|
|
|
|
</if>
|
|
|
|
<if test="inspectionStage != null">
|
|
|
|
and fspr.inspection_stage = #{inspectionStage}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
order by pf.id asc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
<!--
|
2022-09-02 16:21:20 +08:00
|
|
|
<select id="getFeaturesByStageProcedure" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
|
|
|
|
select *
|
|
|
|
from product_features pf
|
|
|
|
LEFT JOIN features_stage_procedure_relation fspr ON pf.id=fspr.product_features_id
|
2022-09-15 09:55:49 +08:00
|
|
|
LEFT JOIN product_workingprocedure_relation pwr ON pwr.working_procedure_id=fspr.working_procedure_id
|
2022-09-02 16:21:20 +08:00
|
|
|
<where>
|
|
|
|
fspr.valid = 1
|
2022-09-15 09:55:49 +08:00
|
|
|
<if test="productId != null">
|
|
|
|
and pwr.product_id = #{productId}
|
|
|
|
</if>
|
2022-09-02 16:21:20 +08:00
|
|
|
<if test="inspectionStage != null">
|
|
|
|
and fspr.inspection_stage = #{inspectionStage}
|
|
|
|
</if>
|
|
|
|
<if test="workingProcedureId != null">
|
|
|
|
and fspr.working_procedure_id = #{workingProcedureId}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
order by pf.id asc
|
|
|
|
</select>
|
2022-09-15 09:55:49 +08:00
|
|
|
-->
|
|
|
|
<select id="getFeaturesList" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
|
|
|
|
select pf.*,m.name as measureToolName,u.name as unitName,c.name as controlGraphName
|
|
|
|
from product_features pf
|
|
|
|
left join features_stage_procedure_relation fspr ON pf.id=fspr.product_features_id
|
|
|
|
LEFT JOIN measure_tool m ON pf.measure_tool_id=m.id
|
|
|
|
LEFT JOIN unit u ON pf.unit_id=u.id
|
|
|
|
LEFT JOIN control_graph c ON pf.control_graph_id=c.id
|
|
|
|
<where>
|
|
|
|
fspr.valid = 1
|
|
|
|
<if test="productId != null">
|
|
|
|
and pf.product_id = #{productId}
|
|
|
|
</if>
|
|
|
|
<if test="inspectionStage != null">
|
|
|
|
and fspr.inspection_stage = #{inspectionStage}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
order by pf.id asc
|
|
|
|
</select>
|
2022-09-30 08:54:33 +08:00
|
|
|
|
|
|
|
<select id="getControlGraphNameById" resultType="String">
|
|
|
|
select name from control_graph where id = #{id}
|
|
|
|
</select>
|
2022-12-28 10:31:27 +08:00
|
|
|
|
|
|
|
<select id="list" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
|
|
|
|
select * from product_features
|
|
|
|
order by id asc
|
|
|
|
</select>
|
|
|
|
|
2023-01-06 16:36:19 +08:00
|
|
|
<select id="getProductFeaturesByType" resultType="com.cnbm.basic.dto.ProductFeaturesDTO">
|
|
|
|
select * from product_features
|
|
|
|
<where>
|
|
|
|
valid = 1 AND type = #{type}
|
|
|
|
</where>
|
|
|
|
order by id asc
|
|
|
|
</select>
|
|
|
|
|
2022-07-20 15:14:39 +08:00
|
|
|
</mapper>
|