-
懒羊羊
2024-03-28 55a52ebc929a3ebf2e8dbae450c0c241abf7ff02
提交 | 用户 | 时间
523903 1 package com.jcdm.main.em.inspectionPlanTask.controller;
2
3 import java.util.List;
55a52e 4 import java.util.stream.Collectors;
523903 5 import javax.servlet.http.HttpServletResponse;
55a52e 6
7 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
8 import org.aspectj.weaver.loadtime.Aj;
523903 9 import org.springframework.security.access.prepost.PreAuthorize;
10 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.web.bind.annotation.GetMapping;
12 import org.springframework.web.bind.annotation.PostMapping;
13 import org.springframework.web.bind.annotation.PutMapping;
14 import org.springframework.web.bind.annotation.DeleteMapping;
15 import org.springframework.web.bind.annotation.PathVariable;
16 import org.springframework.web.bind.annotation.RequestBody;
17 import org.springframework.web.bind.annotation.RequestMapping;
18 import org.springframework.web.bind.annotation.RestController;
19 import com.jcdm.common.annotation.Log;
20 import com.jcdm.common.core.controller.BaseController;
21 import com.jcdm.common.core.domain.AjaxResult;
22 import com.jcdm.common.enums.BusinessType;
23 import com.jcdm.main.em.inspectionPlanTask.domain.EmInspectionPlanTask;
24 import com.jcdm.main.em.inspectionPlanTask.service.IEmInspectionPlanTaskService;
25 import com.jcdm.common.utils.poi.ExcelUtil;
26 import com.jcdm.common.core.page.TableDataInfo;
27
28 /**
29  * 点检任务Controller
30  * 
31  * @author Yi
32  * @date 2024-03-23
33  */
34 @RestController
35 @RequestMapping("/em/inspectionPlanTask")
36 public class EmInspectionPlanTaskController extends BaseController
37 {
38     @Autowired
39     private IEmInspectionPlanTaskService emInspectionPlanTaskService;
40
41     /**
e20d73 42      * 查询点检任务列表不分页
43      */
44     @PostMapping("/noPageList")
45     public AjaxResult noPageList()
46     {
47         List<EmInspectionPlanTask> list = emInspectionPlanTaskService.list();
48         return AjaxResult.success(list);
49     }
50
55a52e 51     @GetMapping("/getListLikeDevices")
52     public AjaxResult getListLikeDevices(EmInspectionPlanTask emInspectionPlanTask)
53     {
54         List<EmInspectionPlanTask> list = emInspectionPlanTaskService.list(new LambdaQueryWrapper<EmInspectionPlanTask>()
55                 .select(EmInspectionPlanTask::getDevicesCode)
56                 .like(EmInspectionPlanTask::getDevicesCode,emInspectionPlanTask.getDevicesCode())
57                 .groupBy(EmInspectionPlanTask::getDevicesCode));
58         List<String> collect = list.stream().map(EmInspectionPlanTask::getDevicesCode).collect(Collectors.toList());
59
60         return AjaxResult.success(collect);
61     }
62
e20d73 63     /**
523903 64      * 查询点检任务列表
65      */
66     @PreAuthorize("@ss.hasPermi('em:inspectionPlanTask:list')")
67     @GetMapping("/list")
68     public TableDataInfo list(EmInspectionPlanTask emInspectionPlanTask)
69     {
70         startPage();
71         List<EmInspectionPlanTask> list = emInspectionPlanTaskService.selectEmInspectionPlanTaskList(emInspectionPlanTask);
72         return getDataTable(list);
73     }
74
75     /**
76      * 导出点检任务列表
77      */
78     @PreAuthorize("@ss.hasPermi('em:inspectionPlanTask:export')")
79     @Log(title = "点检任务", businessType = BusinessType.EXPORT)
80     @PostMapping("/export")
81     public void export(HttpServletResponse response, EmInspectionPlanTask emInspectionPlanTask)
82     {
83         List<EmInspectionPlanTask> list = emInspectionPlanTaskService.selectEmInspectionPlanTaskList(emInspectionPlanTask);
84         ExcelUtil<EmInspectionPlanTask> util = new ExcelUtil<EmInspectionPlanTask>(EmInspectionPlanTask.class);
85         util.exportExcel(response, list, "点检任务数据");
86     }
87
88     /**
89      * 获取点检任务详细信息
90      */
91     @PreAuthorize("@ss.hasPermi('em:inspectionPlanTask:query')")
92     @GetMapping(value = "/{id}")
93     public AjaxResult getInfo(@PathVariable("id") Long id)
94     {
95         return success(emInspectionPlanTaskService.selectEmInspectionPlanTaskById(id));
96     }
97
98     /**
99      * 新增点检任务
100      */
101     @PreAuthorize("@ss.hasPermi('em:inspectionPlanTask:add')")
102     @Log(title = "点检任务", businessType = BusinessType.INSERT)
103     @PostMapping
104     public AjaxResult add(@RequestBody EmInspectionPlanTask emInspectionPlanTask)
105     {
106         return toAjax(emInspectionPlanTaskService.insertEmInspectionPlanTask(emInspectionPlanTask));
107     }
108
109     /**
110      * 修改点检任务
111      */
112     @PreAuthorize("@ss.hasPermi('em:inspectionPlanTask:edit')")
113     @Log(title = "点检任务", businessType = BusinessType.UPDATE)
114     @PutMapping
115     public AjaxResult edit(@RequestBody EmInspectionPlanTask emInspectionPlanTask)
116     {
117         return toAjax(emInspectionPlanTaskService.updateEmInspectionPlanTask(emInspectionPlanTask));
118     }
119
120     /**
121      * 删除点检任务
122      */
123     @PreAuthorize("@ss.hasPermi('em:inspectionPlanTask:remove')")
124     @Log(title = "点检任务", businessType = BusinessType.DELETE)
125     @DeleteMapping("/{ids}")
126     public AjaxResult remove(@PathVariable Long[] ids)
127     {
128         return toAjax(emInspectionPlanTaskService.deleteEmInspectionPlanTaskByIds(ids));
129     }
130 }