前端 + 后端:创建订单,接入价格计算

This commit is contained in:
YunaiV
2019-04-20 19:59:08 +08:00
parent ff69f324d5
commit 5785827748
14 changed files with 119 additions and 175 deletions

View File

@@ -4,7 +4,7 @@
<sql id="FIELDS">
id, order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id,
quantity, price, pay_amount,
quantity, origin_price, buy_price, present_price, buy_total, discount_total, present_total,
payment_time, delivery_time, receiver_time, closing_time,
has_return_exchange, delivery_type, status,
create_time, update_time, deleted
@@ -13,20 +13,20 @@
<!--
插入数据
-->
<insert id="insert" parameterType="OrderItemDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
<insert id="insert" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO `order_item` (
order_id, order_no, sku_id, sku_name, sku_image, order_logistics_id,
quantity, price, pay_amount,
quantity, origin_price, buy_price, present_price, buy_total, discount_total, present_total,
payment_time, delivery_time, receiver_time, closing_time,
has_return_exchange, delivery_type, status,
create_time, update_time, deleted
) VALUES
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item.orderId}, #{item.orderNo}, #{item.skuId}, #{item.skuName}, #{item.skuImage}, #{item.orderLogisticsId},
#{item.quantity}, #{item.price}, #{item.payAmount},
<foreach collection="list" item="item" separator=",">
(#{item.orderId}, #{item.orderNo}, #{item.skuId}, #{item.skuName}, #{item.skuImage}, #{item.orderLogisticsId},
#{item.quantity}, #{item.originPrice}, #{item.buyPrice}, #{item.presentPrice}, #{item.buyTotal}, #{item.discountTotal}, #{item.presentTotal},
#{item.paymentTime}, #{item.deliveryTime}, #{item.receiverTime}, #{item.closingTime},
#{item.hasReturnExchange}, #{item.deliveryType}, #{item.status},
#{item.createTime}, #{item.updateTime}, #{item.deleted}
#{item.createTime}, #{item.updateTime}, #{item.deleted})
</foreach>
</insert>
@@ -56,12 +56,13 @@
<if test="orderItemDO.quantity != null">
, quantity = #{orderItemDO.quantity}
</if>
<if test="orderItemDO.price != null">
, price = #{orderItemDO.price}
</if>
<if test="orderItemDO.payAmount != null">
, pay_amount = #{orderItemDO.payAmount}
</if>
<!-- TODO 芋艿 需要改 -->
<!-- <if test="orderItemDO.price != null">-->
<!-- , price = #{orderItemDO.price}-->
<!-- </if>-->
<!-- <if test="orderItemDO.payAmount != null">-->
<!-- , pay_amount = #{orderItemDO.payAmount}-->
<!-- </if>-->
<if test="orderItemDO.paymentTime != null">
, payment_time = #{orderItemDO.paymentTime}

View File

@@ -3,7 +3,7 @@
<mapper namespace="cn.iocoder.mall.order.biz.dao.OrderMapper">
<sql id="FIELDS">
id, user_id, order_no, price, pay_amount, logistics_price,
id, user_id, order_no, buy_price, discount_price, logistics_price, present_price, pay_amount,
payment_time, delivery_time, receiver_time, closing_time,
has_return_exchange,
status, remark, create_time, update_time, `deleted`
@@ -14,12 +14,12 @@
-->
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
INSERT INTO `order` (
user_id, order_no, price, pay_amount, logistics_price,
user_id, order_no, buy_price, discount_price, logistics_price, present_price, pay_amount,
payment_time, delivery_time, receiver_time, closing_time,
has_return_exchange,
status, remark, create_time, update_time, `deleted`
) VALUES (
#{userId}, #{orderNo}, #{price}, #{payAmount}, #{logisticsPrice},
#{userId}, #{orderNo}, #{buyPrice}, #{discountPrice}, #{logisticsPrice}, #{presentPrice}, #{payAmount},
#{paymentTime}, #{deliveryTime}, #{receiverTime}, #{closingTime},
#{hasReturnExchange},
#{status}, #{remark}, #{createTime}, #{updateTime}, #{deleted}
@@ -34,15 +34,15 @@
<if test="orderNo != null">
, order_no = #{orderNo}
</if>
<if test="price != null">
, price = #{price}
</if>
<if test="payAmount != null">
, pay_amount = #{payAmount}
</if>
<if test="logisticsPrice != null">
, logistics_price = #{logisticsPrice}
</if>
<!-- <if test="price != null">--> <!-- TODO 后面要改下 -->
<!-- , price = #{price}-->
<!-- </if>-->
<!-- <if test="payAmount != null">-->
<!-- , pay_amount = #{payAmount}-->
<!-- </if>-->
<!-- <if test="logisticsPrice != null">-->
<!-- , logistics_price = #{logisticsPrice}-->
<!-- </if>-->
<if test="paymentTime != null">
, payment_time = #{paymentTime}
@@ -129,7 +129,7 @@
SELECT
COUNT(*)
FROM `order`
WHERE 1 = 1
WHERE 1 = 1 <!-- TODO 芋艿 不要 1=1 ,会有问题,使用 where 标签 -->
<include refid="selectWhere" />
</select>
@@ -140,10 +140,10 @@
SELECT
<include refid="FIELDS" />
FROM `order`
WHERE 1 = 1
WHERE 1 = 1 <!-- TODO 芋艿 不要 1=1 ,会有问题,使用 where 标签 -->
<include refid="selectWhere" />
LIMIT ${pageNo * pageSize}, ${pageSize}
</select>
</mapper>
</mapper>