李雨欣 8.26 21:58 测试查询
parent
1fe805b675
commit
fd3647778c
|
@ -25,7 +25,7 @@ import java.util.Date;
|
|||
@NoArgsConstructor
|
||||
@TableName(value = "订单表",autoResultMap = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Order extends BaseEntity {
|
||||
public class Orders extends BaseEntity {
|
||||
|
||||
|
||||
/**
|
|
@ -49,11 +49,6 @@ public class Product extends BaseEntity {
|
|||
*/
|
||||
@Excel(name = "库存数量")
|
||||
private String stock;
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
@Excel(name = "订单号")
|
||||
private String orderNo;
|
||||
/**
|
||||
* 商品描述
|
||||
*/
|
||||
|
|
|
@ -2,7 +2,6 @@ package com.muyu.market.admain.response;
|
|||
|
||||
|
||||
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.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -17,7 +16,7 @@ import java.math.BigDecimal;
|
|||
@NoArgsConstructor
|
||||
@SuperBuilder
|
||||
@Tag(name = "订单查询", description = "订单查询")
|
||||
public class OrderSelectResp {
|
||||
public class OrdersSelectResp {
|
||||
|
||||
/**
|
||||
* 订单的唯一标识
|
|
@ -1,7 +1,6 @@
|
|||
package com.muyu.market.admain.response;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.market.admain.Product;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -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> {
|
||||
}
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -1,26 +1,28 @@
|
|||
package com.muyu.market.server.service.Impl;
|
||||
|
||||
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.server.mapper.OrderMapper;
|
||||
import com.muyu.market.server.service.OrderService;
|
||||
import com.muyu.market.admain.response.OrdersSelectResp;
|
||||
import com.muyu.market.server.mapper.OrdersMapper;
|
||||
import com.muyu.market.server.service.OrdersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@Service
|
||||
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
|
||||
public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, Orders> implements OrdersService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private OrderMapper orderMapper;
|
||||
private OrdersMapper orderMapper;
|
||||
|
||||
@Override
|
||||
public void saveOrder(Product product) {
|
||||
|
||||
Order order = new Order();
|
||||
Orders order = new Orders();
|
||||
//获取用户ID
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
order.setUserId(userId);
|
||||
|
@ -48,5 +50,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrdersSelectResp> findByorderList(OrdersSelectResp ordersSelectResp) {
|
||||
return orderMapper.findByorderList(ordersSelectResp);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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);
|
||||
}
|
|
@ -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>
|
45535
logs/cloud-pay/error.log
45535
logs/cloud-pay/error.log
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue