- 添加 item 删除
- 添加 item 更新 - 添加 错误定义 - 添加 order common
This commit is contained in:
@@ -3,8 +3,9 @@
|
||||
<mapper namespace="cn.iocoder.mall.order.dao.OrderItemMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, order_id, commodity_id, quantity, price,
|
||||
status, deliveryTime
|
||||
id, order_id, order_no, sku_id, quantity, price,
|
||||
payment_time, delivery_time, receiver_time, closing_time,
|
||||
has_return_exchange, status, create_time, update_time, deleted
|
||||
</sql>
|
||||
|
||||
<!--
|
||||
@@ -12,12 +13,101 @@
|
||||
-->
|
||||
<insert id="insert" parameterType="OrderItemDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO `order_item` (
|
||||
order_id, commodity_id, quantity, price,
|
||||
status, deliveryTime
|
||||
order_id, order_no, sku_id, quantity, price,
|
||||
payment_time, delivery_time, receiver_time, closing_time,
|
||||
has_return_exchange, status, create_time, update_time, deleted
|
||||
) VALUES (
|
||||
#{orderId}, #{commodityId}, #{quantity}, #{price},
|
||||
#{status}, #{deliveryTime}
|
||||
#{orderId}, #{orderNo}, #{skuId}, #{quantity}, #{price},
|
||||
#{paymentTime}, #{deliveryTime}, #{receiverTime}, #{closingTime},
|
||||
#{hasReturnExchange}, #{status},
|
||||
#{createTime}, #{updateTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
<!--
|
||||
更新 - 可更新的字段
|
||||
-->
|
||||
<sql id="updateFieldSql" >
|
||||
<set>
|
||||
<if test="orderId != null">
|
||||
, order_id = #{orderId}
|
||||
</if>
|
||||
<if test="orderNo != null">
|
||||
, order_no = #{orderNo}
|
||||
</if>
|
||||
<if test="skuId != null">
|
||||
, sku_id = #{skuId}
|
||||
</if>
|
||||
<if test="quantity != null">
|
||||
, quantity = #{quantity}
|
||||
</if>
|
||||
<if test="price != null">
|
||||
, price = #{price}
|
||||
</if>
|
||||
-- time
|
||||
<if test="paymentTime != null">
|
||||
, payment_time = #{paymentTime}
|
||||
</if>
|
||||
<if test="deliveryTime != null">
|
||||
, delivery_time = #{deliveryTime}
|
||||
</if>
|
||||
<if test="receiverTime != null">
|
||||
, receiver_time = #{receiverTime}
|
||||
</if>
|
||||
<if test="closingTime != null">
|
||||
, closing_time = #{closingTime}
|
||||
</if>
|
||||
-- other
|
||||
<if test="hasReturnExchange != null">
|
||||
, has_return_exchange = #{hasReturnExchange}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
, status = #{status}
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
, `deleted` = #{deleted}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
, create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
, update_time = #{updateTime}
|
||||
</if>
|
||||
</set>
|
||||
</sql>
|
||||
|
||||
<!--
|
||||
更新 - 根据 id 更新
|
||||
-->
|
||||
<update id="updateById" parameterType="OrderDO">
|
||||
UPDATE `order_item`
|
||||
<include refid="updateFieldSql" />
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!--
|
||||
更新 - 根据 ids 更新
|
||||
-->
|
||||
<update id="updateByIds">
|
||||
UPDATE `order_item`
|
||||
<include refid="updateFieldSql" />
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!--
|
||||
查询 - 根据 orderId 下的 item
|
||||
-->
|
||||
<select id="selectByOrderIdAndDeleted" resultType="cn.iocoder.mall.order.dataobject.OrderItemDO">
|
||||
SELECT * FROM `order_item`
|
||||
WHERE 1=1
|
||||
<if test="deleted">
|
||||
AND deleted = #{deleted}
|
||||
</if>
|
||||
<if test="orderId">
|
||||
AND order_id = #{orderId}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -11,11 +11,42 @@
|
||||
-->
|
||||
<insert id="insert" parameterType="OrderLogisticsDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO `order_logistics` (
|
||||
area_no, `name`, mobile, address, logistics_no
|
||||
area_no, `name`, mobile, address, logistics_no, create_time, update_time
|
||||
) VALUES (
|
||||
#{areaNo}, #{name}, #{mobile}, #{address},
|
||||
#{logisticsNo}
|
||||
#{logisticsNo}, #{createTime}, #{updateTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!--
|
||||
可更新字段
|
||||
-->
|
||||
<sql id="updateFieldSql" >
|
||||
<set>
|
||||
<if test="areaNo != null">
|
||||
, area_no = #{areaNo}
|
||||
</if>
|
||||
<if test="name != null">
|
||||
, `name` = #{name}
|
||||
</if>
|
||||
<if test="mobile != null">
|
||||
, mobile = #{mobile}
|
||||
</if>
|
||||
<if test="address != null">
|
||||
, address = #{address}
|
||||
</if>
|
||||
<if test="logisticsNo != null">
|
||||
, logistics_no = #{logisticsNo}
|
||||
</if>
|
||||
</set>
|
||||
</sql>
|
||||
|
||||
<!--
|
||||
更新 - 根据id
|
||||
-->
|
||||
<update id="updateById">
|
||||
UPDATE `order_logistics`
|
||||
<include refid="updateFieldSql" />
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -3,9 +3,9 @@
|
||||
<mapper namespace="cn.iocoder.mall.order.dao.OrderMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, order_logistics_id, order_no, price, payment_time,
|
||||
id, order_logistics_id, order_no, money, payment_time,
|
||||
delivery_time, receiver_time, closing_time, has_return_exchange,
|
||||
status, remark
|
||||
status, remark, create_time, update_time, `delete`
|
||||
</sql>
|
||||
|
||||
<!--
|
||||
@@ -13,20 +13,22 @@
|
||||
-->
|
||||
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||
INSERT INTO `order` (
|
||||
order_logistics_id, order_no, price, payment_time,
|
||||
order_logistics_id, order_no, money, payment_time,
|
||||
delivery_time, receiver_time, closing_time,
|
||||
has_return_exchange, status, remark
|
||||
has_return_exchange, status, remark,
|
||||
create_time, update_time, `deleted`
|
||||
) VALUES (
|
||||
#{orderLogisticsId}, ${orderNo}, #{price}, #{paymentTime},
|
||||
#{orderLogisticsId}, #{orderNo}, #{money}, #{paymentTime},
|
||||
#{deliveryTime}, #{receiverTime}, #{closingTime},
|
||||
#{hasReturnExchange}, #{status}, #{remark}
|
||||
#{hasReturnExchange}, #{status}, #{remark},
|
||||
#{createTime}, #{updateTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!--
|
||||
更新 - 可更新的字段
|
||||
-->
|
||||
<sql id="updateSql" >
|
||||
<sql id="updateFieldSql" >
|
||||
<set>
|
||||
<if test="orderLogisticsId != null">
|
||||
, order_logistics_id = #{orderLogisticsId}
|
||||
@@ -34,8 +36,8 @@
|
||||
<if test="orderNo != null">
|
||||
, order_no = #{orderNo}
|
||||
</if>
|
||||
<if test="price != null">
|
||||
, price = #{price}
|
||||
<if test="money != null">
|
||||
, money = #{money}
|
||||
</if>
|
||||
-- time
|
||||
<if test="paymentTime != null">
|
||||
@@ -57,8 +59,11 @@
|
||||
<if test="status != null">
|
||||
, status = #{status}
|
||||
</if>
|
||||
<if test="delete != null">
|
||||
, `delete` = #{delete}
|
||||
<if test="remark != null">
|
||||
, remark = #{remark}
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
, `deleted` = #{deleted}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
, create_time = #{createTime}
|
||||
@@ -66,9 +71,6 @@
|
||||
<if test="updateTime != null">
|
||||
, update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
, remark = #{remark}
|
||||
</if>
|
||||
</set>
|
||||
</sql>
|
||||
|
||||
@@ -77,7 +79,7 @@
|
||||
-->
|
||||
<update id="updateById" parameterType="OrderDO">
|
||||
UPDATE `order`
|
||||
<include refid="updateSql" />
|
||||
<include refid="updateFieldSql" />
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user