<?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.miaxis.wx.mapper.WxForeverCodeMapper">

    <resultMap type="WxForeverCode" id="WxForeverCodeResult">
        <result property="id"    column="id"    />
        <result property="openid"    column="openid"    />
        <result property="code"    column="code"    />
        <result property="nickName"    column="nick_name"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="status"    column="status"    />
    </resultMap>

    <sql id="selectWxForeverCodeVo">
        select * from wx_forever_code
    </sql>

    <select id="selectWxForeverCodeList" parameterType="WxForeverCode" resultMap="WxForeverCodeResult">
        <include refid="selectWxForeverCodeVo"/>
        <where>
            <if test="openid != null  and openid != ''"> and openid = #{openid}</if>
            <if test="code != null  and code != ''"> and code = #{code}</if>
            <if test="nickName != null "> and nick_name like concat('%', #{nickName}, '%')</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
        order by create_time desc
    </select>

</mapper>
