From 0c8426df74634c0269d88b832c3e768969a4a373 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E5=95=B8=E9=9D=9E?= <8153694@qq.com>
Date: Wed, 22 May 2024 14:34:18 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9F=A5=E8=AF=A2=E5=AD=98?=
 =?UTF-8?q?=E5=9C=A8=E4=B8=9A=E5=8A=A1=E7=9A=84=E9=83=A8=E9=97=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../mortals/xhx/module/dept/dao/DeptDao.java  |  3 ++
 .../module/dept/dao/ibatis/DeptDaoImpl.java   | 24 ++++++++++----
 .../xhx/module/dept/service/DeptService.java  |  2 +-
 .../dept/service/impl/DeptServiceImpl.java    |  8 +++++
 .../xhx/module/dept/web/DeptController.java   | 31 ++++++++++++++++---
 .../sqlmap/module/dept/DeptMapperExt.xml      | 14 +++++++++
 6 files changed, 71 insertions(+), 11 deletions(-)

diff --git a/base-manager/src/main/java/com/mortals/xhx/module/dept/dao/DeptDao.java b/base-manager/src/main/java/com/mortals/xhx/module/dept/dao/DeptDao.java
index 23a4ca71..6915d90f 100644
--- a/base-manager/src/main/java/com/mortals/xhx/module/dept/dao/DeptDao.java
+++ b/base-manager/src/main/java/com/mortals/xhx/module/dept/dao/DeptDao.java
@@ -20,9 +20,12 @@ public interface  DeptDao extends ICRUDDao<DeptEntity,Long>{
 
     String GET_DEPT_LIST_BY_BUSINESS = "getDeptListByBusiness";
     String GET_BUSINESS_BY_DEPT = "getBusinessByDept";
+    String GET_DEPTLIST_BY_EXISTBUSINESS = "getDeptListByExistBusiness";
 
     List<DeptVo> getDeptListByBusiness(DeptQuery deptQuery);
 
     List<DeptVo> getBusinessByDept(DeptQuery deptQuery);
 
+    List<DeptEntity> getDeptListByExistBusiness();
+
 }
diff --git a/base-manager/src/main/java/com/mortals/xhx/module/dept/dao/ibatis/DeptDaoImpl.java b/base-manager/src/main/java/com/mortals/xhx/module/dept/dao/ibatis/DeptDaoImpl.java
index 284a31a3..b7b47ae1 100644
--- a/base-manager/src/main/java/com/mortals/xhx/module/dept/dao/ibatis/DeptDaoImpl.java
+++ b/base-manager/src/main/java/com/mortals/xhx/module/dept/dao/ibatis/DeptDaoImpl.java
@@ -9,17 +9,21 @@ import com.mortals.xhx.module.matter.model.MatterEntity;
 import org.springframework.stereotype.Repository;
 import com.mortals.xhx.module.dept.dao.DeptDao;
 import com.mortals.xhx.module.dept.model.DeptEntity;
+
 import java.util.Date;
+
 import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
+
 import java.util.List;
+
 /**
-* 閮ㄩ棬DaoImpl DAO鎺ュ彛
-*
-* @author zxfei
-* @date 2022-01-12
-*/
+ * 閮ㄩ棬DaoImpl DAO鎺ュ彛
+ *
+ * @author zxfei
+ * @date 2022-01-12
+ */
 @Repository("deptDao")
-public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements DeptDao {
+public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity, Long> implements DeptDao {
     /**
      * @param deptQuery
      * @return
@@ -41,4 +45,12 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements
         List list = this.getSqlSession().selectList(this.getSqlId(GET_BUSINESS_BY_DEPT), paramDto);
         return list;
     }
+
+    /**
+     * @return
+     */
+    @Override
+    public List<DeptEntity> getDeptListByExistBusiness() {
+        return this.getSqlSession().selectList(this.getSqlId(GET_DEPTLIST_BY_EXISTBUSINESS));
+    }
 }
diff --git a/base-manager/src/main/java/com/mortals/xhx/module/dept/service/DeptService.java b/base-manager/src/main/java/com/mortals/xhx/module/dept/service/DeptService.java
index f3baf004..1d25da83 100644
--- a/base-manager/src/main/java/com/mortals/xhx/module/dept/service/DeptService.java
+++ b/base-manager/src/main/java/com/mortals/xhx/module/dept/service/DeptService.java
@@ -49,6 +49,6 @@ public interface DeptService extends ICRUDCacheService<DeptEntity, Long> {
 
     Rest<Map<String,List<DeptVo>>> getDeptListByBusiness(DeptQuery deptQuery, Context context);
 
-
+    List<DeptEntity> getDeptListByExistBusiness();
 
 }
\ No newline at end of file
diff --git a/base-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java b/base-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
index fc9db1a0..7084dabe 100644
--- a/base-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
+++ b/base-manager/src/main/java/com/mortals/xhx/module/dept/service/impl/DeptServiceImpl.java
@@ -213,6 +213,14 @@ public class DeptServiceImpl extends AbstractCRUDCacheServiceImpl<DeptDao, DeptE
         return Rest.ok(collect);
     }
 
+    /**
+     * @return
+     */
+    @Override
+    public List<DeptEntity> getDeptListByExistBusiness() {
+        return this.dao.getDeptListByExistBusiness();
+    }
+
 
     /**
      * @param entity
diff --git a/base-manager/src/main/java/com/mortals/xhx/module/dept/web/DeptController.java b/base-manager/src/main/java/com/mortals/xhx/module/dept/web/DeptController.java
index 95a9ecf6..2a51928d 100644
--- a/base-manager/src/main/java/com/mortals/xhx/module/dept/web/DeptController.java
+++ b/base-manager/src/main/java/com/mortals/xhx/module/dept/web/DeptController.java
@@ -23,10 +23,7 @@ import com.mortals.xhx.module.site.service.SiteService;
 import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.ObjectUtils;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -145,6 +142,32 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
     }
 
 
+    /**
+     * 鏍规嵁閮ㄩ棬鏌ヨ涓氬姟
+     */
+    @GetMapping(value = "getDeptListByExistBusiness")
+    @UnAuth
+    public String getDeptListByExistBusiness() {
+        JSONObject jsonObject = new JSONObject();
+        String busiDesc = "鏍规嵁涓氬姟鏌ヨ瀛樺湪鐨勯儴闂ㄥ垪琛�" + this.getModuleDesc();
+        try {
+
+            List<DeptEntity> deptList = this.service.getDeptListByExistBusiness();
+            if (!ObjectUtils.isEmpty(getContext()) && !ObjectUtils.isEmpty(getContext().getUser())) {
+                recordSysLog(request, busiDesc + " 銆愭垚鍔熴€�");
+            }
+            jsonObject.put(KEY_RESULT_DATA,deptList);
+            jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
+            jsonObject.put(KEY_RESULT_MSG, busiDesc + "鎴愬姛锛�");
+        } catch (Exception e) {
+            log.error("鑾峰彇寮傚父", e);
+            jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
+            jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
+        }
+        return jsonObject.toJSONString();
+    }
+
+
     /**
      * 鏍规嵁閮ㄩ棬鏌ヨ涓氬姟
      */
diff --git a/base-manager/src/main/resources/sqlmap/module/dept/DeptMapperExt.xml b/base-manager/src/main/resources/sqlmap/module/dept/DeptMapperExt.xml
index fd8fca6d..2929a025 100644
--- a/base-manager/src/main/resources/sqlmap/module/dept/DeptMapperExt.xml
+++ b/base-manager/src/main/resources/sqlmap/module/dept/DeptMapperExt.xml
@@ -60,4 +60,18 @@
     </select>
 
 
+    <!-- 鑾峰彇鎵€鏈夊瓨鍦ㄤ笟鍔$殑閮ㄩ棬鍒楄〃 -->
+    <select id="getDeptListByExistBusiness" resultMap="DeptEntity-Map">
+        SELECT DISTINCT
+           <include refid="_columns"/>
+        FROM
+            mortals_sys_dept a,
+            mortals_sys_window t1,
+            mortals_sys_window_business t2
+        WHERE
+            a.id = t1.deptId
+            AND t1.id = t2.windowId;
+    </select>
+
+
 </mapper>
\ No newline at end of file
-- 
2.24.3