From c178f4c6485b950eb4a42161acafcc4279d34721 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 4 Jul 2023 10:31:33 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E6=B7=BB=E5=8A=A0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=B7=A1=E6=A3=80=E5=86=85=E5=AE=B9=E6=89=B9=E9=87=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=9A=84feign=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzinfo/inspect/obj/feign/IContentClient.java | 16 +++++++++++++++- .../com/hnac/hzinfo/inspect/obj/feign/ContentClient.java | 10 ++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java index 711100b..e0557d0 100644 --- a/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java +++ b/hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/obj/feign/IContentClient.java @@ -1,16 +1,22 @@ package com.hnac.hzinfo.inspect.obj.feign; import com.hnac.hzinfo.inspect.Constants; +import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.vo.ContentVO; import org.springblade.core.tool.api.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; @FeignClient(value = Constants.APP_NAME) public interface IContentClient { String API_PREFIX = "/feign/content"; String DETAIL = API_PREFIX + "/detail"; - String SAVE_BATCH = API_PREFIX + "/saveBatch"; + String UPDATE_BATCH = API_PREFIX + "/detail"; + String SAVE_BATCH = API_PREFIX + "/updateBatch"; String LIST = API_PREFIX + "/list"; String SAVE_OR_UPDATE_BATCH = API_PREFIX + "/saveOrUpdateBatch"; @@ -22,4 +28,12 @@ public interface IContentClient { @GetMapping(DETAIL) R detail(Long id); + /** + * 批量更新巡检内容 + * @param request 巡检内容列表 + * @return + */ + @PutMapping(UPDATE_BATCH) + R updateBatch(@RequestBody List request); + } diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java index 31e287e..2bb040a 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/feign/ContentClient.java @@ -1,5 +1,8 @@ package com.hnac.hzinfo.inspect.obj.feign; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.hnac.hzinfo.inspect.obj.dto.ContentDTO; import com.hnac.hzinfo.inspect.obj.entity.ContentEntity; import com.hnac.hzinfo.inspect.obj.services.ContentService; import com.hnac.hzinfo.inspect.obj.vo.ContentVO; @@ -10,6 +13,7 @@ import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.RestController; +import java.util.List; import java.util.Optional; /** @@ -32,5 +36,11 @@ public class ContentClient extends BladeController implements IContentClient { return R.data(Optional.ofNullable(entity).map(content -> ContentWrapper.build().entityVO(content)).orElse(null)); } + @Override + public R updateBatch(List request) { + List contentList = JSONArray.parseArray(JSON.toJSONString(request), ContentEntity.class); + return R.data(contentService.updateBatchById(contentList)); + } + }