国内外标准--如果清单下挂着标准A,在标准库里删除标准A的话,加个验证 不让删这个标准
This commit is contained in:
+4
-1
@@ -218,7 +218,10 @@ public class SarStandardsInfoController extends BaseController<SarStandardsInfo>
|
||||
int result = sarStandardsInfoEOService.deleteSarStandards(ids);
|
||||
if (result > 0) {
|
||||
return Result.success("0", "删除成功", result);
|
||||
} else {
|
||||
}else if(result == -1) {
|
||||
return Result.success("-1","所选的标准下挂有标准,无法删除");
|
||||
}
|
||||
else {
|
||||
return Result.error("删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
+21
@@ -15,6 +15,8 @@ import com.adc.da.search.entity.StandLawsEO;
|
||||
import com.adc.da.search.service.StandLawsSearchService;
|
||||
import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao;
|
||||
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.entity.SarLawsAttrDetailedList;
|
||||
import com.adc.da.slrs.sarLawsAttrDetailedList.service.impl.SarLawsAttrDetailedListServiceImpl;
|
||||
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
|
||||
import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage;
|
||||
import com.adc.da.slrs.sarLawsInfo.page.SarLawsItemsEOPage;
|
||||
@@ -1285,13 +1287,32 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
SarLawsAttrDetailedListServiceImpl detailedListService;
|
||||
|
||||
public int deleteSarStandards(String ids) {
|
||||
QueryWrapper<SarLawsAttrDetailedList> detailedListQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
String[] idArr = ids.split(",");
|
||||
SarStandardsInfo sarStandardsInfoEO = new SarStandardsInfo();
|
||||
sarStandardsInfoEO.setValidFlag("1");
|
||||
sarStandardsInfoEO.setModifyTime(new Date());
|
||||
int countResult = 0;
|
||||
//如果清单下挂着标准A,在标准库里删除标准A的话,加个验证 不让删这个标准
|
||||
for (String id : idArr){
|
||||
detailedListQueryWrapper.eq("stand_id",id);
|
||||
|
||||
int count = detailedListService.count(detailedListQueryWrapper);
|
||||
if (count>0){
|
||||
countResult = -1;
|
||||
return countResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (String id : idArr) {
|
||||
|
||||
countResult++;
|
||||
//查询删除的标准信息(为删除代替关系)
|
||||
SarStandardsInfo getDelStandInfoList = dao.selectById(id);
|
||||
|
||||
Reference in New Issue
Block a user