From dee2ecf79f505f4d4ff87eeb351a7a4da6b1e68b Mon Sep 17 00:00:00 2001 From: little-cat-sweet <2116400472@qq.com> Date: Fri, 30 Jul 2021 17:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=B8=9A=E5=8A=A1=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E6=A8=A1=E5=9D=97mapper=E5=B1=82=E5=B0=8Fbug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../general/service/XhpcDictBizServiceImpl.java | 15 ++++++++------- .../main/resources/mapper/XhpcDictBizMapper.xml | 15 +++++---------- .../mapper/XhpcDictQuantityCheckMapper.xml | 10 ++++------ 3 files changed, 17 insertions(+), 23 deletions(-) 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