Commit 24197cae by 谢海旭

下发门店校验是否存在同模板已在用逻辑

1 parent ebf8214a
......@@ -26,11 +26,11 @@ public interface SopTplGrantMapper extends CommonBaseMapper<SopTplGrant> {
int countAllByTplId(@Param("tplId") String tplId);
/**
* 根据模板id和门店id集合查询授权记录
* 根据模板id和门店id集合查询授权在用记录
*
* @param tplId 模板id
* @param groupIds 门店id集合
* @return
*/
List<SopTplGrant> selectByTplIdAndGroupIds(@Param("tplId") String tplId, @Param("groupIds") List<String> groupIds);
List<SopTplGrant> selectInUseGrants(@Param("tplId") String tplId, @Param("groupIds") List<String> groupIds);
}
\ No newline at end of file
......@@ -278,7 +278,7 @@ public class SopInstService {
}
List<String> groupIds = sopTplGrants.stream().map(sopTplGrant -> sopTplGrant.getGroupId()).collect(Collectors.toList());
List<SopTplGrant> grants = sopTplGrantMapper.selectByTplIdAndGroupIds(tplId, groupIds);
List<SopTplGrant> grants = sopTplGrantMapper.selectInUseGrants(tplId, groupIds);
if (!CollectionUtils.isEmpty(grants)) {
throw ResultException.create(SystemMessage.ARGS_ERROR.getCode(), String.format("%s已存在该旅程,请确认后重新操作", grants.get(0).getGroupName()));
}
......
......@@ -59,7 +59,8 @@
<select id="selectByCustomData" resultType="cn.com.glsx.process.modules.entity.SopInst">
SELECT
<include refid="Base_Column_List"/>
FROM sop_inst WHERE JSON_CONTAINS(inst_param, CAST(#{customData,typeHandler=cn.com.glsx.process.modules.handler.JsonTypeHandler} AS JSON),'$.customData');
FROM sop_inst
WHERE JSON_CONTAINS(inst_param, CAST(#{customData,typeHandler=cn.com.glsx.process.modules.handler.JsonTypeHandler} AS JSON),'$.customData') AND instStatus != -1;
</select>
<select id="page" resultMap="BaseResultDTOMap">
......
......@@ -35,11 +35,14 @@
SELECT COUNT(0) FROM sop_tpl_grant WHERE tpl_id = #{tplId}
</select>
<select id="selectByTplIdAndGroupIds" resultMap="BaseResultMap">
<select id="selectInUseGrants" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM sop_tpl_grant
WHERE tpl_id = #{tplId} AND group_id IN <foreach collection="groupIds" item="groupId" open="(" separator="," close=")"> #{groupId} </foreach>
stg.grant_id, stg.group_id, stg.group_name, stg.tpl_id, stg.create_time, stg.update_time, stg.grant_status
FROM sop_tpl_grant stg
INNER JOIN sop_inst si ON stg.grant_id = si.grant_id
WHERE stg.tpl_id = #{tplId}
AND stg.group_id IN <foreach collection="groupIds" item="groupId" open="(" separator="," close=")"> #{groupId} </foreach>
AND si.inst_status != -1
</select>
<delete id="del">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!