文章目录
-
- 概要
- 整体架构流程
- 技术细节
- 小结
概要
商家接单是电子商务、外卖平台、在线零售等多个行业中的一项核心业务流程。这项功能允许商家接收来自客户的订单,并对其进行处理。
需求分析以及接口设计
技术细节
1.Controller层:
/*** 接单* @param orderConfirmDTO* @return*/@ApiOperation("接单")@PutMapping("/confirm")public Result confirm(@RequestBody OrdersConfirmDTO orderConfirmDTO){log.info("接单,{}",orderConfirmDTO);orderService.confirm(orderConfirmDTO);return Result.success();}
2.Service层:
public void confirm(OrdersConfirmDTO orderConfirmDTO) {Orders orders = new Orders();orders.setId(orderConfirmDTO.getId());orders.setStatus(Orders.CONFIRMED);//更新此订单orderMapper.update(orders);}
3.Mapper层:
<update id="update" parameterType="com.sky.entity.Orders">update orders<set><if test="cancelReason != null and cancelReason!='' ">cancel_reason=#{cancelReason},</if><if test="rejectionReason != null and rejectionReason!='' ">rejection_reason=#{rejectionReason},</if><if test="cancelTime != null">cancel_time=#{cancelTime},</if><if test="payStatus != null">pay_status=#{payStatus},</if><if test="payMethod != null">pay_method=#{payMethod},</if><if test="checkoutTime != null">checkout_time=#{checkoutTime},</if><if test="status != null">status = #{status},</if><if test="deliveryTime != null">delivery_time = #{deliveryTime}</if></set>where id = #{id}</update>