ZhangWenQiang 6 лет назад
Родитель
Сommit
8af5239fdf

+ 2 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgplatform/mapper/HlgPlatformMapper.java

@@ -20,4 +20,6 @@ public interface HlgPlatformMapper extends BaseMapper<HlgPlatform> {
     List<HlgPlatform> findList(Page<HlgPlatform> pageList, @Param("hlgPlatform") HlgPlatform hlgPlatform, @Param(Constants.WRAPPER) QueryWrapper<HlgPlatform> queryWrapper);
 
     HlgPlatform getByCode(String orgCode);
+
+    int getCountUserByPlatformId(@Param("id") String id);
 }

+ 6 - 0
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgplatform/mapper/xml/HlgPlatformMapper.xml

@@ -125,4 +125,10 @@
 		WHERE a.sys_org_code = #{orgCode}
 	</select>
 
+	<select id="getCountUserByPlatformId" resultType="int">
+		select count(a.id)
+		from hlg_user a
+		where a.platform_id = #{id}
+	</select>
+
 </mapper>

+ 3 - 3
happy-boot-module-powerjob/src/main/java/org/jeecg/modules/hlgplatform/service/impl/HlgPlatformServiceImpl.java

@@ -140,12 +140,12 @@ public class HlgPlatformServiceImpl extends ServiceImpl<HlgPlatformMapper, HlgPl
     public Result<HlgPlatform> deletePlatform(String id) {
         Result<HlgPlatform> result = new Result<HlgPlatform>();
         //企业数据
-        int count = hlgCompanyService.getCountByPlatformId(id);
+        int countCom = hlgCompanyService.getCountByPlatformId(id);
         //用户数据
-
+        int countUser = baseMapper.getCountUserByPlatformId(id);
         //服务商数据
         int countSub = hlgPlatformSubcontractorService.getCountByPlatformId(id);
-        if (count > 0 || countSub > 0) {
+        if (countCom > 0 || countUser > 0 || countSub > 0) {
             result.error500("该平台已存在业务数据,无法删除");
             return result;
         }