btxtgxq-system-bigdata/src/main/resources/mybatis/db2-mapper/kpi/user-mapper.xml

62 lines
1.9 KiB
XML
Raw Normal View History

<?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.cm.bigdata.dao2.kpi.IUserDao">
<resultMap id="userPO" type="com.cm.bigdata.pojo.pos.kpi.UserPO">
<id column="user_id" property="userId"/>
<result column="user_username" property="userUsername"/>
<result column="user_name" property="userName"/>
</resultMap>
<select id="listPO" parameterType="map" resultMap="userPO">
SELECT
user_id,
user_username,
user_name
FROM
sys_user su
WHERE
is_delete = 0
<if test="keywords != null and keywords != ''">
AND (
user_name LIKE CONCAT('%', #{keywords}, '%')
OR
user_username LIKE CONCAT('%', #{keywords}, '%')
)
</if>
2023-05-10 18:15:25 +08:00
<if test="userIds != null and userIds.size > 0">
AND
user_id IN
<foreach collection="userIds" index="index" open="(" separator="," close=")">
#{userIds[${index}]}
</foreach>
</if>
2023-04-05 17:40:55 +08:00
<if test="departmentId != null and departmentId != ''">
AND
EXISTS (
SELECT
1
FROM
sys_department_user sdu
WHERE
su.user_id = sdu.user_id
AND
sdu.department_id = #{departmentId}
)
</if>
<if test="roleId != null and roleId != ''">
AND
EXISTS (
SELECT
1
FROM
sys_role_user sru
WHERE
su.user_id = sru.user_id
AND
sru.role_id = #{roleId}
)
</if>
</select>
</mapper>