<?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.gree.mall.manager.commonmapper.CustomMemberMapper">
    <select id="queryUser" resultType="com.gree.mall.manager.bean.member.MemberBean">
        select ur.*
        from user ur
        left join enterprise_wechat_worker eww on eww.wechat_user_id = ur.work_user_id
        left join admin_websit aw on aw.id = eww.main_department
        where
        ur.status =1
        <if test=' companyWechatIds != null and companyWechatIds.size > 0' >
            and ur.company_wechat_id in
            <foreach collection="companyWechatIds" open="(" close=")" item="companyWechatId" separator=",">
                #{companyWechatId}
            </foreach>
        </if>
        <if test="type != null and type !=''">
            and ur.type = #{type}
        </if>
        <if test="startTime != null and endTime != null">
            and ur.create_time between #{startTime} and #{endTime}
        </if>
        <if test="keyword != null and keyword !=''">
            and (ur.nick_name like concat('%',#{keyword,jdbcType=VARCHAR},'%') or ur.mobile like
            concat('%',#{keyword,jdbcType=VARCHAR},'%'))
        </if>
         <if test="null != websitNos and websitNos.size > 0">
             and aw.websit_number in
             <foreach item="item" index="index" collection="websitNos" open="(" separator=","
                      close=")">
                 #{item}
             </foreach>
        </if>
        order by ur.create_time
    </select>



</mapper>