|
@@ -0,0 +1,112 @@
|
|
|
+package com.hb.proj.analysis.controller;
|
|
|
+
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.hb.proj.allconfig.AccessToken;
|
|
|
+import com.hb.proj.allconfig.SysLog;
|
|
|
+import com.hb.proj.analysis.service.DiagramDiagnoseService;
|
|
|
+import com.hb.proj.model.DiagramDiagnoseStandardPO;
|
|
|
+import com.hb.proj.model.DiagramDiagnoseStandardVO;
|
|
|
+import com.hb.proj.utils.RequestParams;
|
|
|
+import com.hb.proj.utils.RespVO;
|
|
|
+import com.hb.proj.utils.RespVOBuilder;
|
|
|
+import com.hb.xframework.dao.util.PageModel;
|
|
|
+
|
|
|
+import jakarta.validation.constraints.NotBlank;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/diagnose/standard")
|
|
|
+@Validated
|
|
|
+public class DiagramDiagnoseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DiagramDiagnoseService service;
|
|
|
+
|
|
|
+ @Value("${upload.access.path}")
|
|
|
+ private String accessPathPre;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询标准功图记录
|
|
|
+ * @param params 查询参数
|
|
|
+ * @param pageNum 页码
|
|
|
+ * @param pageSize 每页记录数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/query")
|
|
|
+ public RespVO<PageModel<DiagramDiagnoseStandardVO>> query(RequestParams params,
|
|
|
+ @RequestParam(value = "currentPage", defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize) {
|
|
|
+ return RespVOBuilder.ok(service.query(params.getObjectMap(), pageNum, pageSize));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获得单个标准功图记录
|
|
|
+ * @param diagnoseId 记录id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/get")
|
|
|
+ public RespVO<DiagramDiagnoseStandardVO> get(@NotBlank(message = "缺少记录号") String diagnoseId){
|
|
|
+ DiagramDiagnoseStandardVO vo=service.get(diagnoseId);
|
|
|
+ if(vo.getAccessPath()!=null) {
|
|
|
+ vo.setAccessPath(accessPathPre+vo.getAccessPath());
|
|
|
+ }
|
|
|
+
|
|
|
+ return RespVOBuilder.ok(vo);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除单个标准功图记录
|
|
|
+ * @param diagnoseId 待删除记录id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/delete")
|
|
|
+ @SysLog("删除设备信息:{arg0}")
|
|
|
+ public RespVO<Object> delete(String diagnoseId){
|
|
|
+ service.delete(diagnoseId);
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 增加新标准功图记录
|
|
|
+ * @param diagnosePO 标准功图记录实体对象
|
|
|
+ * @param token 当前登录实体
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/add")
|
|
|
+ public RespVO<String> add(@Validated DiagramDiagnoseStandardPO diagnosePO,AccessToken token){
|
|
|
+ diagnosePO.setModifyBy(token.getUsName());
|
|
|
+ return RespVOBuilder.ok(service.add(diagnosePO));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新标准功图记录
|
|
|
+ * @param diagnosePO 标准功图记录实体对象
|
|
|
+ * @param token 当前登录实体
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/update")
|
|
|
+ public RespVO<Object> update(@Validated DiagramDiagnoseStandardPO diagnosePO,AccessToken token){
|
|
|
+ DiagramDiagnoseStandardPO dbDiagnose=service.getPO(diagnosePO.getDiagnoseId());
|
|
|
+ if(dbDiagnose==null) {
|
|
|
+ return RespVOBuilder.error("该记录已不存在");
|
|
|
+ }
|
|
|
+ dbDiagnose.setModifyBy(token.getUsName());
|
|
|
+ BeanUtils.copyProperties(diagnosePO, dbDiagnose);
|
|
|
+ service.update(dbDiagnose);
|
|
|
+
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+}
|