From 9552a061aa27b05f6044d60efd265553a275b58e Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期四, 09 五月 2024 13:43:19 +0800
Subject: [PATCH] 流浪控制器增加、删除、查询接口
---
pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java | 78 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java
index d1324ff..fd0aced 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/intakeController/IntakeControllerCtrl.java
@@ -1,5 +1,7 @@
package com.dy.pipIrrProject.intakeController;
+
+import cn.hutool.core.date.DateTime;
import com.dy.common.aop.SsoAop;
import com.dy.common.webUtil.BaseResponse;
import com.dy.common.webUtil.BaseResponseUtils;
@@ -204,8 +206,9 @@
try {
List<Map<String, Object>> list = Optional.ofNullable(intakeControllerSv.getBindsByIntakeId(intakeId)).orElse(new ArrayList<>());
if(list.size() <= 0) {
- return BaseResponseUtils.buildFail(ProjectResultCode.INTAKE_NO_RECORDS.getMessage());
- }
+ //鏃犵粦瀹氳褰曚篃杩斿洖鎴愬姛 浣嗘暟鎹负绌�
+ return BaseResponseUtils.buildSuccess(list);
+ }//鎴愬姛杩斿洖缁戝畾璁板綍鏁版嵁
return BaseResponseUtils.buildSuccess(list);
} catch (Exception e) {
log.error("鏌ヨ鍐滄埛寮傚父", e);
@@ -241,4 +244,75 @@
return BaseResponseUtils.buildException(e.getMessage()) ;
}
}
+
+
+ /**
+ * 鏍规嵁鎸囧畾鏉′欢鑾峰彇娴佹氮鎺у埗鍣ㄥ垪琛�
+ *
+ * @param vo 鏌ヨ鏉′欢
+ * @return 绗﹀悎鏉′欢鐨勬帶鍒跺櫒鍒楄〃
+ */
+ @Operation(summary = "鑾峰緱涓�椤垫祦娴帶鍒跺櫒璁板綍", description = "杩斿洖涓�椤垫祦娴帶鍒跺櫒鏁版嵁")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "杩斿洖涓�椤垫祦娴帶鍒跺櫒鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = PrControllerTramp.class))}
+ )
+ })
+ @GetMapping(path = "/getTrampControllers")
+ @SsoAop()
+ public BaseResponse<QueryResultVo<List<PrControllerTramp>>> getTrampControllers(TrampControllerQueryVo vo) {
+
+ try {
+ QueryResultVo<List<PrControllerTramp>> res = intakeControllerSv.getTrampControllers(vo);
+ if (res.itemTotal != null && res.itemTotal > 0) {
+ return BaseResponseUtils.buildSuccess(res);
+ } else {
+ //璇锋眰鎴愬姛浣嗘暟鎹负绌�
+ return BaseResponseUtils.buildSuccess(res);
+ }
+ //return BaseResponseUtils.buildSuccess(res);
+ } catch (Exception e) {
+ log.error("鑾峰彇娴佹氮鎺у埗鍣ㄨ褰曞紓甯�", e);
+ return BaseResponseUtils.buildException(e.getMessage());
+ }
+ }
+
+ /**
+ * 娣诲姞娴佹氮鎺у埗鍣�
+ * @param pct
+ * @return
+ */
+ @PostMapping("addTrampController")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> addTrampController(@RequestBody PrControllerTramp pct){
+ pct.setFindDt(new Date());
+ Integer rows = intakeControllerSv.addTrampController(pct);
+ if (rows == 0) {
+ return BaseResponseUtils.buildFail(ProjectResultCode.ADD_TRAMP_CONTROLLER_FAIL.getMessage());
+ }
+ return BaseResponseUtils.buildSuccess(true);
+ }
+
+ /**
+ * 鍒犻櫎娴佹氮鎺у埗鍣�
+ * @param id
+ * @return
+ */
+ @PostMapping("deleteTrampController")
+ @Transactional(rollbackFor = Exception.class)
+ @SsoAop()
+ public BaseResponse<Boolean> deleteTrampController(Long id){
+ PrControllerTramp controllerInfo = intakeControllerSv.getTrampControllerInfo(id);
+ if (controllerInfo==null){return BaseResponseUtils.buildFail(ProjectResultCode.NO_EXIST_TRAMP_CONTROLLER.getMessage());}
+
+ Integer rows = intakeControllerSv.deleteTrampController(id);
+ if (rows == 0) {
+ return BaseResponseUtils.buildFail(ProjectResultCode.DELETE_TRAMP_CONTROLLER_FAIL.getMessage());
+ }
+ return BaseResponseUtils.buildSuccess(true);
+ }
}
--
Gitblit v1.8.0