<?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.cf.imes.module.system.dal.mysql.user.AdminUserMapper">

    <select id="selectListByTerms" resultType="com.cf.imes.module.system.dal.dataobject.user.AdminUserDO"
            parameterType="map">
        SELECT id,
               username,
               password,
               nickname,
               remark,
               dept_id,
               post_ids,
               email,
               mobile,
               sex,
               avatar,
               status,
               login_ip,
               login_date,
               pinyin_initial,
               pinyin_full,
               organ_id,
               create_time,
               update_time,
               creator,
               updater,
               deleted
        FROM system_users
        WHERE deleted = 0
          AND organ_id = #{organId}
          AND status = #{status}
          AND (
                    nickname LIKE CONCAT('%', #{name}, '%')
                OR pinyin_full LIKE CONCAT('%', #{namePyAll}, '%')
                OR pinyin_initial LIKE CONCAT('%', #{namePyFirstChar}, '%')
            )
        ORDER BY
            id DESC
    </select>


    <select id="selectUserDataSource" resultType="java.util.Map">

        select ${filed}
        from system_users
        where organ_id =  #{organId}
          and deleted = false
          and nickname in
        <foreach collection="nameList" item="nameList" open="(" close=")" separator=",">
            #{nameList}
        </foreach>


    </select>
</mapper>