新火炬后端单体项目初始化代码
Houjie
2 天以前 44b18be16f09b1d934ee7bc98a34d8bcf85d050e
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package org.jeecg.modules.mes.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.mes.entity.MesMaterialLoading;
import org.jeecg.modules.mes.service.IMesMaterialLoadingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
/**
 * @Description: 上料
 * @Author: jeecg-boot
 * @Date: 2025-07-07
 * @Version: V1.0
 */
@Api(tags = "上料")
@RestController
@RequestMapping("/mes/mesMaterialLoading")
@Slf4j
public class MesMaterialLoadingController extends JeecgController<MesMaterialLoading, IMesMaterialLoadingService> {
    @Autowired
    private IMesMaterialLoadingService mesMaterialLoadingService;
 
    /**
     * 分页列表查询
     *
     * @param mesMaterialLoading
     * @param pageNo
     * @param pageSize
     * @return
     */
    @ApiOperation(value = "上料-分页列表查询", notes = "上料-分页列表查询")
    @GetMapping(value = "/list")
    public Result<IPage<MesMaterialLoading>> queryPageList(MesMaterialLoading mesMaterialLoading,
                                                           @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
                                                           @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
        Page<MesMaterialLoading> page = new Page<>(pageNo, pageSize);
        IPage<MesMaterialLoading> pageList = mesMaterialLoadingService.queryPageList(page, mesMaterialLoading);
        return Result.OK(pageList);
    }
 
    /**
     *   添加
     *
     * @param mesMaterialLoading
     * @return
     */
    @AutoLog(value = "上料-添加")
    @ApiOperation(value = "上料-添加", notes = "上料-添加")
    @PostMapping(value = "/add")
    public Result<String> add(@RequestBody MesMaterialLoading mesMaterialLoading) {
        boolean b = mesMaterialLoadingService.loading(mesMaterialLoading);
        if (!b) {
            Result.error("上料失败!");
        }
        return Result.OK("上料成功!");
    }
 
    /**
     *  编辑
     *
     * @param mesMaterialLoading
     * @return
     */
    @AutoLog(value = "上料-编辑")
    @ApiOperation(value = "上料-编辑", notes = "上料-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<String> edit(@RequestBody MesMaterialLoading mesMaterialLoading) {
        mesMaterialLoadingService.updateById(mesMaterialLoading);
        return Result.OK("编辑成功!");
    }
 
    /**
     * 通过id查询
     *
     * @param id
     * @return
     */
    //@AutoLog(value = "上料-通过id查询")
    @ApiOperation(value = "上料-通过id查询", notes = "上料-通过id查询")
    @GetMapping(value = "/queryById")
    public Result<MesMaterialLoading> queryById(@RequestParam(name = "id", required = true) String id) {
        MesMaterialLoading mesMaterialLoading = mesMaterialLoadingService.getById(id);
        if (mesMaterialLoading == null) {
            return Result.error("未找到对应数据");
        }
        return Result.OK(mesMaterialLoading);
    }
 
    /**
     * 通过loadingId查询下料信息
     *
     * @param request
     * @param response
     * @return
     */
    @RequestMapping("/queryUnloadingByLoadingId")
    public Result<?> queryUnloadingByLoadingId(HttpServletRequest request, HttpServletResponse response) {
        String loadingId = request.getParameter("loadingId");
        return Result.OK(mesMaterialLoadingService.queryUnloadingByLoadingId(loadingId));
    }
}