|
|
@@ -99,67 +99,65 @@
|
|
|
<select id="selectByModel" resultMap="BaseResultMap">
|
|
|
select *
|
|
|
from (
|
|
|
- <if test="modelId!=null and flowNodeId !=null and stationId != null">
|
|
|
SELECT tws.sop_id, tws.sop_title, tws.sop_path, tws.sop_img
|
|
|
FROM mst.t_work_sop tws
|
|
|
WHERE tws.fty_id = #{ftyId}
|
|
|
and tws.flg_valid
|
|
|
and (
|
|
|
tws.model_id = #{modelId}
|
|
|
--- and
|
|
|
--- exists(
|
|
|
--- select 1
|
|
|
--- from mst.t_work_sop_detail twsd
|
|
|
--- where twsd.sop_id = tws.sop_id
|
|
|
--- and twsd.flow_node_id = #{flowNodeId}::uuid
|
|
|
--- and twsd.station_id = #{stationId}
|
|
|
--- )
|
|
|
+<!-- and
|
|
|
+ exists(
|
|
|
+ select 1
|
|
|
+ from mst.t_work_sop_detail twsd
|
|
|
+ where twsd.sop_id = tws.sop_id
|
|
|
+ and twsd.flow_node_id = #{flowNodeId}::uuid
|
|
|
+ and twsd.station_id = #{stationId}
|
|
|
+ )-->
|
|
|
)
|
|
|
- </if>
|
|
|
- <if test="modelId!=null and flowNodeId !=null">
|
|
|
+<!-- <if test="modelId!=null and flowNodeId !=null">
|
|
|
SELECT tws.sop_id, tws.sop_title, tws.sop_path, tws.sop_img
|
|
|
FROM mst.t_work_sop tws
|
|
|
WHERE tws.fty_id = #{ftyId}
|
|
|
and tws.flg_valid
|
|
|
and (
|
|
|
tws.model_id = #{modelId}
|
|
|
--- and
|
|
|
--- exists(
|
|
|
--- select 1
|
|
|
--- from mst.t_work_sop_detail twsd
|
|
|
--- where twsd.sop_id = tws.sop_id
|
|
|
--- and twsd.flow_node_id = #{flowNodeId}::uuid
|
|
|
--- )
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="modelId!=null">
|
|
|
- SELECT tws.sop_id, tws.sop_title, tws.sop_path, tws.sop_img
|
|
|
- FROM mst.t_work_sop tws
|
|
|
- WHERE tws.fty_id = #{ftyId}
|
|
|
- and tws.flg_valid
|
|
|
- and tws.model_id = #{modelId}
|
|
|
- </if>
|
|
|
- ) t
|
|
|
- limit 1
|
|
|
- </select>
|
|
|
+ and
|
|
|
+ exists(
|
|
|
+ select 1
|
|
|
+ from mst.t_work_sop_detail twsd
|
|
|
+ where twsd.sop_id = tws.sop_id
|
|
|
+ and twsd.flow_node_id = #{flowNodeId}::uuid
|
|
|
+ )
|
|
|
+ )
|
|
|
+ </if>-->
|
|
|
+<!-- <if test="modelId!=null">
|
|
|
+ SELECT tws.sop_id, tws.sop_title, tws.sop_path, tws.sop_img
|
|
|
+ FROM mst.t_work_sop tws
|
|
|
+ WHERE tws.fty_id = #{ftyId}
|
|
|
+ and tws.flg_valid
|
|
|
+ and tws.model_id = #{modelId}
|
|
|
+ </if>-->
|
|
|
+ ) t
|
|
|
+ limit 1
|
|
|
+ </select>
|
|
|
|
|
|
- <sql id="selectDetail">
|
|
|
- SELECT
|
|
|
- <include refid="Base_Column_List"/>,
|
|
|
- tmp.model_name,
|
|
|
- tmp.model_code,
|
|
|
- tws.model_category,
|
|
|
- tmc.category_id,
|
|
|
- tmc.category_code AS category_code,
|
|
|
- tmc.category_name AS category_name,
|
|
|
- tmc.level_name AS category_level_name,
|
|
|
- (select string_agg(node_name, ' | ') from pdm.t_process_node where node_id = any(tws.flow_node_ids)) as flow_node_names
|
|
|
- FROM mst.t_work_sop tws
|
|
|
- left join mst.t_model_product tmp on tmp.model_id = tws.model_id
|
|
|
- left join mst.t_model_category tmc on tmc.category_id = tws.model_category
|
|
|
- </sql>
|
|
|
+ <sql id="selectDetail">
|
|
|
+ SELECT
|
|
|
+ <include refid="Base_Column_List"/>,
|
|
|
+ tmp.model_name,
|
|
|
+ tmp.model_code,
|
|
|
+ tws.model_category,
|
|
|
+ tmc.category_id,
|
|
|
+ tmc.category_code AS category_code,
|
|
|
+ tmc.category_name AS category_name,
|
|
|
+ tmc.level_name AS category_level_name,
|
|
|
+ (select string_agg(node_name, ' | ') from pdm.t_process_node where node_id = any(tws.flow_node_ids)) as flow_node_names
|
|
|
+ FROM mst.t_work_sop tws
|
|
|
+ left join mst.t_model_product tmp on tmp.model_id = tws.model_id
|
|
|
+ left join mst.t_model_category tmc on tmc.category_id = tws.model_category
|
|
|
+ </sql>
|
|
|
|
|
|
- <!-- 根据主键锁定表mst.t_work_sop的一行数据 -->
|
|
|
+ <!-- 根据主键锁定表mst.t_work_sop的一行数据 -->
|
|
|
<select id="selectByIdForUpdate" resultMap="BaseResultMap">
|
|
|
SELECT
|
|
|
<include refid="Base_Column_List"/>
|
|
|
@@ -258,13 +256,13 @@
|
|
|
</if>
|
|
|
and tws.flg_valid
|
|
|
and tws.model_id is null
|
|
|
--- and exists(
|
|
|
--- select 1
|
|
|
--- from mst.t_work_sop_detail twsd
|
|
|
--- where twsd.sop_id = tws.sop_id
|
|
|
--- and twsd.flow_node_id is null
|
|
|
--- and twsd.station_id is null
|
|
|
--- )
|
|
|
+<!-- and exists(
|
|
|
+ select 1
|
|
|
+ from mst.t_work_sop_detail twsd
|
|
|
+ where twsd.sop_id = tws.sop_id
|
|
|
+ and twsd.flow_node_id is null
|
|
|
+ and twsd.station_id is null
|
|
|
+ )-->
|
|
|
) t
|
|
|
</select>
|
|
|
|