From d9c736b5f7a31c36d77a2519e9f76bbedb51e847 Mon Sep 17 00:00:00 2001
From: zhangyongzhangyong <2012005003@qq.com>
Date: Fri, 6 Aug 2021 14:55:31 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E7=BB=84=E7=BB=87=E7=B1=BB=E5=9E=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
epdc-cloud-admin/pom.xml | 8 ++--
.../com/elink/esua/epdc/dao/PartyOrgDao.java | 14 ++++++-
.../elink/esua/epdc/dao/PartyOrgTypeDao.java | 26 +++++++++++-
.../service/impl/PartyOrgTypeServiceImpl.java | 38 ++++++++++++++++-
.../src/main/resources/mapper/PartyOrgDao.xml | 36 ++++++++++++++++
.../main/resources/mapper/PartyOrgTypeDao.xml | 41 +++++++++++++++++++
6 files changed, 153 insertions(+), 10 deletions(-)
create mode 100644 epdc-cloud-admin/src/main/resources/mapper/PartyOrgDao.xml
create mode 100644 epdc-cloud-admin/src/main/resources/mapper/PartyOrgTypeDao.xml
diff --git a/epdc-cloud-admin/pom.xml b/epdc-cloud-admin/pom.xml
index a014a21..907fb7b 100644
--- a/epdc-cloud-admin/pom.xml
+++ b/epdc-cloud-admin/pom.xml
@@ -167,10 +167,10 @@
dev
dev
- 9
- 114.215.125.123
- 9603
- epdc!redis@master1405
+ 8
+ r-m5eh5czgb1nucti6azpd.redis.rds.aliyuncs.com
+ 10001
+ elink!888
false
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/PartyOrgDao.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/PartyOrgDao.java
index f59f67f..7a973e2 100644
--- a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/PartyOrgDao.java
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/PartyOrgDao.java
@@ -20,6 +20,7 @@ package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.PartyOrgEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
/**
* 党组织表 党组织表
@@ -29,5 +30,14 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PartyOrgDao extends BaseDao {
-
-}
\ No newline at end of file
+
+ /**
+ * 是否存在该类型(partyOrgType)的党组织
+ *
+ * @param typeCode
+ * @return java.lang.Integer
+ * @Author zhangyong
+ * @Date 14:34 2021-08-06
+ **/
+ Integer isPartyOrgExistByPartyOrgType(@Param("typeCode") String typeCode);
+}
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/PartyOrgTypeDao.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/PartyOrgTypeDao.java
index 7c90e37..c33a632 100644
--- a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/PartyOrgTypeDao.java
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/PartyOrgTypeDao.java
@@ -20,6 +20,7 @@ package com.elink.esua.epdc.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.entity.PartyOrgTypeEntity;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
/**
* 党组织类型表 党组织类型表
@@ -29,5 +30,26 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface PartyOrgTypeDao extends BaseDao {
-
-}
\ No newline at end of file
+
+ /**
+ * 返回值 >0 code 已经存在
+ *
+ * @param typeCode
+ * @param id 过滤自身(可选项)
+ * @return java.lang.Integer
+ * @Author zhangyong
+ * @Date 10:55 2021-04-28
+ **/
+ Integer isTypeCodeRepeated(@Param("typeCode") String typeCode, @Param("id") String id);
+
+ /**
+ * 返回值 >0 name 已经存在
+ *
+ * @param typeName
+ * @param id 过滤自身(可选项)
+ * @return java.lang.Integer
+ * @Author zhangyong
+ * @Date 10:55 2021-04-28
+ **/
+ Integer isTypeNameRepeated(@Param("typeName") String typeName, @Param("id") String id);
+}
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/PartyOrgTypeServiceImpl.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/PartyOrgTypeServiceImpl.java
index 01a12f9..006fb26 100644
--- a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/PartyOrgTypeServiceImpl.java
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/impl/PartyOrgTypeServiceImpl.java
@@ -20,9 +20,12 @@ package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
+import com.elink.esua.epdc.commons.tools.constant.NumConstant;
+import com.elink.esua.epdc.commons.tools.exception.RenException;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
+import com.elink.esua.epdc.dao.PartyOrgDao;
import com.elink.esua.epdc.dao.PartyOrgTypeDao;
import com.elink.esua.epdc.dto.PartyOrgTypeDTO;
import com.elink.esua.epdc.entity.PartyOrgTypeEntity;
@@ -48,6 +51,8 @@ public class PartyOrgTypeServiceImpl extends BaseServiceImpl page(Map params) {
@@ -70,7 +75,7 @@ public class PartyOrgTypeServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
-
+ wrapper.orderByAsc("SORT");
return wrapper;
}
@@ -83,6 +88,11 @@ public class PartyOrgTypeServiceImpl extends BaseServiceImpl 0 输出异常
+ * @param exceptionInfo 异常描述
+ * @return void
+ * @Author zhangyong
+ * @Date 14:26 2021-08-06
+ **/
+ private void exceptionHandling(Integer num, String exceptionInfo) {
+ if (NumConstant.ZERO < num) {
+ throw new RenException(exceptionInfo);
+ }
+ }
+
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
+ for (String id : ids) {
+ PartyOrgTypeEntity partyOrgTypeEntity = baseDao.selectById(id);
+ Integer num = partyOrgDao.isPartyOrgExistByPartyOrgType(partyOrgTypeEntity.getTypeCode());
+ this.exceptionHandling(num, "该类型不能被删除,因当前尚存在该类型的党组织。");
+ }
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
-}
\ No newline at end of file
+}
diff --git a/epdc-cloud-admin/src/main/resources/mapper/PartyOrgDao.xml b/epdc-cloud-admin/src/main/resources/mapper/PartyOrgDao.xml
new file mode 100644
index 0000000..44e5f52
--- /dev/null
+++ b/epdc-cloud-admin/src/main/resources/mapper/PartyOrgDao.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/epdc-cloud-admin/src/main/resources/mapper/PartyOrgTypeDao.xml b/epdc-cloud-admin/src/main/resources/mapper/PartyOrgTypeDao.xml
new file mode 100644
index 0000000..4b41a56
--- /dev/null
+++ b/epdc-cloud-admin/src/main/resources/mapper/PartyOrgTypeDao.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+