商品下单
This commit is contained in:
@@ -47,12 +47,13 @@
|
||||
<insert id="insertOrder" parameterType="com.cxyxiaomo.epp.common.pojo.Order" useGeneratedKeys="true"
|
||||
keyProperty="orderId">
|
||||
INSERT INTO `order` (id, user_id, order_date, order_status, order_price)
|
||||
VALUES (#{id}, #{userId}, #{orderDate,javaType=java.time.LocalDateTime,jdbcType=TIMESTAMP}, #{orderStatus}, #{orderPrice})
|
||||
VALUES (#{id}, #{userId}, #{orderDate,javaType=java.time.LocalDateTime,jdbcType=TIMESTAMP}, #{orderStatus},
|
||||
#{orderPrice})
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入订单详情 -->
|
||||
<insert id="batchInsertOrderDetail" parameterType="java.util.List">
|
||||
INSERT INTO order_detail (order_id, good_id, good_count, unit_price)
|
||||
INSERT INTO `order_detail` (order_id, good_id, good_count, unit_price)
|
||||
VALUES
|
||||
<if test="list != null and list.size() > 0">
|
||||
<foreach collection="list" item="detail" separator=",">
|
||||
@@ -65,18 +66,19 @@
|
||||
</insert>
|
||||
|
||||
<update id="updateOrderStatus" parameterType="com.cxyxiaomo.epp.common.pojo.Order">
|
||||
UPDATE order
|
||||
SET order_status=#{orderStatus}
|
||||
WHERE order_id = #{orderId}
|
||||
UPDATE `order`
|
||||
SET order_status = #{orderStatus}
|
||||
WHERE id = #{orderId} LIMIT 1
|
||||
</update>
|
||||
|
||||
<!-- 根据订单 ID 删除订单信息及订单详情信息 -->
|
||||
<delete id="deleteOrderById" parameterType="java.lang.Integer">
|
||||
DELETE
|
||||
FROM order
|
||||
WHERE order_id = #{orderId};
|
||||
DELETE
|
||||
FROM goods_order_details
|
||||
WHERE order_id = #{orderId};
|
||||
FROM `order`
|
||||
WHERE id = #{orderId};
|
||||
-- 级联删除,无需手动删除订单详情
|
||||
-- DELETE
|
||||
-- FROM goods_order_details
|
||||
-- WHERE order_id = #{orderId};
|
||||
</delete>
|
||||
</mapper>
|
||||
|
Reference in New Issue
Block a user