<?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.mall.member.mapper.GrowthChangeHistoryMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.member.domain.entity.GrowthChangeHistory">
            <id column="id" property="id"/>
            <id column="member_id" property="memberId"/>
            <id column="create_time" property="createTime"/>
            <id column="change_count" property="changeCount"/>
            <id column="note" property="note"/>
            <id column="source_type" property="sourceType"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,member_id,create_time,change_count,note,source_type
    </sql>

    <!-- 分页查询成长值变化历史记录内容 -->
    <select id="selectListByPage" resultType="com.mall.member.domain.vo.GrowthChangeHistoryVo">
        select
        <include refid="Base_Column_List"/>
        from ums_growth_change_history
        <where>
                <if test="dto.id != null and dto.id != ''">
                    and id like CONCAT('%',#{dto.id},'%')
                </if>
                <if test="dto.memberId != null and dto.memberId != ''">
                    and member_id like CONCAT('%',#{dto.memberId},'%')
                </if>
                <if test="dto.createTime != null and dto.createTime != ''">
                    and create_time like CONCAT('%',#{dto.createTime},'%')
                </if>
                <if test="dto.changeCount != null and dto.changeCount != ''">
                    and change_count like CONCAT('%',#{dto.changeCount},'%')
                </if>
                <if test="dto.note != null and dto.note != ''">
                    and note like CONCAT('%',#{dto.note},'%')
                </if>
                <if test="dto.sourceType != null and dto.sourceType != ''">
                    and source_type like CONCAT('%',#{dto.sourceType},'%')
                </if>
        </where>
    </select>

</mapper>
