<?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.ruoyi.member.mapper.MemberPointsMapper">

    <resultMap type="MemberPoints" id="MemberPointsResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="fromCode"    column="from_code"    />
        <result property="type"    column="type"    />
        <result property="title"    column="title"    />
        <result property="points"    column="points"    />
        <result property="balance"    column="balance"    />
        <result property="remark"    column="remark"    />
        <result property="creator"    column="creator"    />
        <result property="createTime"    column="create_time"    />
        <result property="updater"    column="updater"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectMemberPointsVo">
        select id, user_id, from_code, type, title, points, balance, remark, creator, create_time, updater, update_time, del_flag from dl_member_points
    </sql>

    <select id="queryListPage" parameterType="MemberPoints" resultMap="MemberPointsResult">
        <include refid="selectMemberPointsVo"/>
        <where>
            del_flag = 0 and status = '01'
            <if test="userId != null"> and user_id = #{userId}</if>
        </where>
        order by create_time desc
    </select>
</mapper>