<?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.ylx.point.mapper.PointUserLogMapper">
    
    <resultMap type="PointUserLog" id="PointUserLogResult">
        <result property="id"    column="id"    />
        <result property="openId"    column="open_id"    />
        <result property="activityId"    column="activity_id"    />
        <result property="activityName"    column="activity_name"    />
        <result property="taskId"    column="task_id"    />
        <result property="taskName"    column="task_name"    />
        <result property="taskType"    column="task_type"    />
        <result property="points"    column="points"    />
        <result property="balanceAfter"    column="balance_after"    />
        <result property="sourceLogId"    column="source_log_id"    />
        <result property="bizOrderId"    column="biz_order_id"    />
        <result property="expireTime"    column="expire_time"    />
        <result property="isExpired"    column="is_expired"    />
        <result property="createTime"    column="create_time"    />
        <result property="opType"    column="op_type"    />
        <result property="month"    column="month"    />
    </resultMap>

    <select id="getUserPointLogList" resultType="com.ylx.point.domain.vo.UserPointLogVO">
        SELECT
            pul.activity_name AS activityName,
            pul.points AS points,
            pul.op_type AS opType,
            pul.create_time AS createTime
        FROM
            point_user_log pul
        <where>
            <if test="dto.openId != null and dto.openId != ''">
                and pul.open_id = #{dto.openId}
            </if>
            <if test="dto.opType != null and dto.opType != ''">
                AND pul.op_type = #{dto.opType}
            </if>
        </where>
        ORDER BY
            pul.create_time DESC
    </select>

</mapper>