From 7ea65678639b5ab4b753d3721dcd47df0b9bd840 Mon Sep 17 00:00:00 2001 From: zhaotianfeng <12345678> Date: Wed, 18 Sep 2024 16:48:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AD=E5=8F=B0-=E5=B0=8F=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=A1=B5=E9=9D=A2-=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=20=E5=8A=A0=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E6=9C=BA=E6=9E=84=E6=98=AF=E5=90=A6=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/sys/controller/SysAppController.java | 14 ++++++++++++++ .../fuint/business/sys/mapper/xml/SysAppMapper.xml | 3 +++ .../fuint/business/sys/service/SysAppService.java | 2 ++ .../sys/service/impl/SysAppServiceImpl.java | 6 ++++++ 4 files changed, 25 insertions(+) diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/controller/SysAppController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/controller/SysAppController.java index dfee6c5bc..7ed0ab92c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/controller/SysAppController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/controller/SysAppController.java @@ -70,6 +70,13 @@ public class SysAppController extends BaseController { @PostMapping public ResponseObject add(@RequestBody SysApp sysApp) { try { +// 先判断机构名称是否重复 + SysApp s1 = new SysApp(); + s1.setOrgId(sysApp.getOrgId()); + Long aLong = sysAppService.queryCount(s1); + if (aLong>0){ + return getFailureResult(500,"机构名称已经存在"); + } SysLog sysLog =new SysLog(); sysLog.setSystemName("2"); sysLog.setMoudle("小程序配置"); @@ -88,6 +95,13 @@ public class SysAppController extends BaseController { @PutMapping public ResponseObject edit(@RequestBody SysApp sysApp) { try { + // 先判断机构名称是否重复 + SysApp s1= new SysApp(); + s1.setOrgId(sysApp.getOrgId()); + Long aLong = sysAppService.queryCount(s1); + if (aLong>0){ + return getFailureResult(500,"机构名称已经存在"); + } SysLog sysLog =new SysLog(); sysLog.setSystemName("2"); sysLog.setMoudle("小程序配置"); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/mapper/xml/SysAppMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/mapper/xml/SysAppMapper.xml index 22fefa5a4..60eae83e0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/mapper/xml/SysAppMapper.xml +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/mapper/xml/SysAppMapper.xml @@ -67,6 +67,9 @@ legal_representative_id,legal_representative_contact,app_status,create_time,crea select count(1) from sys_app + + and org_id = #{orgId} + and id = #{id} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/SysAppService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/SysAppService.java index 8b71666dd..ff9e20e1f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/SysAppService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/SysAppService.java @@ -30,7 +30,9 @@ public interface SysAppService { * @return 查询结果 */ IPage queryByPage(@Param("page") Page page, SysApp sysApp); +// 根据机构名称查询 + Long queryCount(SysApp sysApp); /** * 新增数据 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/impl/SysAppServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/impl/SysAppServiceImpl.java index 340c61b98..d282b5fb0 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/impl/SysAppServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/sys/service/impl/SysAppServiceImpl.java @@ -50,6 +50,12 @@ public class SysAppServiceImpl implements SysAppService { return this.sysAppMapper.queryAllByLimit(page, sysApp); } + @Override + public Long queryCount(SysApp sysApp) { + long count = sysAppMapper.count(sysApp); + return count; + } + /** * 新增数据 *