<?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.matrix.system.shopXcx.dao.ShopRefundRecordDao"> 
 | 
    <!-- 定义ShopRefundRecord 的复杂关联map --> 
 | 
    <resultMap type="com.matrix.system.shopXcx.bean.ShopRefundRecord" id="ShopRefundRecordMap"> 
 | 
        <id property="id" column="id" /> 
 | 
        <result property="createBy" column="create_by" /> 
 | 
        <result property="createTime" column="create_time" /> 
 | 
        <result property="updateBy" column="update_by" /> 
 | 
        <result property="updateTime" column="update_time" /> 
 | 
            <result property="refundNo" column="refund_no" /> 
 | 
            <result property="orderId" column="order_id" /> 
 | 
            <result property="userId" column="user_id" /> 
 | 
            <result property="refundCause" column="refund_cause" /> 
 | 
            <result property="refundMoney" column="refund_money" /> 
 | 
            <result property="handler" column="handler" /> 
 | 
            <result property="handingTime" column="handing_time" /> 
 | 
            <result property="refundTransactionNo" column="refund_transaction_no" /> 
 | 
            <result property="remarks" column="remarks" /> 
 | 
            <result property="refundWaybillNo" column="refund_waybill_no" /> 
 | 
            <result property="logisticsCompany" column="logistics_company" /> 
 | 
            <result property="applyTime" column="apply_time" /> 
 | 
            <result property="refundTime" column="refund_time" /> 
 | 
            <result property="refundType" column="refund_type" /> 
 | 
            <result property="auditStatus" column="audit_status" /> 
 | 
            <result property="refundStatus" column="refund_status" /> 
 | 
            <result property="refundGoodsStatus" column="refund_goods_status" /> 
 | 
            <result property="refundRefuseReason" column="refund_refuse_reason" /> 
 | 
            <result property="orderNo" column="order_no" /> 
 | 
            <result property="nickName" column="nick_name" /> 
 | 
            <result property="discountAmount" column="discount_amount" /> 
 | 
        <result property="companyId" column="company_id" /> 
 | 
    </resultMap> 
 | 
  
 | 
    <!-- 定义ShopRefundRecord 的复杂关联map --> 
 | 
    <resultMap type="com.matrix.system.shopXcx.bean.ShopRefundRecordDetails" id="ShopRefundRecordDetailsMap"> 
 | 
        <id property="id" column="id" /> 
 | 
        <result property="refundNo" column="refund_no" /> 
 | 
        <result property="refundCause" column="refund_cause" /> 
 | 
        <result property="refundMoney" column="refund_money" /> 
 | 
        <result property="orderNo" column="order_no" /> 
 | 
        <result property="orderMoney" column="order_money" /> 
 | 
        <result property="title" column="title" /> 
 | 
        <result property="price" column="price" /> 
 | 
        <result property="count" column="count" /> 
 | 
        <result property="totalPrice" column="total_price" /> 
 | 
        <result property="skuName" column="s_title" /> 
 | 
        <result property="discountAmount" column="discount_amount" /> 
 | 
        <result property="postage" column="postage" /> 
 | 
    </resultMap> 
 | 
     
 | 
     
 | 
    <!-- 定义ShopRefundRecord 的简单map  ,本map不添加其他的关联属性 --> 
 | 
    <resultMap type="com.matrix.system.shopXcx.bean.ShopRefundRecord" id="ShopRefundRecordComplexMap"> 
 | 
        <id property="id" column="id" /> 
 | 
        <result property="createBy" column="create_by" /> 
 | 
        <result property="createTime" column="create_time" /> 
 | 
        <result property="updateBy" column="update_by" /> 
 | 
        <result property="updateTime" column="update_time" /> 
 | 
            <result property="refundNo" column="refund_no" /> 
 | 
            <result property="orderId" column="order_id" /> 
 | 
            <result property="userId" column="user_id" /> 
 | 
            <result property="refundCause" column="refund_cause" /> 
 | 
            <result property="refundMoney" column="refund_money" /> 
 | 
            <result property="handler" column="handler" /> 
 | 
            <result property="handingTime" column="handing_time" /> 
 | 
            <result property="refundTransactionNo" column="refund_transaction_no" /> 
 | 
            <result property="remarks" column="remarks" /> 
 | 
            <result property="refundWaybillNo" column="refund_waybill_no" /> 
 | 
            <result property="logisticsCompany" column="logistics_company" /> 
 | 
            <result property="applyTime" column="apply_time" /> 
 | 
            <result property="refundTime" column="refund_time" /> 
 | 
            <result property="refundType" column="refund_type" /> 
 | 
            <result property="auditStatus" column="audit_status" /> 
 | 
            <result property="refundStatus" column="refund_status" /> 
 | 
            <result property="refundGoodsStatus" column="refund_goods_status" /> 
 | 
            <result property="refundRefuseReason" column="refund_refuse_reason" /> 
 | 
        <result property="companyId" column="company_id" /> 
 | 
            <!--返回详情列表--> 
 | 
            <collection property="shopOrder" column="{orderId=order_id}" 
 | 
                        select="com.matrix.system.shopXcx.dao.ShopOrderDao.selectMyOrderById"/> 
 | 
    </resultMap> 
 | 
     
 | 
    <!-- 字段sql --> 
 | 
    <sql id="columns"> 
 | 
        create_by, 
 | 
        create_time, 
 | 
        update_by, 
 | 
        update_time, 
 | 
            id, 
 | 
            refund_no, 
 | 
            order_id, 
 | 
            user_id, 
 | 
            refund_cause, 
 | 
            refund_money, 
 | 
            handler, 
 | 
            handing_time, 
 | 
            refund_transaction_no, 
 | 
            remarks, 
 | 
            refund_waybill_no, 
 | 
            logistics_company, 
 | 
            apply_time, 
 | 
            refund_time, 
 | 
            refund_type, 
 | 
            audit_status, 
 | 
            refund_status, 
 | 
            refund_goods_status, 
 | 
            refund_refuse_reason, 
 | 
            company_id 
 | 
    </sql> 
 | 
     
 | 
    <!-- 属性sql --> 
 | 
    <sql id="propertys"> 
 | 
        #{item.createBy}, 
 | 
        now(), 
 | 
        #{item.updateBy}, 
 | 
        now(), 
 | 
            #{item.id}, 
 | 
            #{item.refundNo}, 
 | 
            #{item.orderId}, 
 | 
            #{item.userId}, 
 | 
            #{item.refundCause}, 
 | 
            #{item.refundMoney}, 
 | 
            #{item.handler}, 
 | 
            #{item.handingTime}, 
 | 
            #{item.refundTransactionNo}, 
 | 
            #{item.remarks}, 
 | 
            #{item.refundWaybillNo}, 
 | 
            #{item.logisticsCompany}, 
 | 
            #{item.applyTime}, 
 | 
            #{item.refundTime}, 
 | 
            #{item.refundType}, 
 | 
            #{item.auditStatus}, 
 | 
            #{item.refundStatus}, 
 | 
            #{item.refundGoodsStatus}, 
 | 
            #{item.refundRefuseReason}, 
 | 
            #{item.companyId} 
 | 
    </sql> 
 | 
     
 | 
    <!-- where sql --> 
 | 
    <sql id="where_sql"> 
 | 
          
 | 
         <if test="record!=null"> 
 | 
            <if test="(record.id!=null and record.id!='') or  (record.id!='' and record.id==0)  "> 
 | 
                and id  = #{record.id}  
 | 
            </if> 
 | 
            <if test="(record.refundNo!=null and record.refundNo!='') or  (record.refundNo!='' and record.refundNo==0)  "> 
 | 
                and refund_no  = #{record.refundNo}  
 | 
            </if> 
 | 
            <if test="(record.orderId!=null and record.orderId!='') or  (record.orderId!='' and record.orderId==0)  "> 
 | 
                and order_id  = #{record.orderId}  
 | 
            </if> 
 | 
            <if test="(record.userId!=null and record.userId!='') or  (record.userId!='' and record.userId==0)  "> 
 | 
                and user_id  = #{record.userId}  
 | 
            </if> 
 | 
            <if test="(record.refundCause!=null and record.refundCause!='') or  (record.refundCause!='' and record.refundCause==0)  "> 
 | 
                and refund_cause  = #{record.refundCause}  
 | 
            </if> 
 | 
            <if test="(record.refundMoney!=null and record.refundMoney!='') or  (record.refundMoney!='' and record.refundMoney==0)  "> 
 | 
                and refund_money  = #{record.refundMoney}  
 | 
            </if> 
 | 
            <if test="(record.handler!=null and record.handler!='') or  (record.handler!='' and record.handler==0)  "> 
 | 
                and handler like concat('%',#{record.handler},'%') 
 | 
            </if> 
 | 
            <if test="(record.handingTime!=null and record.handingTime!='') or  (record.handingTime!='' and record.handingTime==0)  "> 
 | 
                and handing_time  = #{record.handingTime}  
 | 
            </if> 
 | 
            <if test="(record.refundTransactionNo!=null and record.refundTransactionNo!='') or  (record.refundTransactionNo!='' and record.refundTransactionNo==0)  "> 
 | 
                and refund_transaction_no  = #{record.refundTransactionNo}  
 | 
            </if> 
 | 
            <if test="(record.remarks!=null and record.remarks!='') or  (record.remarks!='' and record.remarks==0)  "> 
 | 
                and remarks  = #{record.remarks}  
 | 
            </if> 
 | 
            <if test="(record.refundWaybillNo!=null and record.refundWaybillNo!='') or  (record.refundWaybillNo!='' and record.refundWaybillNo==0)  "> 
 | 
                and refund_waybill_no like concat('%', #{record.refundWaybillNo}, '%') 
 | 
            </if> 
 | 
            <if test="(record.logisticsCompany!=null and record.logisticsCompany!='') or  (record.logisticsCompany!='' and record.logisticsCompany==0)  "> 
 | 
                and logistics_company like concat('%',#{record.logisticsCompany},'%') 
 | 
            </if> 
 | 
            <if test="(record.applyTime!=null and record.applyTime!='') or  (record.applyTime!='' and record.applyTime==0)  "> 
 | 
                and apply_time  = #{record.applyTime}  
 | 
            </if> 
 | 
            <if test="(record.refundTime!=null and record.refundTime!='') or  (record.refundTime!='' and record.refundTime==0)  "> 
 | 
                and refund_time  = #{record.refundTime}  
 | 
            </if> 
 | 
            <if test="(record.refundType!=null and record.refundType!='') or  (record.refundType!='' and record.refundType==0)  "> 
 | 
                and refund_type  = #{record.refundType}  
 | 
            </if> 
 | 
            <if test="(record.auditStatus!=null and record.auditStatus!='') or  (record.auditStatus!='' and record.auditStatus==0)  "> 
 | 
                and audit_status  = #{record.auditStatus}  
 | 
            </if> 
 | 
            <if test="(record.refundStatus!=null and record.refundStatus!='') or  (record.refundStatus!='' and record.refundStatus==0)  "> 
 | 
                and refund_status  = #{record.refundStatus}  
 | 
            </if> 
 | 
            <if test="(record.refundGoodsStatus!=null and record.refundGoodsStatus!='') or  (record.refundGoodsStatus!='' and record.refundGoodsStatus==0)  "> 
 | 
                and refund_goods_status  = #{record.refundGoodsStatus}  
 | 
            </if> 
 | 
            <if test="(record.refundRefuseReason!=null and record.refundRefuseReason!='') or  (record.refundRefuseReason!='' and record.refundRefuseReason==0)  "> 
 | 
                and refund_refuse_reason  = #{record.refundRefuseReason}  
 | 
            </if> 
 | 
             <if test="(record.nickName!=null and record.nickName!='') or  (record.nickName!='' and record.nickName==0)  "> 
 | 
                 and u.nick_name like concat('%',#{record.nickName},'%') 
 | 
             </if> 
 | 
             <if test="(record.orderNo!=null and record.orderNo!='') or  (record.orderNo!='' and record.orderNo==0)  "> 
 | 
                 and o.order_no like concat('%', #{record.orderNo}, '%') 
 | 
             </if> 
 | 
             <if test="(record.refundBeginTime!=null and record.refundBeginTime!='')"> 
 | 
                 and date_format(apply_time, '%Y-%m-%d') >= #{record.refundBeginTime} 
 | 
             </if> 
 | 
             <if test="(record.refundEndTime!=null and record.refundEndTime!='')"> 
 | 
                 and  #{record.refundEndTime} >= date_format(apply_time, '%Y-%m-%d') 
 | 
             </if> 
 | 
             <if test="(record.companyId!=null and record.companyId!='') or  (record.companyId!='' and record.companyId==0)  "> 
 | 
                 and r.company_id  = #{record.companyId} 
 | 
             </if> 
 | 
        </if> 
 | 
          
 | 
    </sql> 
 | 
     
 | 
    <!--  插入方法   --> 
 | 
    <insert id="insert" parameterType="com.matrix.system.shopXcx.bean.ShopRefundRecord" 
 | 
        useGeneratedKeys="true" keyProperty="item.id"> 
 | 
        INSERT INTO shop_refund_record ( 
 | 
             <include refid="columns"></include> 
 | 
        ) 
 | 
    VALUES ( 
 | 
         <include refid="propertys"></include> 
 | 
    ) 
 | 
    </insert> 
 | 
     
 | 
     
 | 
     
 | 
    <!--  批量插入   --> 
 | 
    <insert id="batchInsert" parameterType="java.util.List"> 
 | 
        INSERT INTO shop_refund_record ( 
 | 
        <include refid="columns"></include>     
 | 
        ) 
 | 
    VALUES  
 | 
    <foreach collection="list" item="item" index="index" separator=",">( 
 | 
        <include refid="propertys"></include>     
 | 
    )</foreach> 
 | 
    </insert> 
 | 
     
 | 
     
 | 
     
 | 
     
 | 
     
 | 
    <!--  根据Map更新 部分更新   --> 
 | 
    <update id="updateByMap" parameterType="java.util.HashMap" > 
 | 
        UPDATE shop_refund_record 
 | 
        <set> 
 | 
            <if test="_parameter.containsKey('refundNo')"> 
 | 
                    refund_no = #{refundNo}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('orderId')"> 
 | 
                    order_id = #{orderId}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('userId')"> 
 | 
                    user_id = #{userId}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundCause')"> 
 | 
                    refund_cause = #{refundCause}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundMoney')"> 
 | 
                    refund_money = #{refundMoney}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('handler')"> 
 | 
                    handler = #{handler}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('handingTime')"> 
 | 
                    handing_time = #{handingTime}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundTransactionNo')"> 
 | 
                    refund_transaction_no = #{refundTransactionNo}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('remarks')"> 
 | 
                    remarks = #{remarks}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundWaybillNo')"> 
 | 
                    refund_waybill_no = #{refundWaybillNo}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('logisticsCompany')"> 
 | 
                    logistics_company = #{logisticsCompany}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('applyTime')"> 
 | 
                    apply_time = #{applyTime}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundTime')"> 
 | 
                    refund_time = #{refundTime}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundType')"> 
 | 
                    refund_type = #{refundType}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('auditStatus')"> 
 | 
                    audit_status = #{auditStatus}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundStatus')"> 
 | 
                    refund_status = #{refundStatus}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundGoodsStatus')"> 
 | 
                    refund_goods_status = #{refundGoodsStatus}, 
 | 
                </if>         
 | 
            <if test="_parameter.containsKey('refundRefuseReason')"> 
 | 
                    refund_refuse_reason = #{refundRefuseReason}, 
 | 
                </if>         
 | 
        </set> 
 | 
        WHERE id=#{id}  
 | 
    </update>  
 | 
     
 | 
     
 | 
    <!--  根据对象更新 部分更新   --> 
 | 
    <update id="updateByModel" parameterType="Integer"> 
 | 
        UPDATE shop_refund_record 
 | 
        <set> 
 | 
            <if test="record.refundNo != null and record.refundNo != '' "> 
 | 
                refund_no  = #{record.refundNo},  
 | 
            </if> 
 | 
            <if test="record.orderId != null "> 
 | 
                order_id  = #{record.orderId},  
 | 
            </if> 
 | 
            <if test="record.userId != null and record.userId != '' "> 
 | 
                user_id  = #{record.userId},  
 | 
            </if> 
 | 
            <if test="record.refundCause != null and record.refundCause != '' "> 
 | 
                refund_cause  = #{record.refundCause},  
 | 
            </if> 
 | 
            <if test="record.refundMoney != null "> 
 | 
                refund_money  = #{record.refundMoney},  
 | 
            </if> 
 | 
            <if test="record.handler != null and record.handler != '' "> 
 | 
                handler  = #{record.handler},  
 | 
            </if> 
 | 
            <if test="record.handingTime != null "> 
 | 
                handing_time  = #{record.handingTime},  
 | 
            </if> 
 | 
            <if test="record.refundTransactionNo != null and record.refundTransactionNo != '' "> 
 | 
                refund_transaction_no  = #{record.refundTransactionNo},  
 | 
            </if> 
 | 
            <if test="record.remarks != null and record.remarks != '' "> 
 | 
                remarks  = #{record.remarks},  
 | 
            </if> 
 | 
            <if test="record.refundWaybillNo != null and record.refundWaybillNo != '' "> 
 | 
                refund_waybill_no  = #{record.refundWaybillNo},  
 | 
            </if> 
 | 
            <if test="record.logisticsCompany != null and record.logisticsCompany != '' "> 
 | 
                logistics_company  = #{record.logisticsCompany},  
 | 
            </if> 
 | 
            <if test="record.applyTime != null "> 
 | 
                apply_time  = #{record.applyTime},  
 | 
            </if> 
 | 
            <if test="record.refundTime != null "> 
 | 
                refund_time  = #{record.refundTime},  
 | 
            </if> 
 | 
            <if test="record.refundType != null "> 
 | 
                refund_type  = #{record.refundType},  
 | 
            </if> 
 | 
            <if test="record.auditStatus != null "> 
 | 
                audit_status  = #{record.auditStatus},  
 | 
            </if> 
 | 
            <if test="record.refundStatus != null "> 
 | 
                refund_status  = #{record.refundStatus},  
 | 
            </if> 
 | 
            <if test="record.refundGoodsStatus != null "> 
 | 
                refund_goods_status  = #{record.refundGoodsStatus},  
 | 
            </if> 
 | 
            <if test="record.refundRefuseReason != null and record.refundRefuseReason != '' "> 
 | 
                refund_refuse_reason  = #{record.refundRefuseReason},  
 | 
            </if> 
 | 
        </set> 
 | 
        WHERE id=#{record.id}  
 | 
    </update> 
 | 
  
 | 
    <!-- 根据ID批量更新退货退款状态 --> 
 | 
    <update id="updateRefundTypeByIds"> 
 | 
        update shop_refund_record 
 | 
        <set> 
 | 
            <if test="state == 1 or state == 2"> 
 | 
                refund_goods_status = #{state}, 
 | 
            </if> 
 | 
        </set> 
 | 
        where id in 
 | 
        <foreach collection="list" index="index" item="item" open="(" 
 | 
                 separator="," close=")"> 
 | 
            #{item} 
 | 
        </foreach> 
 | 
    </update> 
 | 
  
 | 
    <!-- 根据ID批量更新申请退款状态 --> 
 | 
    <update id="updateRefundStatusByIds"> 
 | 
        update shop_refund_record 
 | 
        <set> 
 | 
            <if test="state == 1 or state == 2"> 
 | 
                refund_status = #{state}, 
 | 
            </if> 
 | 
            refund_time = now(), 
 | 
        </set> 
 | 
        where id = #{id} 
 | 
    </update> 
 | 
  
 | 
    <!-- 根据ID更新申请退款(失败)状态 --> 
 | 
    <update id="updateRefundStatusByFail"> 
 | 
        update shop_refund_record 
 | 
        <set> 
 | 
            <if test="state == 1 or state == 2"> 
 | 
                refund_status = #{state}, 
 | 
            </if> 
 | 
        </set> 
 | 
        where id = #{id} 
 | 
    </update> 
 | 
  
 | 
    <!-- 批量删除 --> 
 | 
    <delete id="deleteByIds" parameterType="java.util.List"> 
 | 
        delete from shop_refund_record where  id in 
 | 
        <foreach collection="list" index="index" item="item" open="(" 
 | 
            separator="," close=")"> 
 | 
            #{item} 
 | 
        </foreach> 
 | 
    </delete> 
 | 
         
 | 
    <!-- 根据id删除--> 
 | 
    <delete id="deleteById" parameterType="Integer"> 
 | 
        DELETE FROM shop_refund_record 
 | 
        where  id=#{id}  
 | 
    </delete> 
 | 
     
 | 
    <!-- 根据对象删除--> 
 | 
    <delete id="deleteByModel" parameterType="com.matrix.system.shopXcx.bean.ShopRefundRecord"> 
 | 
        DELETE FROM shop_refund_record 
 | 
        <where> 
 | 
        <include refid="where_sql" ></include> 
 | 
        </where> 
 | 
    </delete> 
 | 
     
 | 
     
 | 
     
 | 
    <!-- 分页查询 --> 
 | 
    <select id="selectInPage" resultMap="ShopRefundRecordMap"> 
 | 
        select 
 | 
        r.create_by, 
 | 
        r.create_time, 
 | 
        r.update_by, 
 | 
        r.update_time, 
 | 
        r.id, 
 | 
        r.refund_no, 
 | 
        r.order_id, 
 | 
        r.user_id, 
 | 
        r.refund_cause, 
 | 
        r.refund_money, 
 | 
        r.handler, 
 | 
        r.handing_time, 
 | 
        r.refund_transaction_no, 
 | 
        r.remarks, 
 | 
        r.refund_waybill_no, 
 | 
        r.logistics_company, 
 | 
        r.apply_time, 
 | 
        r.refund_time, 
 | 
        r.refund_type, 
 | 
        r.audit_status, 
 | 
        r.refund_status, 
 | 
        r.refund_goods_status, 
 | 
        r.refund_refuse_reason, 
 | 
        o.order_no, 
 | 
        u.nick_name 
 | 
        from shop_refund_record r 
 | 
        left join shop_order o on r.order_id = o.id 
 | 
        LEFT JOIN sys_vip_info u ON r.user_id = u.id 
 | 
        <where> 
 | 
          <include refid="where_sql"></include> 
 | 
         </where> 
 | 
        <if test="pageVo !=null"><!-- 判断这个pageVo对象是否为空 --> 
 | 
            order by r.create_time desc 
 | 
            <if test="pageVo.offset >=0  and pageVo.limit >0"> 
 | 
                limit 
 | 
                #{pageVo.offset},#{pageVo.limit} 
 | 
            </if> 
 | 
        </if> 
 | 
    </select> 
 | 
     
 | 
    <!-- 查询总条数 --> 
 | 
    <select id="selectTotalRecord" parameterType="long"   resultType="java.lang.Integer"> 
 | 
    select count(*) 
 | 
        from shop_refund_record r 
 | 
        left join shop_order o on r.order_id = o.id 
 | 
        LEFT JOIN sys_vip_info u ON r.user_id = u.id 
 | 
        <where> 
 | 
           <include refid="where_sql"></include> 
 | 
        </where> 
 | 
    </select> 
 | 
  
 | 
    <!-- 根据id查询--> 
 | 
    <select id="selectById" resultMap="ShopRefundRecordMap"> 
 | 
        select  
 | 
        r.create_by, 
 | 
        r.create_time, 
 | 
        r.update_by, 
 | 
        r.update_time, 
 | 
        r.id, 
 | 
        r.refund_no, 
 | 
        r.order_id, 
 | 
        r.user_id, 
 | 
        r.refund_cause, 
 | 
        r.refund_money, 
 | 
        r.handler, 
 | 
        r.handing_time, 
 | 
        r.refund_transaction_no, 
 | 
        r.remarks, 
 | 
        r.refund_waybill_no, 
 | 
        r.logistics_company, 
 | 
        r.apply_time, 
 | 
        r.refund_time, 
 | 
        r.refund_type, 
 | 
        r.audit_status, 
 | 
        r.refund_status, 
 | 
        r.refund_goods_status, 
 | 
        r.refund_refuse_reason, 
 | 
        o.order_no, 
 | 
        o.discount_amount, 
 | 
        u.nick_name 
 | 
        from shop_refund_record r 
 | 
        left join shop_order o on r.order_id = o.id 
 | 
        LEFT JOIN sys_vip_info u ON r.user_id = u.id 
 | 
        where  r.id=#{id} 
 | 
    </select> 
 | 
  
 | 
    <!-- 根据id查询--> 
 | 
    <select id="selectDetailsById" resultMap="ShopRefundRecordDetailsMap"> 
 | 
        SELECT 
 | 
            r.id, 
 | 
            r.refund_no, 
 | 
            r.refund_cause, 
 | 
            r.refund_money, 
 | 
            o.order_no, 
 | 
            o.order_money, 
 | 
            o.postage, 
 | 
            d.price, 
 | 
            d.count, 
 | 
            d.total_price, 
 | 
            d.s_title, 
 | 
            d.discount_amount, 
 | 
            p.title 
 | 
        FROM 
 | 
            shop_refund_record r 
 | 
            LEFT JOIN shop_order o ON r.order_id = o.id 
 | 
            LEFT JOIN shop_order_details d ON r.order_id = d.order_id 
 | 
            LEFT JOIN shop_product p ON d.p_id = p.id 
 | 
        WHERE 
 | 
            r.order_id = #{orderId} 
 | 
    </select> 
 | 
  
 | 
    <!-- 根据id查询带出订单产品等--> 
 | 
    <select id="selectRefundById" resultMap="ShopRefundRecordComplexMap"> 
 | 
        select 
 | 
        <include refid="columns" ></include> 
 | 
        from shop_refund_record 
 | 
        where  id=#{id} 
 | 
    </select> 
 | 
  
 | 
    <!-- 根据用户id查询--> 
 | 
    <select id="selectByRefundUserId" resultMap="ShopRefundRecordComplexMap"> 
 | 
        select 
 | 
        <include refid="columns" ></include> 
 | 
        from shop_refund_record 
 | 
        <where> 
 | 
            <if test="record!=null"> 
 | 
                <if test="(record.userId!=null and record.userId!='') or  (record.userId!='' and record.userId==0)  "> 
 | 
                    and user_id = #{record.userId} 
 | 
                </if> 
 | 
            </if> 
 | 
        </where> 
 | 
        order by create_time desc 
 | 
        <if test="record.offset >=0  and record.limit >0"> 
 | 
            limit 
 | 
            #{record.offset},#{record.limit} 
 | 
        </if> 
 | 
    </select> 
 | 
  
 | 
  
 | 
    <!-- 根据id 锁表查询--> 
 | 
    <select id="selectForUpdate" resultMap="ShopRefundRecordMap"> 
 | 
        select  
 | 
        <include refid="columns" ></include> 
 | 
        from shop_refund_record 
 | 
        where  id=#{id}  
 | 
        for update 
 | 
    </select>     
 | 
     
 | 
     
 | 
     
 | 
    <!-- 根据对象查询--> 
 | 
    <select id="selectByModel" resultMap="ShopRefundRecordMap"> 
 | 
        select  
 | 
        <include refid="columns" ></include> 
 | 
        from shop_refund_record 
 | 
        <where> 
 | 
          <include refid="where_sql"></include> 
 | 
         </where> 
 | 
    </select> 
 | 
</mapper> 
 |