<?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
        where
        ur.status =1
        <if test=' companyIds != null and companyIds.size > 0' >
            and ur.company_id in
            <foreach collection="companyIds" open="(" close=")" item="companyId" separator=",">
                #{companyId}
            </foreach>
        </if>
        <if test=' websitIds != null and websitIds.size > 0' >
            and ur.websit_id in
            <foreach collection="websitIds" open="(" close=")" item="companyId" separator=",">
                #{websitId}
            </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>

        order by ur.create_time
    </select>



</mapper>