zepengdev
2025-09-17 23e3602b4f3ebde8665c3ab3a56ef81b8d671e0d
oying-system/src/main/resources/mapper/sh/OrderReturnMapper.xml
@@ -9,6 +9,7 @@
        <result column="order_num" property="orderNum"/>
        <result column="order_store_num" property="orderStoreNum"/>
        <result column="order_time" property="orderTime"/>
        <result column="packaging_price" property="packagingPrice"/>
        <result column="send_price" property="sendPrice"/>
        <result column="send_type" property="sendType"/>
        <result column="pay_type" property="payType"/>
@@ -40,6 +41,8 @@
        <result column="rider_name" property="riderName"/>
        <collection property="productSnapshots" ofType="com.oying.modules.sh.domain.OrderReturnProductSnapshot">
            <id column="snapshot_id" property="snapshotId"/>
            <result column="return_num" property="returnNum"/>
            <result column="store_id" property="storeId"/>
            <result column="product_id" property="productId"/>
            <result column="product_code" property="productCode"/>
            <result column="product_barcode" property="productBarcode"/>
@@ -58,7 +61,7 @@
    <sql id="Base_Column_List">
        o.return_id, o.return_num, o.return_status, o.return_status_describe, o.order_num, o.order_store_num,
        o.order_time, o.send_price, o.send_type, o.pay_type, o.user_id, o.username, o.store_id, o.store_name, o.store_logo,
        o.order_time, o.packaging_price, o.send_price, o.send_type, o.pay_type, o.user_id, o.username, o.store_id, o.store_name, o.store_logo,
        o.original_price order_original_price, o.paid_price order_paid_price, o.actually_pay_price order_actually_pay_price,
        o.refund_price, o.refund_status, o.success_time, o.channel, o.reason, o.remark, o.photos, o.audit_status,
        o.audit_user, o.audit_time, o.audit_message, o.rider_id, o.rider_phone, o.rider_name,
@@ -66,7 +69,7 @@
    </sql>
    <sql id="Product_Column_List">
        p.snapshot_id, p.product_id, p.product_code, p.product_barcode, p.product_name, p.product_title, p.product_main_image,
        p.snapshot_id, p.return_num, p.store_id, p.product_id, p.product_code, p.product_barcode, p.product_name, p.product_title, p.product_main_image,
        p.product_description, p.param_data, p.unit_price, p.detail_count, p.original_price, p.paid_price, p.actually_pay_price
    </sql>
    <sql id="Where_sql">
@@ -121,8 +124,7 @@
                or p.product_name like concat('%',#{blurry},'%')
                or p.product_title like concat('%',#{blurry},'%')
                or p.product_description like concat('%',#{blurry},'%')
                or o.orderNum like concat('%',#{blurry},'%')
                or o.order_describe like concat('%',#{blurry},'%')
                or o.return_num like concat('%',#{blurry},'%')
                or o.username like concat('%',#{blurry},'%')
                or o.order_num like concat('%',#{blurry},'%'))
            </if>
@@ -131,9 +133,16 @@
    <update id="updatePayStatus">
        update sh_order_return
        set return_status = #{payState},
            success_time  = #{payTime}
        where order_num = #{orderNum}
        set refund_status = #{refundStatus},
            success_time  = #{successTime}
        where return_num = #{returnNum}
    </update>
    <update id="updateStatus">
        update sh_order_return
        set return_status = #{returnStatus},
            return_status_describe = #{value},
            audit_status  = #{auditStatus}
        where return_num = #{returnNum}
    </update>
    <select id="findAll" resultMap="BaseResultMap">
@@ -143,13 +152,17 @@
        <include refid="Base_Column_List"/>
        from sh_order_return as o
        <include refid="Where_sql"/>
        order by o.return_id desc ) o
        order by o.return_id desc
        <if test="criteria.offset != null">
            limit #{criteria.offset}, #{criteria.size}
        </if>
        ) o
        left join sh_order_return_product_snapshot as p on p.return_num = o.return_num
        <include refid="Where_Sql_Product"/>
        order by o.order_id desc
        order by o.return_id desc
    </select>
    <select id="getByReturnNum" resultMap="BaseResultMap">
        select o.* from ( select
        select o.*, from ( select
        <include refid="Base_Column_List"/>
        from sh_order_return as o ) o
        left join sh_order_return_product_snapshot as p on p.return_num = o.return_num
@@ -157,7 +170,7 @@
    </select>
    <select id="countAll" resultType="java.lang.Long">
        select count(1) from (
        select distinct o.*
        select distinct o.*,
        p.product_code, p.product_barcode, p.product_name, p.product_title, p.product_description
        from ( select
        <include refid="Base_Column_List"/>
@@ -168,4 +181,10 @@
        <include refid="Where_Sql_Product"/>
        ) t
    </select>
    <select id="getByOrderNum" resultType="com.oying.modules.sh.domain.OrderReturn">
        select
        <include refid="Base_Column_List"/>
        from sh_order_return as o
        where o.order_num = #{orderNum} and o.audit_status = #{status}
    </select>
</mapper>