83 lines
2.8 KiB
XML
83 lines
2.8 KiB
XML
<?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.dc.dc_project.mapper.UserMapper">
|
|
|
|
<select id="getUserListBySelf" resultType="com.dc.dc_project.model.vo.UserVo">
|
|
SELECT
|
|
u.id,
|
|
u.username,
|
|
p.name as real_name,
|
|
p.sex,
|
|
u.phone,
|
|
p.email,
|
|
o.id as org_id,
|
|
u.status,
|
|
u.last_login_time,
|
|
u.remark,
|
|
p.id AS personnel_id,
|
|
o.name AS org_name
|
|
FROM sys_user u
|
|
LEFT JOIN sys_personnel_org spo ON u.id = spo.user_id
|
|
LEFT JOIN sys_org o ON spo.org_id = o.id
|
|
LEFT JOIN sys_personnel p ON u.id = p.user_id
|
|
<where>
|
|
<if test="userReqDto.name != null">
|
|
AND (p.name LIKE CONCAT('%',#{userReqDto.name},'%') OR u.username LIKE CONCAT('%',#{userReqDto.name},'%'))
|
|
</if>
|
|
<if test="userReqDto.phone != null">
|
|
AND u.phone LIKE CONCAT('%',#{userReqDto.phone},'%')
|
|
</if>
|
|
<if test="userReqDto.email != null">
|
|
AND p.email LIKE CONCAT('%',#{userReqDto.email},'%')
|
|
</if>
|
|
<if test="userReqDto.status != null">
|
|
AND u.status = #{userReqDto.status}
|
|
</if>
|
|
<if test="pOrgId != null">
|
|
AND o.id = #{pOrgId}
|
|
</if>
|
|
and u.is_deleted = 0
|
|
</where>
|
|
</select>
|
|
<select id="getUserListByAll" resultType="com.dc.dc_project.model.vo.UserVo">
|
|
SELECT
|
|
u.id,
|
|
u.username,
|
|
p.name as real_name,
|
|
p.sex,
|
|
u.phone,
|
|
p.email,
|
|
o.id as org_id,
|
|
u.status,
|
|
u.last_login_time,
|
|
u.remark,
|
|
p.id AS personnel_id,
|
|
o.name AS org_name
|
|
FROM sys_user u
|
|
LEFT JOIN sys_personnel p ON u.id = p.user_id
|
|
LEFT JOIN sys_personnel_org spo ON p.id = spo.personnel_id
|
|
LEFT JOIN sys_org o ON spo.org_id = o.id
|
|
<where>
|
|
<if test="userReqDto.name != null">
|
|
AND (p.name LIKE CONCAT('%',#{userReqDto.name},'%') OR u.username LIKE CONCAT('%',#{userReqDto.name},'%'))
|
|
</if>
|
|
<if test="userReqDto.phone != null">
|
|
AND u.phone LIKE CONCAT('%',#{userReqDto.phone},'%')
|
|
</if>
|
|
<if test="userReqDto.email != null">
|
|
AND p.email LIKE CONCAT('%',#{userReqDto.email},'%')
|
|
</if>
|
|
<if test="userReqDto.status != null">
|
|
AND u.status = #{userReqDto.status}
|
|
</if>
|
|
<if test="orgIds != null">
|
|
AND o.id in (#{orgIds})
|
|
</if>
|
|
and u.is_deleted = 0
|
|
</where>
|
|
limit #{userReqDto.current},#{userReqDto.size}
|
|
</select>
|
|
</mapper>
|