| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?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="com.management.platform.mapper.UserMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.management.platform.entity.User">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="phone" property="phone"/>
- <result column="password" property="password"/>
- <result column="portrait_url" property="portraitUrl"/>
- <result column="create_time" property="createTime"/>
- <result column="role" property="role"/>
- <result column="company_id" property="companyId"/>
- <result column="department_id" property="departmentId"/>
- <result column="department_cascade" property="departmentCascade"/>
- <result column="cost" property="cost"/>
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, name, phone, password, portrait_url, create_time, role, company_id, department_id, department_cascade, cost
- </sql>
- <!--单独分页获取人员-->
- <select id="getUserByDepartment" resultType="java.util.Map">
- SELECT a.id, a.name, a.phone, a.portrait_url AS portraitUrl, a.role, a.company_id AS companyId, a.cost,
- a.department_id AS departmentId, b.department_name AS departmentName, a.department_cascade AS departmentCascade
- FROM user AS a
- LEFT JOIN department AS b ON a.department_id = b.department_id
- WHERE a.company_id = #{companyId}
- <if test="departmentId != null and companyId != ''">
- AND a.department_id = #{departmentId}
- </if>
- </select>
- <!--单独分页获取人员数量-->
- <select id="countUserByDepartment" resultType="java.lang.Integer">
- SELECT COUNT(a.id) AS count
- FROM user AS a
- WHERE a.company_id = #{companyId}
- <if test="departmentId != null and companyId != ''">
- AND a.department_id = #{departmentId}
- </if>
- </select>
- <!--范围分页获取人员-->
- <select id="getUserByDepartmentList" resultType="java.util.Map">
- SELECT a.id, a.name, a.phone, a.portrait_url AS portraitUrl, a.role, a.company_id AS companyId, a.cost,
- a.department_id AS departmentId, b.department_name AS departmentName, a.department_cascade AS departmentCascade
- FROM user AS a
- LEFT JOIN department AS b ON a.department_id = b.department_id
- WHERE a.company_id = #{companyId} AND a.department_id IN
- <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
- #{departmentId}
- </foreach>
- </select>
- <!--范围分页获取人员数量-->
- <select id="countUserByDepartmentList" resultType="java.lang.Integer">
- SELECT COUNT(a.id) AS count
- FROM user AS a
- WHERE a.company_id = #{companyId} AND a.department_id IN
- <foreach collection="departmentIds" item="departmentId" index="index" open="(" close=")" separator=",">
- #{departmentId}
- </foreach>
- </select>
- </mapper>
|