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; + } + /** * 新增数据 *