删除订单

This commit is contained in:
2024-09-02 15:51:24 +08:00
parent b3850469ec
commit 556123aab4
4 changed files with 32 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
package com.chaozhanggui.system.cashierservice.controller;
import cn.hutool.core.util.ObjectUtil;
import com.chaozhanggui.system.cashierservice.entity.TbShopTable;
import com.chaozhanggui.system.cashierservice.entity.dto.OrderDto;
import com.chaozhanggui.system.cashierservice.service.OrderService;
@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.IOException;
import java.text.ParseException;
import java.util.Map;
@CrossOrigin(origins = "*")
@RestController
@@ -51,6 +53,14 @@ public class OrderController {
return orderService.orderList(userId,page,size,status);
}
@PostMapping("/rmOrder")
private Result rmOrder(@RequestBody Map<String, Object> map){
if (ObjectUtil.isEmpty(map) || map.size() <= 0 || !map.containsKey("orderId") || ObjectUtil.isEmpty(map.get("orderId"))) {
return Result.fail("订单号不允许为空");
}
return orderService.rmOrder(Integer.valueOf(map.get("orderId").toString()));
}
@GetMapping("/tradeIntegral")
private Result tradeIntegral(@RequestParam("userId") String userId, @RequestParam("id") String id) throws IOException, ParseException {
return orderService.tradeIntegral(userId,id);

View File

@@ -11,6 +11,10 @@ import java.util.List;
@Component
@Mapper
public interface TbOrderInfoMapper {
/**
* 逻辑删除
*/
int deleteByPrimaryKey(Integer id);
int insert(TbOrderInfo record);

View File

@@ -212,6 +212,14 @@ public class OrderService {
return Result.success(CodeEnum.ENCRYPT, orderVo);
}
public Result rmOrder(Integer orderId) {
int i = orderInfoMapper.deleteByPrimaryKey(orderId);
if (i > 0) {
return Result.success(CodeEnum.SUCCESS);
}
return Result.fail("删除失败");
}
public Result orderList(Integer userId, Integer page, Integer size, String status) {
// TbUserInfo tbUserInfo = userInfoMapper.selectByPrimaryKey(userId);

View File

@@ -65,10 +65,15 @@
from tb_order_info
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from tb_order_info
where id = #{id,jdbcType=INTEGER}
</delete>
<!-- <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">-->
<!-- delete from tb_order_info-->
<!-- where id = #{id,jdbcType=INTEGER}-->
<!-- </delete>-->
<update id="deleteByPrimaryKey" parameterType="java.lang.Integer">
update tb_order_info
set is_del = 1
where id = #{id,jdbcType=INTEGER}
</update>
<insert id="insert" parameterType="com.chaozhanggui.system.cashierservice.entity.TbOrderInfo"
useGeneratedKeys="true" keyProperty="id">
@@ -550,6 +555,7 @@
where user_id = #{userId}
and order_type='miniapp'
and is_del != 1
<if test="status != null and status != ''">
<choose>
<when test="status == 'unpaid'">