协议删除限制

This commit is contained in:
hongchao 2025-11-07 16:24:07 +08:00
parent c90560fbaa
commit 8cf7b8ac23
3 changed files with 14 additions and 1 deletions

View File

@ -109,4 +109,6 @@ public interface BmAgreementInfoMapper
* @return * @return
*/ */
Long selectProjectUnitAgreementIdByTeamAndProject(@Param("teamId") Long unitId, @Param("projectId") Long projectId); Long selectProjectUnitAgreementIdByTeamAndProject(@Param("teamId") Long unitId, @Param("projectId") Long projectId);
int selectSltInfoByagreementId(Long agreementId);
} }

View File

@ -252,8 +252,11 @@ public class BmAgreementInfoServiceImpl implements IBmAgreementInfoService
{ {
//查询该协议是否存在领料任务有的话不能删除 //查询该协议是否存在领料任务有的话不能删除
int res = bmAgreementInfoMapper.selectByagreementId(agreementId); int res = bmAgreementInfoMapper.selectByagreementId(agreementId);
int res2 = bmAgreementInfoMapper.selectSltInfoByagreementId(agreementId);
if (res > 0) { if (res > 0) {
throw new ServiceException("该协议存在领料任务,不能删除"); throw new ServiceException("该协议存在领退料记录,不能删除");
} else if(res2 > 0){
throw new ServiceException("该协议存在领退料记录,不能删除");
} else { } else {
return bmAgreementInfoMapper.deleteBmAgreementInfoByAgreementId(agreementId); return bmAgreementInfoMapper.deleteBmAgreementInfoByAgreementId(agreementId);
} }

View File

@ -212,4 +212,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bai.unit_id = #{teamId} AND bai.project_id = #{projectId} bai.unit_id = #{teamId} AND bai.project_id = #{projectId}
LIMIT 1 LIMIT 1
</select> </select>
<select id="selectSltInfoByagreementId" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
slt_agreement_info
WHERE
agreement_id = #{agreementId}
</select>
</mapper> </mapper>