<?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.lantone.security.mapper.DeptUserMapper">

    <select id="getDeptUser" resultType="com.lantone.security.entity.HospitalUser">
        SELECT DISTINCT
            du.user_id userId,
            d.hospital_id hospitalId
        FROM
            `sys_dept_user` du,
            sys_dept d
        WHERE
          du.is_deleted = 'N'
        AND d.is_deleted = 'N'
        AND	d.id = du.dept_id
        <if test="depts !=null and depts.size!=0">
            AND du.dept_id IN
            <foreach collection="depts" item="id" open="(" close=")" separator=",">
                #{id}
            </foreach>
        </if>
    </select>
</mapper>