<?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.qs.mp.admin.mapper.PrizeRecoveryMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.qs.mp.admin.domain.PrizeRecovery">
        <id column="id" property="id" />
        <result column="storage_id" property="storageId" />
        <result column="user_id" property="userId" />
        <result column="title" property="title" />
        <result column="pic_url" property="picUrl" />
        <result column="num" property="num" />
        <result column="goods_id" property="goodsId" />
        <result column="sku_id" property="skuId" />
        <result column="discount_rate" property="discountRate" />
        <result column="return_coin" property="returnCoin" />
        <result column="is_deleted" property="isDeleted" />
        <result column="created_time" property="createdTime" />
        <result column="updated_time" property="updatedTime" />
        <result column="properties" property="properties"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, storage_id, user_id, title, pic_url, num, ref_id, prize_type, discount_rate, return_coin, is_deleted, created_time, updated_time
    </sql>

    <select id="listByWrapper" resultType="com.qs.mp.admin.domain.vo.PrizeRecoveryListVO">
        select t1.*,
                t2.nick_name,
                t2.phonenumber userPhone
        from mp_prize_recovery t1
        left join sys_user t2 on t1.user_id = t2.user_id
        ${ew.customSqlSegment}
    </select>

    <select id="countByWrapper" resultType="int">
        select count(*)
        from mp_prize_recovery t1
        left join sys_user t2 on t1.user_id = t2.user_id
        ${ew.customSqlSegment}
    </select>
</mapper>