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
package org.jeecg.modules.eam.controller;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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.system.api.ISysBaseAPI;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
 
import org.jeecg.modules.eam.entity.ProcessParameters;
import org.jeecg.modules.eam.entity.ProcessParametersTemplate;
import org.jeecg.modules.eam.entity.ProcessParametersTemplateDetail;
import org.jeecg.modules.eam.service.IProcessParametersCategoryService;
import org.jeecg.modules.eam.service.IProcessParametersService;
import org.jeecg.modules.eam.service.IProcessParametersTemplateDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.util.List;
 
/**
 * @Description: 工艺参数模板明细
 * @Author: cj
 * @Date: 2023-03-23
 * @Version: V1.0
 */
@Api(tags = "工艺参数模板明细")
@RestController
@RequestMapping("/eam/processParametersTemplateDetail")
@Slf4j
public class ProcessParametersTemplateDetailController extends JeecgController<ProcessParametersTemplateDetail, IProcessParametersTemplateDetailService> {
 
    @Autowired
    private IProcessParametersService processParametersService;
    @Autowired
    private IProcessParametersTemplateDetailService processParametersTemplateDetailService;
    @Autowired
    private IProcessParametersCategoryService processParametersCategoryService;
//    @Autowired
//    private IUnitService unitService;
 
    @Autowired
    private ISysBaseAPI sysBaseApi;
 
    /**
     * 分页列表查询
     *
     * @param processParametersTemplateDetail
     * @param pageNo
     * @param pageSize
     * @param req
     * @return
     */
    @ApiOperation(value = "工艺参数模板明细-分页列表查询")
    @GetMapping(value = "/listByProcessParametersTemplateId")
    public Result<IPage<ProcessParametersTemplateDetail>> listByProcessParametersTemplateId(ProcessParametersTemplateDetail processParametersTemplateDetail, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
        QueryWrapper<ProcessParametersTemplateDetail> queryWrapper = QueryGenerator.initQueryWrapper(processParametersTemplateDetail, req.getParameterMap());
        Page<ProcessParametersTemplateDetail> page = new Page<ProcessParametersTemplateDetail>(pageNo, pageSize);
        IPage<ProcessParametersTemplateDetail> pageList = processParametersTemplateDetailService.page(page, queryWrapper);
        List<ProcessParametersTemplateDetail> records = pageList.getRecords();
        for (ProcessParametersTemplateDetail record : records) {
            ProcessParameters processParameters = processParametersService.getById(record.getProcessParametersId());
            record.setProcessParametersNum(processParameters.getNum());
            record.setProcessParametersName(processParameters.getName());
            record.setProcessParametersCategory(processParametersCategoryService.getById(processParameters.getProcessParametersCategoryId()).getName());
            String unitName = sysBaseApi.getUnitNameById(processParameters.getUnitId());
            record.setUnit(unitName);
        }
        return Result.OK(pageList);
    }
 
}