Commit 24197cae by 谢海旭

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

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