<?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="bus.mapper.WChatUserMapper">

 <select id="list" parameterType="bus.model.dto.page.WChatUserPageDto" resultType="bus.model.dto.WChatUserDto">
   select
       id,
       wx_name,
       wx_phone,
       mini_open_id,
       register_time,
       last_login_time
   from
   w_chat_user
   <where>
     is_delete = 0
     <if test="wxName != null and wxName != ''">
       and wx_name like concat('%',#{wxName},'%')
     </if>
     <if test="wxPhone != null and wxPhone != ''">
       and wx_phone like concat('%',#{wxPhone})
     </if>
     <if test="registerBeginTime != null">
       and register_time >= #{registerBeginTime}
     </if>
     <if test="registerEndTime != null">
       and register_time &lt;= #{registerEndTime}
     </if>
     <if test="lastLoginBeginTime != null">
       and last_login_time >= #{lastLoginBeginTime}
     </if>
     <if test="lastLoginEndTime != null">
       and last_login_time &lt;= #{lastLoginEndTime}
     </if>
     <if test="id != null and id != ''">
       and id = #{id}
     </if>
   </where>
     order by create_time desc
 </select>

</mapper>
