From dd9e34d4379ea31b44b5ac2f5a60ae5ab4b13030 Mon Sep 17 00:00:00 2001 From: liurunyu <lry9898@163.com> Date: 星期五, 05 七月 2024 16:36:48 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java | 64 +++++++++++++++---------------- 1 files changed, 31 insertions(+), 33 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java index 6621c38..01a550a 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/clientType/ClientTypeCtrl.java @@ -2,17 +2,13 @@ import com.dy.common.aop.SsoAop; -import com.dy.common.mybatis.envm.Deleted; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.common.webUtil.ResultCodeMsg; -import com.dy.pipIrrBase.role.RoleSv; import com.dy.pipIrrBase.user.QueryVo; import com.dy.pipIrrGlobal.pojoBa.BaClientType; -import com.dy.pipIrrGlobal.pojoBa.BaClientType; import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.responses.ApiResponse; @@ -23,10 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.validation.BindingResult; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; import java.util.Objects; @@ -59,7 +52,7 @@ ) }) @GetMapping(path = "all") - @SsoAop("-1") + @SsoAop() public BaseResponse<QueryResultVo<List<BaClientType>>> all(){ try { QueryResultVo<List<BaClientType>> res = this.sv.selectAll() ; @@ -83,9 +76,9 @@ schema = @Schema(implementation = BaClientType.class))} ) }) - @PostMapping(path = "some", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - @SsoAop("-1") - public BaseResponse<QueryResultVo<List<BaClientType>>> some(@Parameter(description = "鏌ヨform琛ㄥ崟鏁版嵁", required = true) @Valid QueryVo vo){ + @PostMapping(path = "some", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop() + public BaseResponse<QueryResultVo<List<BaClientType>>> some(@RequestBody @Valid QueryVo vo){ try { QueryResultVo<List<BaClientType>> res = this.sv.selectSome(vo) ; return BaseResponseUtils.buildSuccess(res); @@ -108,9 +101,9 @@ schema = @Schema(implementation = BaClientType.class))} ) }) - @GetMapping(path = "one") - @SsoAop("-1") - public BaseResponse<BaClientType> one(@Parameter(description = "瀹炰綋id", required = true) Long id){ + @GetMapping(path = "one", consumes = MediaType.TEXT_PLAIN_VALUE) + @SsoAop() + public BaseResponse<BaClientType> one(Long id){ return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); } @@ -128,9 +121,9 @@ schema = @Schema(implementation = Boolean.class))} ) }) - @PostMapping(path = "save", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - @SsoAop("-1")//@SsoAop(power = "-1") - public BaseResponse<Boolean> save(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ + @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop() + public BaseResponse<Boolean> save(@RequestBody @Valid BaClientType po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } @@ -163,9 +156,9 @@ schema = @Schema(implementation = Boolean.class))} ) }) - @PostMapping(path = "update", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - @SsoAop("-1")//@SsoAop(power = "-1") - public BaseResponse<Boolean> update(@Parameter(description = "form琛ㄥ崟鏁版嵁", required = true) @Valid BaClientType po, @Parameter(hidden = true) BindingResult bindingResult){ + @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop() + public BaseResponse<Boolean> update(@RequestBody @Valid BaClientType po, BindingResult bindingResult){ if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } @@ -202,22 +195,27 @@ ) }) @GetMapping(path = "delete", consumes = MediaType.TEXT_PLAIN_VALUE) - @SsoAop("-1")//@SsoAop(power = "-1") - public BaseResponse<Boolean> delete(@Parameter(description = "瀹炰綋id", required = true) Long id){ + @SsoAop() + public BaseResponse<Boolean> delete(Long id){ if(id == null){ return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ; } - int count; - try { - count = this.sv.delete(id); - } catch (Exception e) { - log.error("淇濆瓨鍐滄埛绫诲瀷寮傚父", e); - return BaseResponseUtils.buildException(e.getMessage()) ; - } - if(count <= 0){ - return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; + Long clientCount = this.sv.selectClientByType(id) ; + if(clientCount > 0){ + return BaseResponseUtils.buildFail("鍒犻櫎澶辫触锛屽瓨鍦�" + clientCount + "涓啘鎴峰綊灞炴绫诲瀷锛岃绫诲瀷涓嶈兘琚垹闄�") ; }else{ - return BaseResponseUtils.buildSuccess(true) ; + int count; + try { + count = this.sv.delete(id); + } catch (Exception e) { + log.error("淇濆瓨鍐滄埛绫诲瀷寮傚父", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + if(count <= 0){ + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; + }else{ + return BaseResponseUtils.buildSuccess(true) ; + } } } -- Gitblit v1.8.0