<?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.liquidnet.service.adam.mapper.AdamUserMemberMapper">
    <resultMap id="UserMemberResult" type="com.liquidnet.service.adam.entity.AdamUserMember">
        <result column="member_id" property="memberId" />
        <result column="uid" property="uid" />
        <result column="member_no" property="memberNo" />
        <result column="state" property="state" />
        <result column="expiry_at" property="expiryAt" />
        <result column="created_at" property="createdAt" />
        <result column="updated_at" property="updatedAt" />
    </resultMap>

    <!-- sql -->
    <sql id="Base_Column">
        m.member_id,
        m.uid,
        m.member_no,
        m.state,
        m.expiry_at,
        m.created_at,
        m.updated_at
    </sql>
    <select id="getMaxMemberNo" parameterType="java.lang.String" resultMap="UserMemberResult">
        SELECT
            m.member_id,
            m.uid,
            m.member_no,
            m.state,
            m.expiry_at,
            m.created_at,
            m.updated_at
        FROM adam_user_member as m
        order by m.member_no desc
            limit 0,1
    </select>

    <select id="selectByUid" resultMap="UserMemberResult">
        select * from adam_user_member where uid = #{uid}
    </select>
</mapper>
