检验项目删除

master
philip 3 years ago
parent 2e2601b291
commit 18df19141e

@ -24,4 +24,10 @@ public interface InspectionItemMapper extends BaseMapper<InspectionItem> {
List<InspectionItemDetail> selectWidestQualityInspection(@Param("site")String site,@Param("inspectionType")String inspectionType,@Param("additionalObject")String additionalObject);
Integer checkRouterStep(@Param("site")String site,@Param("operation") String operation,@Param("stepId") String stepId);
Integer resrcePlanCheck(String handle);
Integer resrceTaskCheck(String handle);
Integer inspectTaskCheck(String handle);
}

@ -219,7 +219,20 @@ public class InspectionItemServiceImpl extends ServiceImpl<InspectionItemMapper,
throw new BaseException("请输入版本");
}
inspectionItem.setSite(CommonMethods.getSite());
inspectionItem.setHandle(HandleEnum.INSPECTION_ITEM.getHandle(inspectionItem.getSite(), inspectionItem.getInspectionItemNo(), inspectionItem.getRevision()));
String handle = HandleEnum.INSPECTION_ITEM.getHandle(inspectionItem.getSite(), inspectionItem.getInspectionItemNo(), inspectionItem.getRevision());
inspectionItem.setHandle(handle);
Integer num=inspectionItemMapper.resrcePlanCheck(handle);
if (num>0){
throw new BaseException("检验项目已被使用,无法删除");
}
num=inspectionItemMapper.resrceTaskCheck(handle);
if (num>0){
throw new BaseException("检验项目已被使用,无法删除");
}
num=inspectionItemMapper.inspectTaskCheck(handle);
if (num>0){
throw new BaseException("检验项目已被使用,无法删除");
}
HashMap<String, Object> removeCondition = new HashMap<>();
removeCondition.put(InspectionItemAddition.INSPECTION_ITEM_BO, inspectionItem.getHandle());
inspectionItemAdditionService.removeByMap(removeCondition);

@ -475,4 +475,14 @@
WHERE (ziia.ADDITIONAL_OBJECT_TYPE='ITEM' OR ziia.ADDITIONAL_OBJECT_TYPE='OPERATION') AND zii.STATUS='Y' AND zii.INSPECTION_TYPE=#{inspectionType}
AND ziia.ADDITIONAL_OBJECT=#{additionalObject} AND zii.SITE=#{site}
</select>
<select id="resrcePlanCheck" resultType="java.lang.Integer">
SELECT count(HANDLE) FROM Z_RESOURCE_INSPECT_PLAN zrip WHERE INSPECTION_ITEM_BO=#{handle}
</select>
<select id="resrceTaskCheck" resultType="java.lang.Integer">
SELECT count(HANDLE) FROM Z_RESOURCE_INSPECT_TASK zrip WHERE INSPECTION_ITEM_BO=#{handle}
</select>
<select id="inspectTaskCheck" resultType="java.lang.Integer">
SELECT count(HANDLE) FROM Z_INSPECTION_TASK zrip WHERE INSPECTION_ITEM_BO=#{handle}
</select>
</mapper>

Loading…
Cancel
Save