java-base-app/bd-business/bd-business-sale/src/main/resources/mapper/sale/refund/SaRefundMapper.xml

89 lines
3.6 KiB
XML

<?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.hzs.sale.refund.mapper.SaRefundMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.hzs.common.domain.sale.order.SaRefund">
<id column="PK_ID" property="pkId"/>
<result column="DEL_FLAG" property="delFlag"/>
<result column="CREATION_TIME" property="creationTime"/>
<result column="PK_CREATOR" property="pkCreator"/>
<result column="MODIFIED_TIME" property="modifiedTime"/>
<result column="PK_MODIFIED" property="pkModified"/>
<result column="PK_COUNTRY" property="pkCountry"/>
<result column="REFUND_CODE" property="refundCode"/>
<result column="PK_ORDER" property="pkOrder"/>
<result column="REFUND_AMOUNT" property="refundAmount"/>
<result column="REFUND_ACHIEVE" property="refundAchieve"/>
<result column="REFUND_ASS_ACHIEVE" property="refundAssAchieve"/>
<result column="POSTAGE" property="postage"/>
<result column="SERVICE_CODE" property="serviceCode"/>
<result column="REFUND_STATUS" property="refundStatus"/>
<result column="REFUND_REMARK" property="refundRemark"/>
</resultMap>
<!-- 订单退款列表 -->
<select id="queryRefundList" resultType="com.hzs.sale.refund.vo.RefundQueryVO">
select cm.member_code,
cm.member_name,
so.order_code,
so.order_type,
sr.refund_status,
sr.refund_code,
sr.refund_amount,
sr.refund_achieve,
sr.refund_ass_achieve,
sr.postage,
bp.product_code,
bp.product_name,
sri.specs_name,
sri.price,
sri.achievement,
sri.ass_achievement,
sri.quantity,
sr.creation_time
from SA_REFUND sr
left join SA_REFUND_ITEMS sri
on sri.pk_refund = sr.pk_id
and sri.del_flag = 0
inner join BD_PRODUCT bp
on bp.pk_id = sri.pk_product
inner join SA_ORDER SO
on so.pk_id = sr.pk_order
inner join CU_MEMBER cm
on cm.pk_id = so.pk_creator
where sr.del_flag = 0
and sr.pk_country = #{pkCountry}
<if test="param.memberCode != null and param.memberCode != ''">
and cm.member_code like #{param.memberCode} || '%'
</if>
<if test="param.memberName != null and param.memberName != ''">
and cm.member_name like #{param.memberName} || '%'
</if>
<if test="param.orderCode != null and param.orderCode != ''">
and so.order_code like #{param.orderCode} || '%'
</if>
<if test="param.orderType != null">
and so.order_type = #{param.orderType}
</if>
<if test="param.refundStatus != null">
and sr.refund_status = #{param.refundStatus}
</if>
<if test="param.refundCode != null and param.refundCode != ''">
and sr.refund_code like #{param.refundCode} || '%'
</if>
<if test="param.productCode != null and param.productCode != ''">
and bp.product_code like #{param.productCode} || '%'
</if>
<if test="param.productName != null and param.productName != ''">
and bp.product_name like #{param.productName} || '%'
</if>
<if test="param.creationTime != null">
and sr.creation_time >= #{param.creationTime[0]}
and #{param.creationTime[1]} >= sr.creation_time
</if>
order by sr.creation_time desc
</select>
</mapper>