IMRefundOrderItemMapper.xml 4.1 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.IMRefundOrderItemDao">
    <resultMap id="BaseResultMap" type="com.sibu.orderHelper.integral.model.IMRefundOrderItem">
        <id column="id" jdbcType="VARCHAR" property="id"/>
        <result column="refund_id" jdbcType="VARCHAR" property="refundId"/>
        <result column="order_id" jdbcType="VARCHAR" property="orderId"/>
        <result column="order1_id" jdbcType="VARCHAR" property="order1Id"/>
        <result column="member_id" jdbcType="VARCHAR" property="memberId"/>
        <result column="sort_index" jdbcType="INTEGER" property="sortIndex"/>
        <result column="product_id" jdbcType="VARCHAR" property="productId"/>
        <result column="quantity" jdbcType="INTEGER" property="quantity"/>
        <result column="integral" jdbcType="BIGINT" property="integral"/>
        <result column="line_integral" jdbcType="BIGINT" property="lineIntegral"/>
        <result column="price" jdbcType="DECIMAL" property="price"/>
        <result column="line_price" jdbcType="DECIMAL" property="linePrice"/>
        <result column="sku_id" jdbcType="VARCHAR" property="skuId"/>
        <result column="erp_code" jdbcType="VARCHAR" property="erpCode"/>
        <result column="spec_detail" jdbcType="VARCHAR" property="specDetail"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="thumb_img" jdbcType="VARCHAR" property="thumbImg"/>
        <result column="market_price" jdbcType="DECIMAL" property="marketPrice"/>
        <result column="discount_price" jdbcType="DECIMAL" property="discountPrice"/>
        <result column="discount_line_price" jdbcType="DECIMAL" property="discountLinePrice"/>
        <result column="deduction_product_vb" jdbcType="INTEGER" property="deductionProductVb"/>
        <result column="deduction_line_vb" jdbcType="INTEGER" property="deductionLineVb"/>
    </resultMap>

    <insert id="insert" parameterType="com.sibu.orderHelper.integral.model.IMRefundOrderItem">
        INSERT INTO `im_refund_order_item`
        (`id`,
        `refund_id`,
        `order_id`,
        `order1_id`,
        `member_id`,
        `sort_index`,
        `product_id`,
        `quantity`,
        `integral`,
        `line_integral`,
        `price`,
        `line_price`,
        `sku_id`,
        `erp_code`,
        `spec_detail`,
        `name`,
        `thumb_img`,
        `market_price`,
        `discount_price`,
        `discount_line_price`,
        `deduction_product_vb`,
        `deduction_line_vb`)
        VALUES
        (#{id},
        #{refundId},
        #{orderId},
        #{order1Id},
        #{memberId},
        #{sortIndex},
        #{productId},
        #{quantity},
        #{integral},
        #{lineIntegral},
        #{price},
        #{linePrice},
        #{skuId},
        #{erpCode},
        #{specDetail},
        #{name},
        #{thumbImg},
        #{marketPrice},
        #{discountPrice},
        #{discountLinePrice},
        #{deductionProductVb},
        #{deductionLineVb});
    </insert>
    <sql id="Base_Column_List">
        id, refund_id, order_id, order1_id, member_id, sort_index, product_id, quantity,
        integral, line_integral, price, line_price, sku_id, erp_code, spec_detail, name,
        thumb_img, market_price, discount_price, discount_line_price, deduction_product_vb,
        deduction_line_vb
    </sql>
    <select id="findByRefundId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from im_refund_order_item where refund_id = #{refundId}
    </select>

    <select id="findAlreadyRefundItemQuantityByOrderId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from im_refund_order_item where
        order_id = #{orderId} and
        refund_id in (
            select refund_id from im_order_refund where order_id = #{orderId} and refund_status not in (100,101)
        )
    </select>


    <delete id="removeByRefundId">
    delete from im_refund_order_item where refund_id = #{refundId}
</delete>
</mapper>