jinlin
2024-01-12 bb3bc1c8508dc28d1780c2b0e068595baedb5100
zt/core/src/main/resources/mapper/sys/SysDeptDao.xml
@@ -4,16 +4,16 @@
<mapper namespace="com.zt.modules.sys.dao.SysDeptDao">
    <select id="getAll" resultType="com.zt.core.sys.model.SysDept">
        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
        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.is_delete = 0
        order by a.nature, a.sort asc
@@ -50,16 +50,16 @@
    <select id="getById" resultType="com.zt.core.sys.model.SysDept">
        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
             , 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.is_delete=0
            and a.id = #{value}
        where a.is_delete = 0
          and a.id = #{value}
    </select>
    <select id="getListByParent" resultType="com.zt.core.sys.model.SysDept">
@@ -74,13 +74,19 @@
        from SYS_DEPT a
        where a.is_delete=0
        <if test="pCode != null">
            and pid in (select id from SYS_DEPT where  code= #{pCode})
            and pid in (select id from SYS_DEPT where code= #{pCode})
        </if>
        <if test="code != null">
            and  code= #{code}
            and code= #{code}
        </if>
        <if test="pId != null">
            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>