<?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.cyl.manager.ums.mapper.MemberWechatMapper">
    
    <resultMap type="MemberWechat" id="MemberWechatResult">
        <result property="id" column="id"/>
        <result property="memberId" column="member_id"/>
        <result property="unionid" column="unionid"/>
        <result property="wechatId" column="wechat_id"/>
        <result property="openid" column="openid"/>
        <result property="routineOpenid" column="routine_openid"/>
        <result property="groupid" column="groupid"/>
        <result property="tagidList" column="tagid_list"/>
        <result property="subscribe" column="subscribe"/>
        <result property="subscribeTime" column="subscribe_time"/>
        <result property="sessionKey" column="session_key"/>
        <result property="accessToken" column="access_token"/>
        <result property="expiresIn" column="expires_in"/>
        <result property="refreshToken" column="refresh_token"/>
        <result property="expireTime" column="expire_time"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
    </resultMap>

    <sql id="selectMemberWechatVo">
        select id, member_id, unionid, openid, routine_openid, groupid, tagid_list, subscribe, subscribe_time, session_key, access_token, expires_in, refresh_token, expire_time, create_by, create_time, update_by, update_time   from ums_member_wechat
    </sql>

    <select id="selectByEntity" parameterType="MemberWechat" resultMap="MemberWechatResult">
        <include refid="selectMemberWechatVo"/>
        <where>  
            <if test="memberId != null "> and member_id = #{memberId}</if>
            <if test="unionid != null  and unionid != ''"> and unionid = #{unionid}</if>
            <if test="openid != null  and openid != ''"> and openid = #{openid}</if>
            <if test="routineOpenid != null  and routineOpenid != ''"> and routine_openid = #{routineOpenid}</if>
            <if test="groupid != null "> and groupid = #{groupid}</if>
            <if test="tagidList != null  and tagidList != ''"> and tagid_list = #{tagidList}</if>
            <if test="subscribe != null "> and subscribe = #{subscribe}</if>
            <if test="subscribeTime != null "> and subscribe_time = #{subscribeTime}</if>
            <if test="sessionKey != null  and sessionKey != ''"> and session_key = #{sessionKey}</if>
            <if test="accessToken != null  and accessToken != ''"> and access_token = #{accessToken}</if>
            <if test="expiresIn != null "> and expires_in = #{expiresIn}</if>
            <if test="refreshToken != null  and refreshToken != ''"> and refresh_token = #{refreshToken}</if>
            <if test="expireTime != null "> and expire_time = #{expireTime}</if>
        </where>
    </select>
</mapper>
