diff --git a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcDictBizServiceImpl.java b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcDictBizServiceImpl.java index 24a4e50a..5f6baf99 100644 --- a/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcDictBizServiceImpl.java +++ b/xhpc-modules/xhpc-general/src/main/java/com/xhpc/general/service/XhpcDictBizServiceImpl.java @@ -234,16 +234,15 @@ public class XhpcDictBizServiceImpl implements IXhpcDictBizService{ String value=xhpcDictionary.getDictValue(); String codeValue=xhpcDictionary.getCode(); - // Judging the father item whether could insert. - if(!value.equals(dictValue)){ + if(value!=null&&!value.equals(dictValue)){ //Ensuring the name(dict_value) has existed. int size=xhpcDictBizMapper.countParentNameQuantity(dictValue); if(size>0){ return AjaxResult.error("您输入的字典名称已经存在。"); } } - if(!codeValue.equals(code)){ + if(codeValue!=null&&!codeValue.equals(code)){ //Ensuring the code whether has existed. int quantity=xhpcDictBizQuantityCheckMapper.countCodeRows(code); if(quantity>0){ @@ -324,12 +323,12 @@ public class XhpcDictBizServiceImpl implements IXhpcDictBizService{ for(String value:idsArray){ idsList.add(Long.parseLong(value)); } + int size=xhpcDictBizMapper.deleteChildItemByIds(idsList); if(size==0){ return AjaxResult.error("删除失败"); - }else { - return AjaxResult.success(); } + return AjaxResult.success(); } @Override @@ -348,10 +347,12 @@ public class XhpcDictBizServiceImpl implements IXhpcDictBizService{ } //Deleting the parent's child. - int sizeChild=xhpcDictBizMapper.deleteChildItemsAfterTheirParentDied(idsList); - if(sizeChild==0){ + try { + xhpcDictBizMapper.deleteChildItemsAfterTheirParentDied(idsList); + } catch (Exception e) { return AjaxResult.error("删除失败"); } + return AjaxResult.success(); } } diff --git a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcDictBizMapper.xml b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcDictBizMapper.xml index db4dca9d..e277adce 100644 --- a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcDictBizMapper.xml +++ b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcDictBizMapper.xml @@ -25,11 +25,11 @@ @@ -88,17 +88,17 @@ update xhpc_dict_biz set dict_key=#{key},dict_value=#{value},sort=#{sort} where dict_biz_id=#{id} - + update xhpc_dict_biz set del_flag=1 where dict_biz_id in #{item} - + @@ -113,9 +113,4 @@ #{item} - - - - - diff --git a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcDictQuantityCheckMapper.xml b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcDictQuantityCheckMapper.xml index b082ac9b..e8a53490 100644 --- a/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcDictQuantityCheckMapper.xml +++ b/xhpc-modules/xhpc-general/src/main/resources/mapper/XhpcDictQuantityCheckMapper.xml @@ -3,20 +3,18 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - \ No newline at end of file