chenlu
2024-02-03 894b5753bd3e331f791035b07b323523132176c8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.example.erp.controller.sd;
 
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.entity.sd.Order;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.sd.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
 
@RestController
@RequestMapping("/order")
public class OrderController {
    private final OrderService orderService;
 
    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }
 
 
    @PostMapping("/saveOrder")
    public Result saveOrder(@RequestBody Map<String, Object> orderMap) throws Exception {
        if(orderService.saveOrder(orderMap))    {
            return Result.seccess(true);
        }else{
            throw new ServiceException(Constants.Code_500,Constants.Code_msg);
        }
    }
 
    @PostMapping("/getOrderList/{pageNum}/{pageSize}/{orderType}/{selectDate}")
    public Result getOrderList(@PathVariable Integer pageNum, @PathVariable Integer pageSize,@PathVariable Integer orderType, @PathVariable List<String> selectDate, @RequestBody Order order)  {
        return Result.seccess(orderService.getOrderList(pageNum, pageSize, selectDate, order,orderType));
    }
}