mobilebroken/nflg-mobilebroken-repository/src/main/resources/mapper/GongfuExternalUserMapper.xml

30 lines
1.3 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.nflg.mobilebroken.repository.mapper.GongfuExternalUserMapper">
<select id="search" resultType="com.nflg.mobilebroken.common.pojo.vo.GongfuExternalUserVO">
SELECT geu.*,bd.dept_name AS department_name,bp.position_name AS title_name
FROM gongfu_external_user geu
LEFT JOIN t_base_department bd ON geu.department_id=bd.id
LEFT JOIN t_base_position bp ON geu.title_id=bp.id
<where>
<if test="request.userName!=null and request.userName!=''">
and geu.user_name like concat('%',#{request.userName} ,'%')
</if>
<if test="request.departmentId!=null">
and geu.department_id = #{request.departmentId}
</if>
<if test="request.state!=null">
and geu.state = #{request.state}
</if>
<if test="request.departmentIds!=null">
and geu.department_id in
<foreach item="item" index="index" collection="request.departmentIds" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
order by geu.id desc
</select>
</mapper>