| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="platform.modules.sys.dao.DepartmentDao">
- <!--返回树列表-->
- <select id="findTreeList" resultType="platform.modules.sys.vo.TreeNode">
- SELECT id,parent_id,name FROM sys_department p where user_type =#{user_type}
- <if test="build_id!=null and build_id!=''">
- and build_id=#{build_id}
- </if>
- <if test="street_id!=null and street_id!=''">
- and street_id=#{street_id}
- </if>
- <if test="company_id!=null and company_id!=''">
- and company_id=#{company_id}
- </if>
- order by p.create_time asc
- </select>
- <select id="findByDepartmentName" resultType="platform.modules.sys.entity.Department">
- select * from sys_department where name=#{name}
- <if test="id!=null and id!=''">
- and id!=#{id}
- </if>
- <if test="condition.user_type !=null and condition.user_type !=''">
- and user_type = #{condition.user_type}
- </if>
- <if test="condition.build_id!=null and condition.build_id!=''">
- and build_id=#{condition.build_id}
- </if>
- <if test="condition.street_id!=null and condition.street_id!=''">
- and street_id=#{condition.street_id}
- </if>
- <if test="condition.company_id!=null and condition.company_id!=''">
- and company_id=#{condition.company_id}
- </if>
-
- </select>
- <select id="findByDepartmentId" resultType="platform.modules.sys.entity.Department">
- select * from sys_department where parent_id=#{department_id} and del_flag=0
- </select>
-
- <select id="findDepartmentIdByName" resultType="int">
- SELECT id from sys_department where name in
- <foreach collection="departments" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="findDepartmentByGoupId" resultType="platform.modules.sys.entity.Department">
- SELECT * FROM sys_department where id IN
- (SELECT department_id from sys_department_group where group_id=#{id})
- </select>
- <select id="findDepartmentByGroupNamePageInfo" resultType="platform.modules.sys.entity.Department">
- SELECT * FROM sys_department where id IN
- (SELECT department_id from sys_department_group where group_id =
- (SELECT id from sys_de_group where name = #{groupName})
- )
- <if test="keyWords != null and keyWords != ''" >
- and name LIKE CONCAT ('%',#{keyWords},'%')
- </if>
- <if test="null != departmenstIds and departmenstIds.size >0">
- AND id not IN
- <foreach collection="departmenstIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="departmentList" resultType="platform.modules.sys.entity.Department">
- SELECT * FROM sys_department dep WHERE dep.del_flag = 0
- </select>
-
- <select id="selectMaxId" resultType="Integer">
- select MAX(id) FROM sys_department dept WHERE dept.del_flag = 0
- </select>
-
- <select id="getAllUserDepts" resultType="platform.modules.sys.entity.Department">
- SELECT
- distinct dep.id,
- dep.name
- FROM
- sys_department dep
- LEFT JOIN z_user u on u.department_id = dep.id
- WHERE
- dep.del_flag = 0
- and u.id in
- <foreach collection="userIdArr" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="findDepartmentList" resultType="platform.modules.api.dto.DepartmentDto">
- select id, `name` AS departmentName, parent_id AS partentId from sys_department WHERE del_flag = FALSE
- </select>
- </mapper>
|