IMWebAccountOrderCheckingRefundMapper.xml 11.8 KB
<?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.sibu.orderHelper.integral.web.dao.IMWebAccountOrderCheckingRefundDao">
	<resultMap type="com.sibu.orderHelper.integral.model.AccountOrderCheckingRefund" id="refundOrderItemResultMap">
		<id column="refund_id" jdbcType="VARCHAR" property="refundId"/>
		<result column="refund_code" jdbcType="VARCHAR" property="refundCode"/>
		<result column="order_id" jdbcType="VARCHAR" property="orderId"/>
		<result column="order_code" jdbcType="VARCHAR" property="orderCode"/>
		<result column="order_from" jdbcType="TINYINT" property="orderFrom"/>
		<result column="member_id" jdbcType="VARCHAR" property="memberId"/>
		<result column="refund_type" jdbcType="INTEGER" property="refundType"/>
		<result column="refund_goods_status" jdbcType="INTEGER" property="refundGoodsStatus"/>
		<result column="refund_reason_id" jdbcType="INTEGER" property="refundReasonId"/>
		<result column="refund_reason" jdbcType="VARCHAR" property="refundReason"/>
		<result column="refund_money" jdbcType="DECIMAL" property="refundMoney"/>
		<result column="order_money" jdbcType="DECIMAL" property="orderMoney"/>
		<result column="refund_remark" jdbcType="VARCHAR" property="refundRemark"/>
		<result column="refund_status" jdbcType="INTEGER" property="refundStatus"/>
		<result column="refund_status_last_update_dt" jdbcType="TIMESTAMP" property="refundStatusLastUpdateDt"/>
		<result column="apply_date" jdbcType="TIMESTAMP" property="applyDate"/>
		<result column="refund_money_success_flag" jdbcType="BIT" property="refundMoneySuccessFlag"/>
		<result column="refund_date" jdbcType="TIMESTAMP" property="refundDate"/>
		<result column="buyer_username" jdbcType="VARCHAR" property="buyerUsername"/>
		<result column="buyer_phone" jdbcType="VARCHAR" property="buyerPhone"/>
		<result column="refund_seller_phone" jdbcType="VARCHAR" property="refundSellerPhone"/>
		<result column="refund_seller_address" jdbcType="VARCHAR" property="refundSellerAddress"/>
		<result column="refund_seller_name" jdbcType="VARCHAR" property="refundSellerName"/>
		<result column="finish_date" jdbcType="TIMESTAMP" property="finishDate"/>
		<result column="refund_integral" jdbcType="BIGINT" property="refundIntegral"/>
		<result column="refund_goods_deliver_id" jdbcType="TINYINT" property="refundGoodsDeliverId"/>
		<result column="refund_goods_deliver_name" jdbcType="VARCHAR" property="refundGoodsDeliverName"/>
		<result column="refund_goods_waybill" jdbcType="VARCHAR" property="refundGoodsWaybill"/>
		<result column="refund_goods_remark" jdbcType="VARCHAR" property="refundGoodsRemark"/>
		<result column="refund_tips" jdbcType="VARCHAR" property="refundTips"/>
		<result column="receive_goods_flag" jdbcType="BIT" property="receiveGoodsFlag"/>
		<result column="receive_goods_dt" jdbcType="TIMESTAMP" property="receiveGoodsDt"/>
		<result column="deduction_product_vb" jdbcType="INTEGER" property="deductionProductVb"/>
		<result column="deduction_product_vb_refund_status" jdbcType="TINYINT" property="deductionProductVbRefundStatus"/>
		<result column="deduction_product_vb_refund_dt" jdbcType="TIMESTAMP" property="deductionProductVbRefundDt"/>
		<result column="profit_refund_status" jdbcType="TINYINT" property="profitRefundStatus"/>
		<result column="profit_refund_dt" jdbcType="TIMESTAMP" property="profitRefundDt"/>
		<result column="refund_freight" jdbcType="DECIMAL" property="refundFreight"/>
		<result column="refund_to_account_type" jdbcType="TINYINT" property="refundToAccountType"/>
		<result column="refund_alipay_account" jdbcType="VARCHAR" property="refundAlipayAccount"/>
		<result column="refund_alipay_account_real_name" jdbcType="VARCHAR" property="refundAlipayAccountRealName"/>
		<result column="refund_bank_account" jdbcType="VARCHAR" property="refundBankAccount"/>
		<result column="refund_bank_account_real_name" jdbcType="VARCHAR" property="refundBankAccountRealName"/>
		<result column="refund_bank_branch_full_name" jdbcType="VARCHAR" property="refundBankBranchFullName"/>
		<result column="change_goods_waybill" jdbcType="VARCHAR" property="changeGoodsWaybill"/>
		<result column="change_goods_deliver_name" jdbcType="VARCHAR" property="changeGoodsDeliverName"/>
		<result column="change_goods_finish_flag" jdbcType="INTEGER" property="changeGoodsFinishFlag"/>
		<collection property="accountOrderCheckingRefundDetailList" column="refund_id" ofType="com.sibu.orderHelper.integral.model.AccountOrderCheckingRefundDetail">
			<result column="id" property="id"/>
			<result column="rid" property="refundId"/>
			<result column="oid" property="orderId"/>
			<result column="order1_id" property="order1Id"/>
			<result column="mid" property="memberId"/>
			<result column="sort_index" property="sortIndex"/>
			<result column="product_id" property="productId"/>
			<result column="quantity" property="quantity"/>
			<result column="integral" property="integral"/>
			<result column="line_integral" property="lineIntegral"/>
			<result column="price" property="price"/>
			<result column="line_price" property="linePrice"/>
			<result column="sku_id" property="skuId"/>
			<result column="erp_code" property="erpCode"/>
			<result column="spec_detail" property="specDetail"/>
			<result column="name" property="name"/>
			<result column="thumb_img" property="thumbImg"/>
			<result column="market_price" property="marketPrice"/>
			<result column="discount_price" property="discountPrice"/>
			<result column="discount_line_price" property="discountLinePrice"/>
			<result column="deduction_product_vb" property="deductionProductVb"/>
			<result column="deduction_line_vb" property="deductionLineVb"/>
			<result column="order_checking_id" property="orderCheckingId"/>
		</collection>
	</resultMap>

	<resultMap type="com.sibu.orderHelper.integral.vo.IMCheckingOrderRefundExportBean" id="refundExportResultMap">
		<id column="refund_id" jdbcType="VARCHAR" property="refundId"/>
		<result column="refund_code" jdbcType="VARCHAR" property="refundCode"/>
		<result column="order_id" jdbcType="VARCHAR" property="orderId"/>
		<result column="order_code" jdbcType="VARCHAR" property="orderCode"/>
		<result column="order_from" jdbcType="TINYINT" property="orderFrom"/>
		<result column="member_id" jdbcType="VARCHAR" property="memberId"/>
		<result column="refund_type" jdbcType="INTEGER" property="refundType"/>
		<result column="refund_goods_status" jdbcType="INTEGER" property="refundGoodsStatus"/>
		<result column="refund_reason_id" jdbcType="INTEGER" property="refundReasonId"/>
		<result column="refund_reason" jdbcType="VARCHAR" property="refundReason"/>
		<result column="refund_money" jdbcType="DECIMAL" property="refundMoney"/>
		<result column="order_money" jdbcType="DECIMAL" property="orderMoney"/>
		<result column="refund_remark" jdbcType="VARCHAR" property="refundRemark"/>
		<result column="refund_status" jdbcType="INTEGER" property="refundStatus"/>
		<result column="refund_status_last_update_dt" jdbcType="TIMESTAMP" property="refundStatusLastUpdateDt"/>
		<result column="apply_date" jdbcType="TIMESTAMP" property="applyDate"/>
		<result column="refund_money_success_flag" jdbcType="BIT" property="refundMoneySuccessFlag"/>
		<result column="refund_date" jdbcType="TIMESTAMP" property="refundDate"/>
		<result column="buyer_username" jdbcType="VARCHAR" property="buyerUsername"/>
		<result column="buyer_phone" jdbcType="VARCHAR" property="buyerPhone"/>
		<result column="refund_seller_phone" jdbcType="VARCHAR" property="refundSellerPhone"/>
		<result column="refund_seller_address" jdbcType="VARCHAR" property="refundSellerAddress"/>
		<result column="refund_seller_name" jdbcType="VARCHAR" property="refundSellerName"/>
		<result column="finish_date" jdbcType="TIMESTAMP" property="finishDate"/>
		<result column="refund_integral" jdbcType="BIGINT" property="refundIntegral"/>
		<result column="refund_goods_deliver_id" jdbcType="TINYINT" property="refundGoodsDeliverId"/>
		<result column="refund_goods_deliver_name" jdbcType="VARCHAR" property="refundGoodsDeliverName"/>
		<result column="refund_goods_waybill" jdbcType="VARCHAR" property="refundGoodsWaybill"/>
		<result column="refund_goods_remark" jdbcType="VARCHAR" property="refundGoodsRemark"/>
		<result column="refund_tips" jdbcType="VARCHAR" property="refundTips"/>
		<result column="receive_goods_flag" jdbcType="BIT" property="receiveGoodsFlag"/>
		<result column="receive_goods_dt" jdbcType="TIMESTAMP" property="receiveGoodsDt"/>
	</resultMap>

	<!--分页获取退单-->
	<select id="pagerOrders" resultMap="refundOrderItemResultMap" parameterType="java.util.Map">
		select * from acc_order_refund
		where 1=1
		<if test="refundCode != null and refundCode != ''">
			and refund_code =#{refundCode}
		</if>
		<if test="orderCode != null and orderCode != ''">
			and order_code = #{orderCode}
		</if>
		<if test="refundType == 1 or refundType == 2 or refundType == 3 or refundType==4">
			and refund_type =#{refundType}
		</if>
		<if test="refundStatus != -1 and refundStatus != null and refundStatus != ''">
			and refund_status = #{refundStatus}
		</if>
		<if test="orderCheckingId != null and orderCheckingId != ''">
			and order_checking_id = #{orderCheckingId}
		</if>
		<if test="startCreateDt != null and startCreateDt !=''">
			and refund_status_last_update_dt >= #{startCreateDt}
		</if>
		<if test="endCreateDt != null and endCreateDt != ''">
			<![CDATA[
		   and refund_status_last_update_dt <= #{endCreateDt}
		  ]]>
		</if>
		ORDER BY refund_status_last_update_dt DESC
		LIMIT ${pageNow}, ${pageSize}
	</select>

	<!--获取退单数量-->
	<select id="countOrders" parameterType="java.util.Map" resultType="java.lang.Integer">
		select count(1) from acc_order_refund r
		where 1=1
		<if test="refundCode != null and refundCode != ''">
			and refund_code =#{refundCode}
		</if>
		<if test="orderCode != null and orderCode != ''">
			and order_code = #{orderCode}
		</if>
		<if test="refundType == 1 or refundType == 2 or refundType == 3 or refundType==4">
			and refund_type =#{refundType}
		</if>
		<if test="refundStatus != -1 and refundStatus != null and refundStatus != ''">
			and refund_status = #{refundStatus}
		</if>
		<if test="orderCheckingId != null and orderCheckingId != ''">
			and order_checking_id = #{orderCheckingId}
		</if>
		<if test="startCreateDt != null and startCreateDt !=''">
			and refund_status_last_update_dt >= #{startCreateDt}
		</if>
		<if test="endCreateDt != null and endCreateDt != ''">
			<![CDATA[
		   and refund_status_last_update_dt <= #{endCreateDt}
		  ]]>
		</if>
	</select>

	<!--根据id获取退单详情-->
	<select id="getRefundDetailById" resultMap="refundOrderItemResultMap" parameterType="java.util.Map">
		select *
		from acc_order_refund r
		LEFT JOIN acc_refund_order_item r1 ON r.refund_id = r1.refund_id
		where 1=1
		AND r.refund_id = #{refundId}
	</select>

	<!--导出退单记录-->
	<select id="getOrderRefundTemplateExcelData" resultMap="refundExportResultMap" parameterType="java.util.Map">
		select * from acc_order_refund
		where 1=1
		<if test="refundCode != null and refundCode != ''">
			and refund_code =#{refundCode}
		</if>
		<if test="orderCode != null and orderCode != ''">
			and order_code = #{orderCode}
		</if>
		<if test="refundType == 1 or refundType == 2 or refundType == 3">
			and refund_type =#{refundType}
		</if>
		<if test="refundStatus != -1 and refundStatus != null and refundStatus != ''">
			and refund_status = #{refundStatus}
		</if>
		<if test="orderCheckingId != null and orderCheckingId != ''">
			and order_checking_id = #{orderCheckingId}
		</if>
		<if test="startCreateDt != null and startCreateDt !=''">
			and refund_status_last_update_dt >= #{startCreateDt}
		</if>
		<if test="endCreateDt != null and endCreateDt != ''">
			<![CDATA[
		   and refund_status_last_update_dt <= #{endCreateDt}
		  ]]>
		</if>
		ORDER BY refund_status_last_update_dt DESC
	</select>
</mapper>