Blame view

src/main/java/com/order/erp/controller/OrderController.java 4.88 KB
“谢茂盛” authored
1
2
3
4
package com.order.erp.controller;

import com.order.erp.common.annotation.AnonymousAccess;
import com.order.erp.common.constant.ServerResult;
5
import com.order.erp.common.excel4j.exceptions.Excel4JException;
6
7
8
import com.order.erp.common.exception.BusinessException;
import com.order.erp.domain.vo.order.*;
import com.order.erp.mapper.order.OrderBaseInfoMapper;
“谢茂盛” authored
9
import com.order.erp.service.order.OrderBaseInfoService;
谢茂盛 authored
10
11
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
12
import org.springframework.beans.factory.annotation.Autowired;
“谢茂盛” authored
13
14
15
16
17
18
19
import org.springframework.validation.annotation.Validated;
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;

import javax.annotation.Resource;
20
21
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
22
import java.util.Objects;
“谢茂盛” authored
23
24
25
26
27
28
29

/**
 * 订单基础信息表(OrderBaseInfo)表控制层
 *
 * @author makejava
 * @since 2023-09-08 15:26:43
 */
谢茂盛 authored
30
@Api(tags = "订单管理")
“谢茂盛” authored
31
32
33
34
35
36
37
38
39
@RestController
@RequestMapping("/order/erp/order")
public class OrderController {
    /**
     * 服务对象
     */
    @Resource
    private OrderBaseInfoService orderBaseInfoService;
40
41
42
    @Resource
    private OrderBaseInfoMapper orderBaseInfoMapper;
“谢茂盛” authored
43
44
45
46
47
48
49
    /**
     * 分页查询
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 查询结果
     */
    @PostMapping("/list_by_page")
谢茂盛 authored
50
    @ApiOperation("分页查询")
“谢茂盛” authored
51
52
53
54
55
56
    @AnonymousAccess
    public ServerResult listByPage(@RequestBody @Validated OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
        return orderBaseInfoService.listByPage(orderBaseInfoQueryVO);
    }

    /**
57
58
59
60
61
     * 导出订单
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 查询结果
     */
62
    @PostMapping(value = "/export")
谢茂盛 authored
63
    @ApiOperation("导出订单")
64
    @AnonymousAccess
65
66
    public void export(HttpServletResponse response, @RequestBody @Validated OrderBaseInfoQueryVO orderBaseInfoQueryVO) throws IOException, Excel4JException {
        orderBaseInfoService.export(response, orderBaseInfoQueryVO);
67
68
69
    }

    /**
“谢茂盛” authored
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
     * 通过主键查询单条数据
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 单条数据
     */
    @PostMapping("/query_by_id")
    public ServerResult queryById(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
        return orderBaseInfoService.queryById(orderBaseInfoQueryVO);
    }

    /**
     * 新增数据
     *
     * @param orderAddVO 数据VO
     * @return 新增结果
     */
    @PostMapping("/add")
谢茂盛 authored
87
    @ApiOperation("新增数据")
“谢茂盛” authored
88
89
90
91
92
93
    @AnonymousAccess
    public ServerResult add(@RequestBody OrderAddVO orderAddVO) {
        return orderBaseInfoService.add(orderAddVO);
    }

    /**
“谢茂盛” authored
94
95
96
97
98
99
     * 字段解锁申请
     *
     * @param fieldVO 查询条件
     * @return 查询结果
     */
    @PostMapping("/field_unlock_apply")
谢茂盛 authored
100
    @ApiOperation("字段解锁申请")
“谢茂盛” authored
101
102
103
104
105
106
107
    @AnonymousAccess
    public ServerResult fieldUnlockApply(@RequestBody @Validated OrderUnlockFieldApplyVO fieldVO) {
        return orderBaseInfoService.fieldUnlockApply(fieldVO);
    }


    /**
“谢茂盛” authored
108
109
     * 编辑数据
     *
110
     * @param updateVO 数据VO
“谢茂盛” authored
111
112
     * @return 编辑结果
     */
谢茂盛 authored
113
    @ApiOperation("编辑数据")
“谢茂盛” authored
114
    @PostMapping("/edit")
115
116
    public ServerResult edit(@RequestBody OrderUpdateVO updateVO) {
        return orderBaseInfoService.edit(updateVO);
“谢茂盛” authored
117
118
119
120
121
122
123
124
    }

    /**
     * 删除数据
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 删除是否成功
     */
谢茂盛 authored
125
    @ApiOperation("删除数据")
“谢茂盛” authored
126
127
128
129
    @PostMapping("/delete_by_id")
    public ServerResult deleteById(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
        return orderBaseInfoService.deleteById(orderBaseInfoQueryVO);
    }
130
131
132
133
134
135
136
137
138
139

    /**
     * @param dto
     * @return ServerResult
     * @Description: 查询项目号或者内部编号
     * @Author wmr
     * @CreateTime 2023/12/21 14:50
     */
    @ApiOperation("查询项目号或者内部编号")
    @PostMapping("/queryProjectNoAndInnerNo")
140
    public ServerResult queryProjectNoAndInnerNo(@RequestBody QueryProjectNoAndInnerNoDto dto) {
141
142
143
144
145
        if (Objects.isNull(dto.getProjectNo()) && Objects.isNull(dto.getInnerNo())) {
            throw new BusinessException("请传入项目号或内部编号");
        }
        return ServerResult.success(orderBaseInfoMapper.queryProjectNoAndInnerNoDto(dto.getInnerNo() == null ? Boolean.TRUE : Boolean.FALSE, dto));
    }
qdlgxiemaosheng authored
146
147
148
149
150
151
152
153
154
155
156
157
158

    /**
     * 校验是否重复
     *
     * @param orderBaseInfoQueryVO 查询条件
     * @return 查询结果
     */
    @PostMapping("/check")
    @ApiOperation("校验是否重复")
    @AnonymousAccess
    public ServerResult check(@RequestBody OrderBaseInfoQueryVO orderBaseInfoQueryVO) {
        return orderBaseInfoService.check(orderBaseInfoQueryVO);
    }
“谢茂盛” authored
159
160
}