From 4b04e7fd4fcad9af480a003509288aa6070b137e Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期日, 04 二月 2024 13:51:45 +0800
Subject: [PATCH] 修改

---
 zt/core/src/main/resources/mapper/sys/SysDeptDao.xml |   97 ++++++++++++++++++++++++++----------------------
 1 files changed, 52 insertions(+), 45 deletions(-)

diff --git a/zt/core/src/main/resources/mapper/sys/SysDeptDao.xml b/zt/core/src/main/resources/mapper/sys/SysDeptDao.xml
index 4cb0328..d83fd79 100644
--- a/zt/core/src/main/resources/mapper/sys/SysDeptDao.xml
+++ b/zt/core/src/main/resources/mapper/sys/SysDeptDao.xml
@@ -4,32 +4,33 @@
 <mapper namespace="com.zt.modules.sys.dao.SysDeptDao">
 
     <select id="getAll" resultType="com.zt.core.sys.model.SysDept">
-        select a.dept_id as id
-             ,a.dept_name as name
-             ,a.parent_id as pid
-             ,a.dept_code as code
-             ,a.ancestors as pids
-             ,a.dept_type as nature
-             ,a.order_num as sort
-             ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id=a.parent_id) parentName
-             ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id = a.parent_id) companyName
+        select a.id     as                                           id
+             , a.name   as                                           name
+             , a.pid    as                                           pid
+             , a.code   as                                           code
+             , a.pids   as                                           pids
+             , a.IS_COMPANY
+             , a.nature as                                           nature
+             , a.sort   as                                           sort
+             , (select t2.name from SYS_DEPT t2 where t2.id = a.pid) parentName
+             , (select t2.name from SYS_DEPT t2 where t2.id = a.pid) companyName
         from SYS_DEPT a
-        where a.del_flag = 0
-        order by a.dept_type, a.order_num asc
+        where a.is_delete = 0
+        order by a.nature, a.sort asc
     </select>
 
     <select id="getList" resultType="com.zt.core.sys.model.SysDept">
-        select a.dept_id as id
-        ,a.dept_name as name
-        ,a.dept_code as code
-        ,a.parent_id as pid
-        ,a.ancestors as pids
-        ,a.dept_type as nature
-        ,a.order_num as sort
-        ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id=a.parent_id) parentName
+        select a.id as id
+        ,a.name as name
+        ,a.code as code
+        ,a.pid as pid
+        ,a.pids as pids
+        ,a.nature as nature
+        ,a.sort as sort
+        ,(select t2.name from SYS_DEPT t2 where t2.id=a.pid) parentName
         from SYS_DEPT a
-        where a.del_flag=0
-<!--        <if test="isCompany != null">
+        where a.is_delete=0
+        <if test="isCompany != null">
             and a.is_company = #{isCompany}
         </if>
         <if test="companyId != null">
@@ -37,49 +38,55 @@
         </if>
         <if test="tenantId != null">
             and a.tenant_id = #{tenantId}
-        </if>-->
+        </if>
         <if test="deptIds != null">
             and a.id in
             <foreach item="id" collection="deptIds" open="(" separator="," close=")">
                 #{id}
             </foreach>
         </if>
-        order by a.order_num asc
+        order by a.sort asc
     </select>
 
     <select id="getById" resultType="com.zt.core.sys.model.SysDept">
-        select a.dept_id as id
-             ,a.dept_name as name
-             ,a.dept_code as code
-             ,a.parent_id as pid
-             ,a.ancestors as pids
-             ,a.dept_type as nature
-             ,a.order_num as sort
-             ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id=a.parent_id) parentName
+        select a.id
+             , a.name
+             , a.code
+             , a.pid
+             , a.pids
+             , a.nature
+             , a.sort
+             , (select t2.name from SYS_DEPT t2 where t2.id = a.pid) parentName
         from SYS_DEPT a
-        where a.del_flag=0
-            and a.dept_id = #{value}
+        where a.is_delete = 0
+          and a.id = #{value}
     </select>
 
     <select id="getListByParent" resultType="com.zt.core.sys.model.SysDept">
-        select a.dept_id as id
-        ,a.dept_name as name
-        ,a.dept_code as code
-        ,a.parent_id as pid
-        ,a.ancestors as pids
-        ,a.dept_type as nature
-        ,a.order_num as sort
-        ,(select t2.dept_name from SYS_DEPT t2 where t2.dept_id=a.parent_id) parentName
+        select a.id
+        ,a.name
+        ,a.code
+        ,a.pid
+        ,a.pids
+        ,a.nature
+        ,a.sort
+        ,(select t2.name from SYS_DEPT t2 where t2.id=a.pid) parentName
         from SYS_DEPT a
-        where a.del_flag=0
+        where a.is_delete=0
         <if test="pCode != null">
-            and parent_id in (select dept_id from SYS_DEPT where  dept_CODE= #{pCode})
+            and pid in (select id from SYS_DEPT where code= #{pCode})
         </if>
         <if test="code != null">
-            and  dept_CODE= #{code}
+            and code= #{code}
         </if>
         <if test="pId != null">
-            and parent_id = #{pId}
+            and pid = #{pId}
         </if>
     </select>
+    <select id="getDeptList3" resultType="com.zt.core.sys.model.SysDept">
+        select id, name
+        from sys_dept
+        where IS_COMPANY = 0
+        order by sort
+    </select>
 </mapper>

--
Gitblit v1.9.1