From 7f0570d20aac189f1b170942bd7100b281a1c824 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期三, 26 四月 2023 00:07:37 +0800 Subject: [PATCH] 代码整合,新增codefixedcontroller --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java | 156 ++++++++++++++++++++++++++++++--------------------- 1 files changed, 92 insertions(+), 64 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java index 17b1034..e70d868 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeBasicSecController.java @@ -1,18 +1,24 @@ package com.vci.ubcs.code.controller; -import com.vci.ubcs.code.service.CodeBasicSecServiceI; -import com.vci.starter.web.exception.VciBaseException; -import com.vci.starter.web.pagemodel.BaseQueryObject; -import com.vci.starter.web.pagemodel.BaseResult; -import com.vci.starter.web.pagemodel.DataGrid; -import com.vci.starter.web.pagemodel.Tree; -import com.vci.starter.web.util.VciBaseUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.vci.ubcs.code.dto.CodeBasicSecDTO; +import com.vci.ubcs.code.entity.CodeBasicSec; +import com.vci.ubcs.code.service.ICodeBasicSecService; import com.vci.ubcs.code.vo.pagemodel.CodeBasicSecVO; +import com.vci.ubcs.code.wrapper.CodeBasicSecWrapper; +import com.vci.ubcs.starter.exception.VciBaseException; +import com.vci.ubcs.starter.web.util.VciBaseUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; +import javax.validation.Valid; import java.util.Collection; import java.util.List; @@ -20,62 +26,78 @@ /** * 鐮佹鍩虹淇℃伅鎺у埗鍣� * - * @author weidy + * @author ludc * @date 2022-01-24 */ @RestController @RequestMapping("/codeBasicSecController") +@Api(value = "鐮佹鍩虹淇℃伅鎺у埗鍣�", tags = "鐮佹鍩虹淇℃伅鎺у埗鍣�") public class CodeBasicSecController { + /** * 鐮佹鍩虹淇℃伅 鏈嶅姟 */ @Autowired - private CodeBasicSecServiceI codeBasicSecService; + private ICodeBasicSecService codeBasicSecService; + + /** + * 缂栫爜瑙勫垯 鍒嗛〉 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "鍒嗛〉", notes = "浼犲叆codeRuleVO") + public R<IPage<CodeBasicSecVO>> list(CodeBasicSec codeBasicSec, Query query) { + IPage<CodeBasicSec> pages = codeBasicSecService.page(Condition.getPage(query), Condition.getQueryWrapper(codeBasicSec)); + return R.data(CodeBasicSecWrapper.build().pageVO(pages)); + } /** * 鐮佹鍩虹淇℃伅鍒楄〃 - * @param baseQueryObject 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑 + * @param codeBasicSecVO 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑 * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄鍒楄〃 */ @GetMapping("/gridCodeBasicSec") - public DataGrid<CodeBasicSecVO> gridCodeBasicSec(BaseQueryObject baseQueryObject){ - if(baseQueryObject == null){ - baseQueryObject = new BaseQueryObject(); - } - return codeBasicSecService.gridCodeBasicSec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); + @ApiOperationSupport(order = 2) + @ApiOperation(value = "鍒嗛〉 鐮佹鍩虹淇℃伅鍒楄〃", notes = "浼犲叆codeRuleVO") + public R<IPage<CodeBasicSecVO>> gridCodeBasicSec(CodeBasicSecVO codeBasicSecVO, Query query){ + IPage<CodeBasicSecVO> codeRuleVOIPage = codeBasicSecService.gridCodeBasicSec(Condition.getPage(query.setAscs("ordernum")),codeBasicSecVO); + return R.data(codeRuleVOIPage); } - /** + + /** * 澧炲姞 鐮佹鍩虹淇℃伅 * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄 * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞� */ @PostMapping( "/addSave") - public BaseResult<CodeBasicSecVO> addSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ - CodeBasicSecVO codeBasicSecVO = null; + @ApiOperationSupport(order = 3) + @ApiOperation(value = "澧炲姞 鐮佹鍩虹淇℃伅", notes = "codeBasicSecDTO") + public R addSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ + boolean resBoolean; try { - codeBasicSecVO = codeBasicSecService.addSave(codeBasicSecDTO); - } catch (VciBaseException e) { - return BaseResult.fail(e.getCode()); + resBoolean = codeBasicSecService.addSave(codeBasicSecDTO); + } catch (VciBaseException e) { + return R.fail(e.getCode()); } - return BaseResult.success(codeBasicSecVO); + return R.status(resBoolean); } - /** - * 淇敼 鐮佹鍩虹淇℃伅 + /** 淇敼 鐮佹鍩虹淇℃伅 * @param codeBasicSecDTO 鐮佹鍩虹淇℃伅鏁版嵁浼犺緭瀵硅薄 * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞� */ @PutMapping("/editSave") - public BaseResult<CodeBasicSecVO> editSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ - CodeBasicSecVO codeBasicSecVO = null; + @ApiOperationSupport(order = 4) + @ApiOperation(value = "淇敼 鐮佹鍩虹淇℃伅", notes = "codeBasicSecDTO") + public R editSave(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ + boolean resBoolean; try { - codeBasicSecVO = codeBasicSecService.editSave(codeBasicSecDTO); - } catch (VciBaseException e) { - return BaseResult.fail(e.getCode()); + resBoolean = codeBasicSecService.editSave(codeBasicSecDTO); + } catch (VciBaseException e) { + return R.fail(e.getCode()); } - return BaseResult.success(codeBasicSecVO); + return R.status(resBoolean); } - /** * 鍒犻櫎鐮佹鍩虹淇℃伅 @@ -83,7 +105,9 @@ * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐� */ @DeleteMapping( "/deleteData") - public BaseResult delCodeBasicSec(CodeBasicSecDTO codeBasicSecDTO) { + @ApiOperationSupport(order = 5) + @ApiOperation(value = "鍒犻櫎鐮佹鍩虹淇℃伅", notes = "codeBasicSecDTO") + public R delCodeBasicSec(@Valid @RequestBody CodeBasicSecDTO codeBasicSecDTO) { return codeBasicSecService.deleteCodeBasicSec(codeBasicSecDTO); } @@ -93,50 +117,48 @@ * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄 */ @GetMapping("/getObjectByOid") - public BaseResult<CodeBasicSecVO> getObjectByOid(String oid){ + @ApiOperationSupport(order = 6) + @ApiOperation(value = "鍒犻櫎鐮佹鍩虹淇℃伅", notes = "codeBasicSecDTO") + public R<CodeBasicSecVO> getObjectByOid(String oid){ CodeBasicSecVO codeBasicSecVO = codeBasicSecService.getObjectByOid(oid); - return BaseResult.success(codeBasicSecVO); + return R.data(codeBasicSecVO); } - /** + /** * 涓婚敭鎵归噺鑾峰彇鐮佹鍩虹淇℃伅 * @param oids 涓婚敭锛屽涓互閫楀彿鍒嗛殧锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓� * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄 */ @GetMapping("/listDataByOids") - public BaseResult<CodeBasicSecVO> listCodeBasicSecByOids(String oids){ - Collection<CodeBasicSecVO> voCollection = codeBasicSecService.listCodeBasicSecByOids(VciBaseUtil.str2List(oids)); - BaseResult baseResult = BaseResult.success(); - baseResult.setData(voCollection); - return baseResult; + @ApiOperationSupport(order = 7) + @ApiOperation(value = "涓婚敭鎵归噺鑾峰彇鐮佹鍩虹淇℃伅", notes = "oids") + public R<Collection<CodeBasicSecVO>> listCodeBasicSecByOids(String oids){ + Collection<CodeBasicSecVO> voCollection = codeBasicSecService.listCodeBasicSecByOids(VciBaseUtil.str2List(oids)); + return R.data(voCollection); } - - /** * 鍙傜収鐮佹鍩虹淇℃伅鍒楄〃 - * @param baseQueryObject 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑 + * @param codeBasicSecVO 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑 * @return 鐮佹鍩虹淇℃伅鏄剧ず瀵硅薄鍒楄〃锛岀敓鏁堢殑鍐呭 */ @GetMapping("/refDataGrid") - public DataGrid<CodeBasicSecVO> refDataGridCodeBasicSec(BaseQueryObject baseQueryObject){ - if(baseQueryObject == null){ - baseQueryObject = new BaseQueryObject(); - } - return codeBasicSecService.refDataGridCodeBasicSec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); + @ApiOperationSupport(order = 8) + @ApiOperation(value = "鍙傜収鐮佹鍩虹淇℃伅鍒楄〃", notes = "codeBasicSecVO") + public R<IPage<CodeBasicSecVO>> refDataGridCodeBasicSec(CodeBasicSecVO codeBasicSecVO, Query query){ + return R.data(codeBasicSecService.refDataGridCodeBasicSec(Condition.getPage(query),codeBasicSecVO)); } /** * 鍙傛暟鍒嗙被鐮佹鍩虹淇℃伅鍒楄〃 - * @param baseQueryObject 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑锛屽繀椤昏鏈夌紪鐮佽鍒欑殑涓婚敭 pkCodeRule + * @param codeBasicSecVO 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑锛屽繀椤昏鏈夌紪鐮佽鍒欑殑涓婚敭 pkCodeRule * @return 鐮佹鐨勪俊鎭� */ @GetMapping("/refDataGridClassifySec") - public DataGrid<CodeBasicSecVO> refDataGridClassifySec(BaseQueryObject baseQueryObject){ - if(baseQueryObject == null){ - baseQueryObject = new BaseQueryObject(); - } - return codeBasicSecService.refDataGridClassifySec(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); + @ApiOperationSupport(order = 9) + @ApiOperation(value = "鍙傛暟鍒嗙被鐮佹鍩虹淇℃伅鍒楄〃", notes = "codeBasicSecVO") + public R<IPage<CodeBasicSecVO>> refDataGridClassifySec(CodeBasicSecVO codeBasicSecVO, Query query){ + return R.data(codeBasicSecService.refDataGridClassifySec(Condition.getPage(query.setAscs("ordernum")), codeBasicSecVO)); } /** @@ -145,11 +167,13 @@ * @return 鍏嬮殕缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐� */ @PostMapping("/clone") - public BaseResult cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ + @ApiOperationSupport(order = 10) + @ApiOperation(value = "鍏嬮殕鐮佹淇℃伅", notes = "codeBasicSecDTO") + public R cloneCodeBasicSec(@RequestBody CodeBasicSecDTO codeBasicSecDTO){ VciBaseUtil.alertNotNull(codeBasicSecDTO.getOidArr(),"閫夋嫨鐮佹涓婚敭"); List<String> oidArr = VciBaseUtil.str2List(codeBasicSecDTO.getOidArr()); if (CollectionUtils.isEmpty(oidArr)){ - return BaseResult.fail("閫夋嫨鐮佹涓婚敭涓嶈兘涓虹┖"); + return R.fail("閫夋嫨鐮佹涓婚敭涓嶈兘涓虹┖"); } return codeBasicSecService.cloneCodeBasicSec(oidArr,codeBasicSecDTO.getPkCodeRule()); } @@ -159,11 +183,13 @@ * @param oid 鐩爣鍒嗙被鐮佹涓婚敭 * @return 鍒嗙被鐮佹鏍戠粨鏋� */ - @GetMapping("/treeCodeClassifySec") + /*@GetMapping("/treeCodeClassifySec") + @ApiOperationSupport(order = 11) + @ApiOperation(value = "鏌ヨ鐩爣鍒嗙被鐮佹鎵�鍦ㄧ殑鏍戠粨鏋�", notes = "oid") public List<Tree> gridCodeClassifySecTree (String oid){ VciBaseUtil.alertNotNull(oid,"鍒嗙被鐮佹涓婚敭"); return codeBasicSecService.gridCodeClassifySecTree(oid); - } + }*/ /** * 涓婄Щ @@ -171,9 +197,10 @@ * @return 鎵ц缁撴灉 */ @PostMapping("/upOrderNum") - public BaseResult upOrderNum(String oid){ - codeBasicSecService.upOrderNum(oid); - return BaseResult.success(); + @ApiOperationSupport(order = 11) + @ApiOperation(value = "涓婄Щ", notes = "oid") + public R upOrderNum(@Valid @RequestParam String oid){ + return R.status(codeBasicSecService.upOrderNum(oid)); } /** @@ -182,9 +209,10 @@ * @return 鎵ц缁撴灉 */ @PostMapping("/downOrderNum") - public BaseResult downOrderNum(String oid){ - codeBasicSecService.downOrderNum(oid); - return BaseResult.success(); + @ApiOperationSupport(order = 12) + @ApiOperation(value = "涓嬬Щ", notes = "oid") + public R downOrderNum(@Valid @RequestParam String oid){ + return R.status(codeBasicSecService.downOrderNum(oid)); } } -- Gitblit v1.9.3