|
@@ -4,16 +4,16 @@
|
|
|
|
|
|
<!-- 通用查询映射结果 -->
|
|
|
<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="cost" property="cost" />
|
|
|
- <result column="department_id" property="departmentId" />
|
|
|
+ <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="cost" property="cost"/>
|
|
|
+ <result column="department_id" property="departmentId"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<!-- 通用查询结果列 -->
|
|
@@ -21,4 +21,47 @@
|
|
|
id, name, phone, password, portrait_url, create_time, role, company_id, cost, department_id
|
|
|
</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
|
|
|
+ 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
|
|
|
+ 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>
|