李雨欣 8.26 21:58 测试查询

master
liyuxin 2024-08-26 21:58:48 +08:00
parent 1fe805b675
commit fd3647778c
14 changed files with 51803 additions and 68 deletions

View File

@ -25,7 +25,7 @@ import java.util.Date;
@NoArgsConstructor @NoArgsConstructor
@TableName(value = "订单表",autoResultMap = true) @TableName(value = "订单表",autoResultMap = true)
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class Order extends BaseEntity { public class Orders extends BaseEntity {
/** /**

View File

@ -49,11 +49,6 @@ public class Product extends BaseEntity {
*/ */
@Excel(name = "库存数量") @Excel(name = "库存数量")
private String stock; private String stock;
/**
*
*/
@Excel(name = "订单号")
private String orderNo;
/** /**
* *
*/ */

View File

@ -2,7 +2,6 @@ package com.muyu.market.admain.response;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -17,7 +16,7 @@ import java.math.BigDecimal;
@NoArgsConstructor @NoArgsConstructor
@SuperBuilder @SuperBuilder
@Tag(name = "订单查询", description = "订单查询") @Tag(name = "订单查询", description = "订单查询")
public class OrderSelectResp { public class OrdersSelectResp {
/** /**
* *

View File

@ -1,7 +1,6 @@
package com.muyu.market.admain.response; package com.muyu.market.admain.response;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.muyu.common.core.annotation.Excel;
import com.muyu.market.admain.Product; import com.muyu.market.admain.Product;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;

View File

@ -1,33 +0,0 @@
package com.muyu.market.server.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.market.admain.Product;
import com.muyu.market.server.service.OrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Log4j2
@RestController
@RequestMapping("order")
@Tag(name = "订单控制层",description = "进行订单的查询和添加")
public class OrderController {
@Autowired
private OrderService orderService;
@PostMapping("/orders")
@Operation(summary = "订单添加",description = "添加添加订单")
public Result<String> creatOrder(@RequestBody Product product){
orderService.saveOrder(product);
return Result.success();
}
}

View File

@ -0,0 +1,54 @@
package com.muyu.market.server.controller;
import com.muyu.common.core.domain.Result;
import com.muyu.market.admain.Orders;
import com.muyu.market.admain.Product;
import com.muyu.market.admain.response.OrdersSelectResp;
import com.muyu.market.server.service.OrdersService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Log4j2
@RestController
@RequestMapping("order")
@Tag(name = "订单控制层",description = "进行订单的查询和添加")
public class OrdersController {
@Autowired
private OrdersService orderService;
/**
*
* @param product
* @return
*/
@PostMapping("/orders")
@Operation(summary = "订单添加",description = "添加添加订单")
public Result<String> creatOrder(@RequestBody Product product){
orderService.saveOrder(product);
return Result.success();
}
/**
*
* @param ordersSelectResp
* @return
*/
@RequestMapping(path = "/orderSelect",method = RequestMethod.POST)
@Operation(summary = "查询订单",description = "根据接口查看订单信息")
public Result<List<OrdersSelectResp>> findByorderList(@RequestBody OrdersSelectResp ordersSelectResp){
return Result.success(orderService.findByorderList(ordersSelectResp));
}
}

View File

@ -1,9 +0,0 @@
package com.muyu.market.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.market.admain.Order;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface OrderMapper extends BaseMapper<Order> {
}

View File

@ -0,0 +1,14 @@
package com.muyu.market.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.market.admain.Orders;
import com.muyu.market.admain.response.OrdersSelectResp;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface OrdersMapper extends BaseMapper<Orders> {
List<OrdersSelectResp> findByorderList(OrdersSelectResp ordersSelectResp);
}

View File

@ -1,26 +1,28 @@
package com.muyu.market.server.service.Impl; package com.muyu.market.server.service.Impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.market.admain.Order; import com.muyu.market.admain.Orders;
import com.muyu.market.admain.Product; import com.muyu.market.admain.Product;
import com.muyu.market.server.mapper.OrderMapper; import com.muyu.market.admain.response.OrdersSelectResp;
import com.muyu.market.server.service.OrderService; import com.muyu.market.server.mapper.OrdersMapper;
import com.muyu.market.server.service.OrdersService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.muyu.common.security.utils.SecurityUtils; import com.muyu.common.security.utils.SecurityUtils;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.UUID; import java.util.UUID;
@Service @Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService { public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {
@Autowired @Autowired
private OrderMapper orderMapper; private OrdersMapper orderMapper;
@Override @Override
public void saveOrder(Product product) { public void saveOrder(Product product) {
Order order = new Order(); Orders order = new Orders();
//获取用户ID //获取用户ID
Long userId = SecurityUtils.getUserId(); Long userId = SecurityUtils.getUserId();
order.setUserId(userId); order.setUserId(userId);
@ -48,5 +50,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
} catch (Exception e) { } catch (Exception e) {
} }
} }
@Override
public List<OrdersSelectResp> findByorderList(OrdersSelectResp ordersSelectResp) {
return orderMapper.findByorderList(ordersSelectResp);
}
} }

View File

@ -1,11 +0,0 @@
package com.muyu.market.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.market.admain.Order;
import com.muyu.market.admain.Product;
public interface OrderService extends IService<Order> {
void saveOrder(Product product);
}

View File

@ -0,0 +1,16 @@
package com.muyu.market.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.market.admain.Orders;
import com.muyu.market.admain.Product;
import com.muyu.market.admain.response.OrdersSelectResp;
import java.util.List;
public interface OrdersService extends IService<Orders> {
void saveOrder(Product product);
List<OrdersSelectResp> findByorderList(OrdersSelectResp ordersSelectResp);
}

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.muyu.market.server.mapper.OrdersMapper">
<select id="findByorderList" resultType="com.muyu.market.admain.response.OrdersSelectResp">
SELECT
orders.*,
sys_user.user_name,
product.product_name,
product.product_price,
product.description,
product.`status`
FROM
orders
LEFT JOIN sys_user ON orders.order_id = sys_user.user_id
LEFT JOIN product ON orders.order_id = product.product_id
</select>
</mapper>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff