Эх сурвалжийг харах

refactor(sys): 优化部门数据处理逻辑并修复查询条件

- 注释掉定时任务注解以禁用自动执行-修正 findByOrgCodeAndParentId 方法的删除标记查询条件
- 调整 findMerchantPage 查询语句,移除冗余的用户删除标记过滤
- 根据机构类别设置系统类型字段,增强业务逻辑准确性
- 更新部门更新方法中的父级ID和系统类型处理逻辑- 使用 switch 表达式简化机构类别的判断流程
SheepHy 1 долоо хоног өмнө
parent
commit
2b5dcc89ee

+ 2 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/quartz/job/OrTeachingJobService.java

@@ -241,7 +241,8 @@ public class OrTeachingJobService {
      * @Param
      * @return
      **/
-    @Scheduled(fixedDelay = 600000)
+    //todo
+//    @Scheduled(fixedDelay = 600000)
 //    @Scheduled(cron = "0 0 23 * * ?")
     public void synchronousDoorOpeningAndClosingRecords(){
         try {

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/mapper/SysDepartMapper.java

@@ -213,7 +213,7 @@ public interface SysDepartMapper extends BaseMapper<SysDepart> {
 	@Select("select * from sys_depart where del_flag=0 and org_category ='10' and depart_name =#{merchantName}")
 	SysDepart findByDepartName(@Param("merchantName") String merchantName);
 
-	@Select("SELECT p.*  FROM sys_depart c  JOIN sys_depart p  ON c.parent_id = p.id WHERE c.org_code = #{orgCode} and del_flag=0")
+	@Select("SELECT p.*  FROM sys_depart c  JOIN sys_depart p  ON c.parent_id = p.id WHERE c.org_code = #{orgCode} and p.del_flag=0")
     SysDepart findByOrgCodeAndParentId(@Param("orgCode") String orgCode);
 
 }

+ 1 - 1
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/SysDepartMapper.xml

@@ -221,7 +221,7 @@
     <select id="findMerchantPage"  resultType="org.jeecg.modules.system.app.dto.merchant.FindMerchantResponseDTO">
         select sd.id, sd.depart_name as merchantName, su.realname,su.phone,sd.create_time from  sys_depart  sd
         left join  sys_user su on sd.id = su.depart_ids
-        where sd.del_flag=0 and sd.org_category =10 and su.del_flag=0
+        where sd.del_flag=0
         <if test="orgCode!=null and orgCode!=''">
             and sd.org_code like CONCAT('',#{orgCode},'%')
         </if>

+ 13 - 2
national-motion-module-system/national-motion-system-biz/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java

@@ -214,9 +214,12 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
             // 先判断该对象有无父级ID,有则意味着不是最高级,否则意味着是最高级
             // 获取父级ID
             String parentId = sysDepart.getParentId();
-            if(!departMapper.selectList(Wrappers.<SysDepart>lambdaQuery()
-                    .eq(SysDepart::getParentId, sysDepart.getParentId())).isEmpty()){
+            if(sysDepart.getOrgCategory().equals("10")){
                 sysDepart.setSystemType(1);
+            }else if(sysDepart.getOrgCategory().equals("20")){
+                sysDepart.setSystemType(2);
+            }else if(sysDepart.getOrgCategory().equals("30")){
+                sysDepart.setSystemType(2);
             }
             //update-begin--Author:baihailong  Date:20191209 for:部门编码规则生成器做成公用配置
             JSONObject formData = new JSONObject();
@@ -484,6 +487,14 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
     @Transactional(rollbackFor = Exception.class)
     public Boolean updateDepartDataById(SysDepart sysDepart, String username) {
         if (sysDepart != null && username != null) {
+            if (oConvertUtils.isEmpty(sysDepart.getParentId())) {
+                sysDepart.setParentId("");
+                sysDepart.setSystemType(0);
+            }
+            switch (sysDepart.getOrgCategory()) {
+                case "10" -> sysDepart.setSystemType(1);
+                case "20", "30" -> sysDepart.setSystemType(2);
+            }
             sysDepart.setUpdateTime(new Date());
             sysDepart.setUpdateBy(username);
             this.updateById(sysDepart);