367 lines
14 KiB
XML
367 lines
14 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.zhwl.eatery.mapper.ZdyEateryOrderProductMapper">
|
||
|
|
||
|
<resultMap type="ZdyEateryOrderProduct" id="ZdyEateryOrderProductResult">
|
||
|
<result property="id" column="id"/>
|
||
|
<result property="refundId" column="refund_id"/>
|
||
|
<result property="orderId" column="order_id"/>
|
||
|
<result property="productId" column="product_id"/>
|
||
|
<result property="productName" column="product_name"/>
|
||
|
<result property="productImg" column="product_img"/>
|
||
|
<result property="productSpecsId" column="product_specs_id"/>
|
||
|
<result property="productSpecsName" column="product_specs_name"/>
|
||
|
<result property="productSpecsPrice" column="product_specs_price"/>
|
||
|
<result property="unit" column="unit"/>
|
||
|
<result property="productExtraId" column="product_extra_id"/>
|
||
|
<result property="productExtraName" column="product_extra_name"/>
|
||
|
<result property="productExtraPrice" column="product_extra_price"/>
|
||
|
<result property="productTasteId" column="product_taste_id"/>
|
||
|
<result property="productTasteName" column="product_taste_name"/>
|
||
|
<result property="productTastePrice" column="product_taste_price"/>
|
||
|
<result property="quantity" column="quantity"/>
|
||
|
<result property="returnableQuantity" column="returnable_quantity"/>
|
||
|
<result property="unitPrice" column="unit_price"/>
|
||
|
<result property="totalPrice" column="total_price"/>
|
||
|
<result property="finallyUnitPrice" column="finally_unit_price"/>
|
||
|
<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="remark" column="remark"/>
|
||
|
<result property="merchantId" column="merchant_id"/>
|
||
|
</resultMap>
|
||
|
|
||
|
<sql id="selectZdyEateryOrderProductVo">
|
||
|
select eop.id, eop.refund_id, eop.order_id, eop.product_id, eop.product_name, eop.product_img, eop.product_specs_id,
|
||
|
eop.product_specs_name, eop.product_specs_price, eop.product_extra_id, eop.product_extra_name, eop.product_extra_price,
|
||
|
eop.product_taste_id, eop.product_taste_name, eop.product_taste_price, eop.quantity, eop.returnable_quantity,
|
||
|
eop.unit_price, eop.total_price, eop.finally_unit_price, eop.create_by, eop.create_time, eop.update_by, eop.unit,
|
||
|
eop.update_time, eop.remark, eop.merchant_id
|
||
|
from zdy_eatery_order_product eop
|
||
|
left join sys_dept d on eop.merchant_id = d.dept_id
|
||
|
</sql>
|
||
|
|
||
|
<select id="selectZdyEateryOrderProductList" parameterType="ZdyEateryOrderProduct"
|
||
|
resultMap="ZdyEateryOrderProductResult">
|
||
|
<include refid="selectZdyEateryOrderProductVo"/>
|
||
|
<where>
|
||
|
<if test="orderId != null and orderId != ''">
|
||
|
and order_id = #{orderId}
|
||
|
</if>
|
||
|
<if test="productId != null ">
|
||
|
and product_id = #{productId}
|
||
|
</if>
|
||
|
<if test="productName != null and productName != ''">
|
||
|
and product_name like concat('%', #{productName}, '%')
|
||
|
</if>
|
||
|
<if test="productImg != null and productImg != ''">
|
||
|
and product_img = #{productImg}
|
||
|
</if>
|
||
|
<if test="productSpecsId != null ">
|
||
|
and product_specs_id = #{productSpecsId}
|
||
|
</if>
|
||
|
<if test="productSpecsName != null and productSpecsName != ''">
|
||
|
and product_specs_name like concat('%', #{productSpecsName}, '%')
|
||
|
</if>
|
||
|
<if test="productSpecsPrice != null ">
|
||
|
and product_specs_price = #{productSpecsPrice}
|
||
|
</if>
|
||
|
<if test="productExtraId != null ">
|
||
|
and product_extra_id = #{productExtraId}
|
||
|
</if>
|
||
|
<if test="productExtraName != null and productExtraName != ''">
|
||
|
and product_extra_name like concat('%', #{productExtraName}, '%')
|
||
|
</if>
|
||
|
<if test="productExtraPrice != null ">
|
||
|
and product_extra_price = #{productExtraPrice}
|
||
|
</if>
|
||
|
<if test="productTasteId != null ">
|
||
|
and product_taste_id = #{productTasteId}
|
||
|
</if>
|
||
|
<if test="productTasteName != null and productTasteName != ''">
|
||
|
and product_taste_name like concat('%', #{productTasteName}, '%')
|
||
|
</if>
|
||
|
<if test="productTastePrice != null ">
|
||
|
and product_taste_price = #{productTastePrice}
|
||
|
</if>
|
||
|
<if test="quantity != null ">
|
||
|
and quantity = #{quantity}
|
||
|
</if>
|
||
|
<if test="unitPrice != null ">
|
||
|
and unit_price = #{unitPrice}
|
||
|
</if>
|
||
|
<if test="totalPrice != null ">
|
||
|
and total_price = #{totalPrice}
|
||
|
</if>
|
||
|
<if test="finallyUnitPrice != null ">
|
||
|
and finally_unit_price = #{finallyUnitPrice}
|
||
|
</if>
|
||
|
<if test="merchantId != null ">
|
||
|
and merchant_id = #{merchantId}
|
||
|
</if>
|
||
|
${params.dataScope}
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="selectZdyEateryOrderProductById" parameterType="Long"
|
||
|
resultMap="ZdyEateryOrderProductResult">
|
||
|
<include refid="selectZdyEateryOrderProductVo"/>
|
||
|
where id = #{id}
|
||
|
</select>
|
||
|
<select id="selectZdyEateryOrderProductListWithoutReturn" parameterType="ZdyEateryOrderProduct"
|
||
|
resultMap="ZdyEateryOrderProductResult">
|
||
|
SELECT
|
||
|
a.id,
|
||
|
a.order_id,
|
||
|
a. product_id,
|
||
|
a. product_name,
|
||
|
a. product_img,
|
||
|
a. product_specs_id,
|
||
|
a. product_specs_name,
|
||
|
a. product_specs_price,
|
||
|
a. product_extra_id,
|
||
|
a. product_extra_name,
|
||
|
a. product_extra_price,
|
||
|
a. product_taste_id,
|
||
|
a. product_taste_name,
|
||
|
a. product_taste_price,
|
||
|
a. quantity,
|
||
|
a. returnable_quantity,
|
||
|
a. unit_price,
|
||
|
a. total_price,
|
||
|
a. finally_unit_price,
|
||
|
a.create_by,
|
||
|
a.create_time,
|
||
|
a.update_by,
|
||
|
a. unit,
|
||
|
a.update_time,
|
||
|
a.remark,
|
||
|
a.merchant_id
|
||
|
FROM
|
||
|
zdy_eatery_order_product a
|
||
|
LEFT JOIN
|
||
|
zdy_eatery_order_product b ON a.id = b.refund_id
|
||
|
AND b.order_id = #{orderId}
|
||
|
LEFT JOIN
|
||
|
zdy_eatery_order c ON a.order_id = c.id
|
||
|
WHERE
|
||
|
a.order_id = #{orderId}
|
||
|
AND (order_type = 2
|
||
|
OR a.quantity > 0
|
||
|
AND (a.quantity + b.quantity > 0
|
||
|
OR b.quantity IS NULL))
|
||
|
</select>
|
||
|
|
||
|
<insert id="insertZdyEateryOrderProduct" parameterType="ZdyEateryOrderProduct" useGeneratedKeys="true"
|
||
|
keyProperty="id">
|
||
|
insert into zdy_eatery_order_product
|
||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
<if test="refundId != null">refund_id,
|
||
|
</if>
|
||
|
<if test="orderId != null">order_id,
|
||
|
</if>
|
||
|
<if test="productId != null">product_id,
|
||
|
</if>
|
||
|
<if test="productName != null">product_name,
|
||
|
</if>
|
||
|
<if test="productImg != null">product_img,
|
||
|
</if>
|
||
|
<if test="productSpecsId != null">product_specs_id,
|
||
|
</if>
|
||
|
<if test="productSpecsName != null">product_specs_name,
|
||
|
</if>
|
||
|
<if test="productSpecsPrice != null">product_specs_price,
|
||
|
</if>
|
||
|
<if test="unit != null">unit,
|
||
|
</if>
|
||
|
<if test="productExtraId != null">product_extra_id,
|
||
|
</if>
|
||
|
<if test="productExtraName != null">product_extra_name,
|
||
|
</if>
|
||
|
<if test="productExtraPrice != null">product_extra_price,
|
||
|
</if>
|
||
|
<if test="productTasteId != null">product_taste_id,
|
||
|
</if>
|
||
|
<if test="productTasteName != null">product_taste_name,
|
||
|
</if>
|
||
|
<if test="productTastePrice != null">product_taste_price,
|
||
|
</if>
|
||
|
<if test="quantity != null">quantity,
|
||
|
</if>
|
||
|
<if test="returnableQuantity != null">returnable_quantity,
|
||
|
</if>
|
||
|
<if test="unitPrice != null">unit_price,
|
||
|
</if>
|
||
|
<if test="totalPrice != null">total_price,
|
||
|
</if>
|
||
|
<if test="finallyUnitPrice != null">finally_unit_price,
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by,
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time,
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by,
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time,
|
||
|
</if>
|
||
|
<if test="remark != null">remark,
|
||
|
</if>
|
||
|
<if test="merchantId != null">merchant_id,
|
||
|
</if>
|
||
|
</trim>
|
||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
<if test="refundId != null">#{refundId},
|
||
|
</if>
|
||
|
<if test="orderId != null">#{orderId},
|
||
|
</if>
|
||
|
<if test="productId != null">#{productId},
|
||
|
</if>
|
||
|
<if test="productName != null">#{productName},
|
||
|
</if>
|
||
|
<if test="productImg != null">#{productImg},
|
||
|
</if>
|
||
|
<if test="productSpecsId != null">#{productSpecsId},
|
||
|
</if>
|
||
|
<if test="productSpecsName != null">#{productSpecsName},
|
||
|
</if>
|
||
|
<if test="productSpecsPrice != null">#{productSpecsPrice},
|
||
|
</if>
|
||
|
<if test="unit != null">#{unit},
|
||
|
</if>
|
||
|
<if test="productExtraId != null">#{productExtraId},
|
||
|
</if>
|
||
|
<if test="productExtraName != null">#{productExtraName},
|
||
|
</if>
|
||
|
<if test="productExtraPrice != null">#{productExtraPrice},
|
||
|
</if>
|
||
|
<if test="productTasteId != null">#{productTasteId},
|
||
|
</if>
|
||
|
<if test="productTasteName != null">#{productTasteName},
|
||
|
</if>
|
||
|
<if test="productTastePrice != null">#{productTastePrice},
|
||
|
</if>
|
||
|
<if test="quantity != null">#{quantity},
|
||
|
</if>
|
||
|
<if test="returnableQuantity != null">#{returnableQuantity},
|
||
|
</if>
|
||
|
<if test="unitPrice != null">#{unitPrice},
|
||
|
</if>
|
||
|
<if test="totalPrice != null">#{totalPrice},
|
||
|
</if>
|
||
|
<if test="finallyUnitPrice != null">#{finallyUnitPrice},
|
||
|
</if>
|
||
|
<if test="createBy != null">#{createBy},
|
||
|
</if>
|
||
|
<if test="createTime != null">#{createTime},
|
||
|
</if>
|
||
|
<if test="updateBy != null">#{updateBy},
|
||
|
</if>
|
||
|
<if test="updateTime != null">#{updateTime},
|
||
|
</if>
|
||
|
<if test="remark != null">#{remark},
|
||
|
</if>
|
||
|
<if test="merchantId != null">#{merchantId},
|
||
|
</if>
|
||
|
</trim>
|
||
|
</insert>
|
||
|
|
||
|
<update id="updateZdyEateryOrderProduct" parameterType="ZdyEateryOrderProduct">
|
||
|
update zdy_eatery_order_product
|
||
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
<if test="orderId != null">order_id =
|
||
|
#{orderId},
|
||
|
</if>
|
||
|
<if test="productId != null">product_id =
|
||
|
#{productId},
|
||
|
</if>
|
||
|
<if test="productName != null">product_name =
|
||
|
#{productName},
|
||
|
</if>
|
||
|
<if test="productImg != null">product_img =
|
||
|
#{productImg},
|
||
|
</if>
|
||
|
<if test="productSpecsId != null">product_specs_id =
|
||
|
#{productSpecsId},
|
||
|
</if>
|
||
|
<if test="productSpecsName != null">product_specs_name =
|
||
|
#{productSpecsName},
|
||
|
</if>
|
||
|
<if test="unit != null">unit =
|
||
|
#{unit},
|
||
|
</if>
|
||
|
<if test="productSpecsPrice != null">product_specs_price =
|
||
|
#{productSpecsPrice},
|
||
|
</if>
|
||
|
<if test="productExtraId != null">product_extra_id =
|
||
|
#{productExtraId},
|
||
|
</if>
|
||
|
<if test="productExtraName != null">product_extra_name =
|
||
|
#{productExtraName},
|
||
|
</if>
|
||
|
<if test="productExtraPrice != null">product_extra_price =
|
||
|
#{productExtraPrice},
|
||
|
</if>
|
||
|
<if test="productTasteId != null">product_taste_id =
|
||
|
#{productTasteId},
|
||
|
</if>
|
||
|
<if test="productTasteName != null">product_taste_name =
|
||
|
#{productTasteName},
|
||
|
</if>
|
||
|
<if test="productTastePrice != null">product_taste_price =
|
||
|
#{productTastePrice},
|
||
|
</if>
|
||
|
<if test="quantity != null">quantity =
|
||
|
#{quantity},
|
||
|
</if>
|
||
|
<if test="returnableQuantity != null">returnable_quantity =
|
||
|
#{returnableQuantity},
|
||
|
</if>
|
||
|
<if test="finallyBuyQuantity != null">finally_buy_quantity =
|
||
|
#{finallyBuyQuantity},
|
||
|
</if>
|
||
|
<if test="unitPrice != null">unit_price =
|
||
|
#{unitPrice},
|
||
|
</if>
|
||
|
<if test="totalPrice != null">total_price =
|
||
|
#{totalPrice},
|
||
|
</if>
|
||
|
<if test="finallyUnitPrice != null">finally_unit_price =
|
||
|
#{finallyUnitPrice},
|
||
|
</if>
|
||
|
<if test="createBy != null">create_by =
|
||
|
#{createBy},
|
||
|
</if>
|
||
|
<if test="createTime != null">create_time =
|
||
|
#{createTime},
|
||
|
</if>
|
||
|
<if test="updateBy != null">update_by =
|
||
|
#{updateBy},
|
||
|
</if>
|
||
|
<if test="updateTime != null">update_time =
|
||
|
#{updateTime},
|
||
|
</if>
|
||
|
<if test="remark != null">remark =
|
||
|
#{remark},
|
||
|
</if>
|
||
|
<if test="merchantId != null">merchant_id =
|
||
|
#{merchantId},
|
||
|
</if>
|
||
|
</trim>
|
||
|
where id = #{id}
|
||
|
</update>
|
||
|
|
||
|
<delete id="deleteZdyEateryOrderProductById" parameterType="Long">
|
||
|
delete from zdy_eatery_order_product where id = #{id}
|
||
|
</delete>
|
||
|
|
||
|
<delete id="deleteZdyEateryOrderProductByIds" parameterType="String">
|
||
|
delete from zdy_eatery_order_product where id in
|
||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
#{id}
|
||
|
</foreach>
|
||
|
</delete>
|
||
|
</mapper>
|