This commit is contained in:
2022-09-15 09:55:49 +08:00
parent c0ce68f5b2
commit fb65441dcc
24 changed files with 426 additions and 23 deletions

View File

@@ -17,4 +17,12 @@
<id column="version" property="version" />
</resultMap>
<select id="deleteByStageProcedure">
delete fspr from features_stage_procedure_relation fspr
inner join product_workingprocedure_relation pwr ON pwr.working_procedure_id=fspr.working_procedure_id
where fspr.working_procedure_id = #{workingProcedureId}
and fspr.inspection_stage = #{inspectionStage}
and pwr.product_id = #{productId}
</select>
</mapper>

View File

@@ -14,12 +14,33 @@
order by p.id asc
</select>
<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>
<!--
<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
LEFT JOIN product_workingprocedure_relation pwr ON pwr.working_procedure_id=fspr.working_procedure_id
<where>
fspr.valid = 1
<if test="productId != null">
and pwr.product_id = #{productId}
</if>
<if test="inspectionStage != null">
and fspr.inspection_stage = #{inspectionStage}
</if>
@@ -29,4 +50,23 @@
</where>
order by pf.id asc
</select>
-->
<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>
</mapper>

View File

@@ -2,4 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cnbm.basic.mapper.ProductWorkingprocedureRelationMapper">
<select id="getWorkingprocedureByProductId" resultType="com.cnbm.basic.dto.ProductWorkingprocedureRelationDTO">
select pwr.*, wp.name as workingProcedureName, wp.code as workingProcedureCode
from product_workingprocedure_relation pwr
LEFT JOIN working_procedure wp ON pwr.working_procedure_id=wp.id
<where>
pwr.valid = 1
<if test="productId != null">
and pwr.product_id=#{productId}
</if>
</where>
order by pwr.sequence asc
</select>
</mapper>