优化商品类别和机构的删除操作

This commit is contained in:
季圣华
2021-11-09 23:49:21 +08:00
parent 15ee7455f6
commit 9dc9785111
5 changed files with 38 additions and 10 deletions

View File

@@ -200,10 +200,14 @@ public class MaterialCategoryService {
if(strArray.length<1){
return 0;
}
try{
List<MaterialCategory> mcList = materialCategoryMapperEx.getMaterialCategoryListByCategoryIds(idArray);
if(mcList!=null && mcList.size()>0) {
logger.error("异常码[{}],异常提示[{}]",
ExceptionConstants.MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_CODE,ExceptionConstants.MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_MSG);
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_CODE,
ExceptionConstants.MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_MSG);
} else {
result=materialCategoryMapperEx.batchDeleteMaterialCategoryByIds(updateDate,updater,strArray);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}

View File

@@ -117,11 +117,16 @@ public class OrganizationService {
User userInfo=userService.getCurrentUser();
String [] idArray=ids.split(",");
int result=0;
try{
List <Organization> organList = organizationMapperEx.getOrganizationByParentIds(idArray);
if(organList!=null && organList.size()>0) {
//如果存在子机构则不能删除
logger.error("异常码[{}],异常提示[{}]",
ExceptionConstants.ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_CODE,ExceptionConstants.ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_MSG);
throw new BusinessRunTimeException(ExceptionConstants.ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_CODE,
ExceptionConstants.ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_MSG);
} else {
result=organizationMapperEx.batchDeleteOrganizationByIds(
new Date(),userInfo==null?null:userInfo.getId(),idArray);
}catch(Exception e){
JshException.writeFail(logger, e);
}
return result;
}