hdy
2024-07-08 8069b5176a358fd4c730e34a4f30a781f1241c23
提交 | 用户 | 时间
0cceb6 1 package com.jcdm.main.da.opcuaconfig.controller;
Y 2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
5
8069b5 6 //import com.jcdm.main.da.opcuaconfig.client.ClientHandler;
0cceb6 7 import com.jcdm.main.da.opcuaconfig.domain.DaOpcuaConfig;
Y 8 import com.jcdm.main.da.opcuaconfig.domain.NodeEntity;
9 import com.jcdm.main.da.opcuaconfig.service.IDaOpcuaConfigService;
10 import org.springframework.security.access.prepost.PreAuthorize;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.web.bind.annotation.GetMapping;
13 import org.springframework.web.bind.annotation.PostMapping;
14 import org.springframework.web.bind.annotation.PutMapping;
15 import org.springframework.web.bind.annotation.DeleteMapping;
16 import org.springframework.web.bind.annotation.PathVariable;
17 import org.springframework.web.bind.annotation.RequestBody;
18 import org.springframework.web.bind.annotation.RequestMapping;
19 import org.springframework.web.bind.annotation.RestController;
20 import com.jcdm.common.annotation.Log;
21 import com.jcdm.common.core.controller.BaseController;
22 import com.jcdm.common.core.domain.AjaxResult;
23 import com.jcdm.common.enums.BusinessType;
24 import com.jcdm.common.utils.poi.ExcelUtil;
25 import com.jcdm.common.core.page.TableDataInfo;
26
27 /**
28  * 交互信号配置Controller
29  * 
30  * @author yyt
31  * @date 2024-01-23
32  */
33 @RestController
34 @RequestMapping("/da/opcuaconfig")
8069b5 35 public class DaOpcuaConfigController extends BaseController {
0cceb6 36     @Autowired
Y 37     private IDaOpcuaConfigService daOpcuaConfigService;
38
39     /**
40      * 查询交互信号配置列表
41      */
42     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:list')")
43     @GetMapping("/list")
8069b5 44     public TableDataInfo list(DaOpcuaConfig daOpcuaConfig) {
0cceb6 45         startPage();
Y 46         List<DaOpcuaConfig> list = daOpcuaConfigService.selectDaOpcuaConfigList(daOpcuaConfig);
47         return getDataTable(list);
48     }
49
50     /**
51      * 导出交互信号配置列表
52      */
53     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:export')")
54     @Log(title = "交互信号配置", businessType = BusinessType.EXPORT)
55     @PostMapping("/export")
8069b5 56     public void export(HttpServletResponse response, DaOpcuaConfig daOpcuaConfig) {
0cceb6 57         List<DaOpcuaConfig> list = daOpcuaConfigService.selectDaOpcuaConfigList(daOpcuaConfig);
Y 58         ExcelUtil<DaOpcuaConfig> util = new ExcelUtil<DaOpcuaConfig>(DaOpcuaConfig.class);
59         util.exportExcel(response, list, "交互信号配置数据");
60     }
61
62     /**
63      * 获取交互信号配置详细信息
64      */
65     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:query')")
66     @GetMapping(value = "/{id}")
8069b5 67     public AjaxResult getInfo(@PathVariable("id") Long id) {
0cceb6 68         return success(daOpcuaConfigService.selectDaOpcuaConfigById(id));
Y 69     }
70
71     /**
72      * 新增交互信号配置
73      */
74     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:add')")
75     @Log(title = "交互信号配置", businessType = BusinessType.INSERT)
76     @PostMapping
8069b5 77     public AjaxResult add(@RequestBody DaOpcuaConfig daOpcuaConfig) {
0cceb6 78         return toAjax(daOpcuaConfigService.insertDaOpcuaConfig(daOpcuaConfig));
Y 79     }
80
81     /**
82      * 修改交互信号配置
83      */
84     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:edit')")
85     @Log(title = "交互信号配置", businessType = BusinessType.UPDATE)
86     @PutMapping
8069b5 87     public AjaxResult edit(@RequestBody DaOpcuaConfig daOpcuaConfig) {
0cceb6 88         return toAjax(daOpcuaConfigService.updateDaOpcuaConfig(daOpcuaConfig));
Y 89     }
90
91     /**
92      * 删除交互信号配置
93      */
94     @PreAuthorize("@ss.hasPermi('da:opcuaconfig:remove')")
95     @Log(title = "交互信号配置", businessType = BusinessType.DELETE)
8069b5 96     @DeleteMapping("/{ids}")
H 97     public AjaxResult remove(@PathVariable Long[] ids) {
0cceb6 98         return toAjax(daOpcuaConfigService.deleteDaOpcuaConfigByIds(ids));
Y 99     }
8069b5 100 }
0cceb6 101     /**
Y 102      * 获取交互信号配置详细信息
103      */
8069b5 104 //    @PreAuthorize("@ss.hasPermi('da:opcuaconfig:query')")
H 105 //    @GetMapping(value = "/SNCode/{SNCode}/{locationCode}")
106 //    public AjaxResult setSNCode(@PathVariable("SNCode") String SNCode,@PathVariable("locationCode") String locationCode) {
107 //        NodeEntity node= NodeEntity.builder().index(2).identifier("CFL4CVT"+"."+locationCode+".MesSNCode").value(SNCode).type("string").build();
108 //        Boolean out= null;
109 //        try {
110 //            out = ClientHandler.write(node);
111 //        } catch (Exception e) {
112 //            throw new RuntimeException(e);
113 //        }
114 //
115 //        return toAjax(out);
116 //    }
117 //}