admin
2024-05-14 5966d6d329279119f3af29508b97c1d2c0bbe2bd
提交 | 用户 | 时间
5966d6 1 package com.jcdm.main.da.testDeviceInterface.controller;
A 2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
5
6 import com.fasterxml.jackson.core.JsonProcessingException;
7 import com.fasterxml.jackson.databind.ObjectMapper;
8 import com.google.gson.JsonObject;
9 import com.jcdm.main.restful.qingYan.doman.ChildVO;
10 import com.jcdm.main.restful.qingYan.doman.ParentVO;
11 import com.jcdm.main.webservice.ItemList;
12 import org.springframework.security.access.prepost.PreAuthorize;
13 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.web.bind.annotation.GetMapping;
15 import org.springframework.web.bind.annotation.PostMapping;
16 import org.springframework.web.bind.annotation.PutMapping;
17 import org.springframework.web.bind.annotation.DeleteMapping;
18 import org.springframework.web.bind.annotation.PathVariable;
19 import org.springframework.web.bind.annotation.RequestBody;
20 import org.springframework.web.bind.annotation.RequestMapping;
21 import org.springframework.web.bind.annotation.RestController;
22 import com.jcdm.common.annotation.Log;
23 import com.jcdm.common.core.controller.BaseController;
24 import com.jcdm.common.core.domain.AjaxResult;
25 import com.jcdm.common.enums.BusinessType;
26 import com.jcdm.main.da.testDeviceInterface.domain.DaTestDeviceInterface;
27 import com.jcdm.main.da.testDeviceInterface.service.IDaTestDeviceInterfaceService;
28 import com.jcdm.common.utils.poi.ExcelUtil;
29 import com.jcdm.common.core.page.TableDataInfo;
30
31 /**
32  * 测试设备接口数据Controller
33  * 
34  * @author hdy
35  * @date 2024-05-13
36  */
37 @RestController
38 @RequestMapping("/da/testDeviceInterface")
39 public class DaTestDeviceInterfaceController extends BaseController
40 {
41     @Autowired
42     private IDaTestDeviceInterfaceService daTestDeviceInterfaceService;
43
44     /**
45      * 查询测试设备接口数据列表
46      */
47     @PostMapping("/testPut")
48     public AjaxResult list(@RequestBody ParentVO parentVO) throws JsonProcessingException {
49         ObjectMapper mapper = new ObjectMapper();
50         List<ChildVO> li = parentVO.getCheckList();
51         String s = mapper.writeValueAsString(li);
52         DaTestDeviceInterface daTestDeviceInterface = new DaTestDeviceInterface();
53         daTestDeviceInterface.setRecordId(parentVO.getRecordId());
54         daTestDeviceInterface.setStationCode(parentVO.getStationCode());
55         daTestDeviceInterface.setProductNum(parentVO.getProductNum());
56         daTestDeviceInterface.setTotalResult(parentVO.getTotalResult());
57         daTestDeviceInterface.setCheckList(s);
58         daTestDeviceInterfaceService.save(daTestDeviceInterface);
59         return AjaxResult.success("i");
60     }
61
62     /**
63      * 查询测试设备接口数据列表
64      */
65     @PreAuthorize("@ss.hasPermi('da:testDeviceInterface:list')")
66     @GetMapping("/list")
67     public TableDataInfo list(DaTestDeviceInterface daTestDeviceInterface)
68     {
69         startPage();
70         List<DaTestDeviceInterface> list = daTestDeviceInterfaceService.selectDaTestDeviceInterfaceList(daTestDeviceInterface);
71         return getDataTable(list);
72     }
73
74     /**
75      * 导出测试设备接口数据列表
76      */
77     @PreAuthorize("@ss.hasPermi('da:testDeviceInterface:export')")
78     @Log(title = "测试设备接口数据", businessType = BusinessType.EXPORT)
79     @PostMapping("/export")
80     public void export(HttpServletResponse response, DaTestDeviceInterface daTestDeviceInterface)
81     {
82         List<DaTestDeviceInterface> list = daTestDeviceInterfaceService.selectDaTestDeviceInterfaceList(daTestDeviceInterface);
83         ExcelUtil<DaTestDeviceInterface> util = new ExcelUtil<DaTestDeviceInterface>(DaTestDeviceInterface.class);
84         util.exportExcel(response, list, "测试设备接口数据数据");
85     }
86
87     /**
88      * 获取测试设备接口数据详细信息
89      */
90     @PreAuthorize("@ss.hasPermi('da:testDeviceInterface:query')")
91     @GetMapping(value = "/{id}")
92     public AjaxResult getInfo(@PathVariable("id") Long id)
93     {
94         return success(daTestDeviceInterfaceService.selectDaTestDeviceInterfaceById(id));
95     }
96
97     /**
98      * 新增测试设备接口数据
99      */
100     @PreAuthorize("@ss.hasPermi('da:testDeviceInterface:add')")
101     @Log(title = "测试设备接口数据", businessType = BusinessType.INSERT)
102     @PostMapping
103     public AjaxResult add(@RequestBody DaTestDeviceInterface daTestDeviceInterface)
104     {
105         return toAjax(daTestDeviceInterfaceService.insertDaTestDeviceInterface(daTestDeviceInterface));
106     }
107
108     /**
109      * 修改测试设备接口数据
110      */
111     @PreAuthorize("@ss.hasPermi('da:testDeviceInterface:edit')")
112     @Log(title = "测试设备接口数据", businessType = BusinessType.UPDATE)
113     @PutMapping
114     public AjaxResult edit(@RequestBody DaTestDeviceInterface daTestDeviceInterface)
115     {
116         return toAjax(daTestDeviceInterfaceService.updateDaTestDeviceInterface(daTestDeviceInterface));
117     }
118
119     /**
120      * 删除测试设备接口数据
121      */
122     @PreAuthorize("@ss.hasPermi('da:testDeviceInterface:remove')")
123     @Log(title = "测试设备接口数据", businessType = BusinessType.DELETE)
124     @DeleteMapping("/{ids}")
125     public AjaxResult remove(@PathVariable Long[] ids)
126     {
127         return toAjax(daTestDeviceInterfaceService.deleteDaTestDeviceInterfaceByIds(ids));
128     }
129 }