From 7df1d61319149a666e8b2801a3c89c1d80900d2e Mon Sep 17 00:00:00 2001 From: ludc Date: 星期五, 07 四月 2023 17:57:46 +0800 Subject: [PATCH] 编码规则相关代码上传 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java | 254 +++++++++++++++++++++----------------------------- 1 files changed, 107 insertions(+), 147 deletions(-) diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java index 22f7d61..ed02431 100644 --- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java +++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java @@ -1,167 +1,127 @@ +/* + * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the dreamlu.net developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: Chill 搴勯獮 (smallchill@163.com) + */ package com.vci.ubcs.code.controller; - -import com.vci.ubcs.code.service.CodeRuleServiceI; -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.util.VciBaseUtil; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.vci.ubcs.code.dto.CodeRuleDTO; -import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; +import com.vci.ubcs.code.entity.CodeRule; +import com.vci.ubcs.code.service.ICodeRuleService; import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.CollectionUtils; +import com.vci.ubcs.code.wrapper.CodeRuleWrapper; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.AllArgsConstructor; +import org.springblade.core.boot.ctrl.BladeController; +import org.springblade.core.mp.support.Condition; +import org.springblade.core.mp.support.Query; +import org.springblade.core.tool.api.R; import org.springframework.web.bind.annotation.*; -import java.util.Collection; -import java.util.Map; - +import javax.validation.Valid; /** - * 涓绘暟鎹紪鐮佽鍒欐帶鍒跺櫒 + * 缂栫爜瑙勫垯 鎺у埗鍣� * - * @author weidy - * @date 2022-01-24 + * @author ludc + * @since 2023-04-03 */ @RestController -@RequestMapping("/mdmRuleController") -public class CodeRuleController { - /** - * 涓绘暟鎹紪鐮佽鍒� 鏈嶅姟 - */ - @Autowired - private CodeRuleServiceI codeRuleService; +@AllArgsConstructor +@RequestMapping("/mdmRule") +@Api(value = "缂栫爜瑙勫垯", tags = "缂栫爜瑙勫垯鎺ュ彛") +public class CodeRuleController extends BladeController { - /** - * 涓绘暟鎹紪鐮佽鍒欏垪琛� - * @param baseQueryObject 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑 - * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞″垪琛� - */ - @GetMapping("/gridCodeRule") - public DataGrid<CodeRuleVO> gridCodeRule(BaseQueryObject baseQueryObject){ - if(baseQueryObject == null){ - baseQueryObject = new BaseQueryObject(); - } - DataGrid<CodeRuleVO> result = codeRuleService.gridCodeRule(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); - return result; - } - /** - * 澧炲姞 涓绘暟鎹紪鐮佽鍒� - * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞� - * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞� - */ - @PostMapping( "/addSave") - public BaseResult<CodeRuleVO> addSave(@RequestBody CodeRuleDTO codeRuleDTO){ - CodeRuleVO codeRuleVO = codeRuleService.addSave(codeRuleDTO); - return BaseResult.success(codeRuleVO); - } + private final ICodeRuleService codeRuleService; - /** - * 淇敼 涓绘暟鎹紪鐮佽鍒� - * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞� - * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞� - */ - @PutMapping("/editSave") - public BaseResult<CodeRuleVO> editSave(@RequestBody CodeRuleDTO codeRuleDTO){ - CodeRuleVO codeRuleVO = codeRuleService.editSave(codeRuleDTO); - return BaseResult.success(codeRuleVO); - } + /** + * 缂栫爜瑙勫垯 璇︽儏 + */ + @GetMapping("/detail") + @ApiOperationSupport(order = 1) + @ApiOperation(value = "璇︽儏", notes = "浼犲叆codeRule") + public R<CodeRuleVO> detail(CodeRule codeRule) { + CodeRule detail = codeRuleService.getOne(Condition.getQueryWrapper(codeRule)); + return R.data(CodeRuleWrapper.build().entityVO(detail)); + } + /** + * 缂栫爜瑙勫垯 鍒嗛〉 + */ + @GetMapping("/list") + @ApiOperationSupport(order = 2) + @ApiOperation(value = "鍒嗛〉", notes = "浼犲叆codeRuleVO") + public R<IPage<CodeRuleVO>> list(CodeRule codeRule, Query query) { + IPage<CodeRule> pages = codeRuleService.page(Condition.getPage(query), Condition.getQueryWrapper(codeRule)); + return R.data(CodeRuleWrapper.build().pageVO(pages)); + } + /** + * 缂栫爜瑙勫垯 鑷畾涔夊垎椤� + */ + @GetMapping("/gridCodeRule") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "鍒嗛〉", notes = "浼犲叆CodeRule") + public R<IPage<CodeRuleVO>> page(CodeRuleVO CodeRule, Query query) { + IPage<CodeRuleVO> pages = codeRuleService.selectPlCodeRulePage(Condition.getPage(query.setDescs("CREATETIME")), CodeRule); + return R.data(pages); + } - /** - * 鍒犻櫎涓绘暟鎹紪鐮佽鍒� - * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈� - * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐� - */ - @DeleteMapping( "/deleteData") - public BaseResult delCodeRule( CodeRuleDTO codeRuleDTO) { - return codeRuleService.deleteCodeRule(codeRuleDTO); - } + /** + * 澧炲姞 涓绘暟鎹紪鐮佽鍒� + * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞� + * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞� + */ + @PostMapping("/addCode") + @ApiOperationSupport(order = 4) + @ApiOperation(value = "鏂板", notes = "浼犲叆CodeRule") + public R save(@Valid @RequestBody CodeRuleDTO codeRuleDTO) { + return R.status(codeRuleService.addSave(codeRuleDTO)); + } - /** - * 涓婚敭鑾峰彇涓绘暟鎹紪鐮佽鍒� - * @param oid 涓婚敭 - * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞� - */ - @GetMapping("/getObjectByOid") - public BaseResult<CodeRuleVO> getObjectByOid(String oid){ - CodeRuleVO codeRuleVO = codeRuleService.getObjectByOid(oid); - return BaseResult.success(codeRuleVO); - } + /** + * 淇敼 涓绘暟鎹紪鐮佽鍒� + * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞� + * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞� + */ + @PostMapping("/update") + @ApiOperationSupport(order = 5) + @ApiOperation(value = "淇敼", notes = "浼犲叆CodeRule") + public R update(@Valid @RequestBody CodeRuleDTO codeRuleDTO) { + return R.status(codeRuleService.editSave(codeRuleDTO)); + } - /** - * 涓婚敭鎵归噺鑾峰彇涓绘暟鎹紪鐮佽鍒� - * @param oids 涓婚敭锛屽涓互閫楀彿鍒嗛殧锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓� - * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞� - */ - @GetMapping("/listDataByOids") - public BaseResult<CodeRuleVO> listCodeRuleByOids(String oids){ - Collection<CodeRuleVO> voCollection = codeRuleService.listCodeRuleByOids(VciBaseUtil.str2List(oids)); - BaseResult baseResult = BaseResult.success(); - baseResult.setData(voCollection); - return baseResult; - } + /** + * 缂栫爜瑙勫垯 鏂板鎴栦慨鏀� + */ + @PostMapping("/submit") + @ApiOperationSupport(order = 6) + @ApiOperation(value = "鏂板鎴栦慨鏀�", notes = "浼犲叆CodeRule") + public R submit(@Valid @RequestBody CodeRule codeRule) { + return R.status(codeRuleService.saveOrUpdate(codeRule)); + } + /** + * 鍒犻櫎涓绘暟鎹紪鐮佽鍒� + * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈� + * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐� + */ + @DeleteMapping( "/deleteData") + public R delCodeRule(@Valid @RequestBody CodeRuleDTO codeRuleDTO) { + return codeRuleService.deleteCodeRule(codeRuleDTO); + } - - /** - * 鍙傜収涓绘暟鎹紪鐮佽鍒欏垪琛� - * @param baseQueryObject 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑 - * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞″垪琛紝鐢熸晥鐨勫唴瀹� - */ - @GetMapping("/refDataGrid") - public DataGrid<CodeRuleVO> refDataGridCodeRule(BaseQueryObject baseQueryObject){ - if(baseQueryObject == null){ - baseQueryObject = new BaseQueryObject(); - } - return codeRuleService.refDataGridCodeRule(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()); - } - - /** - * 鏌ョ湅涓绘暟鎹紪鐮佽鍒欑殑浣跨敤鑼冨洿 - * @param oid 涓婚敭 - * @return 浣跨敤鑼冨洿 - */ - @GetMapping("/listUseRange") - public BaseResult<CodeClassifyVO> listUseRange(String oid){ - Collection<CodeClassifyVO> voList = codeRuleService.listUseRangeInCodeClassify(oid); - BaseResult baseResult = BaseResult.success(); - baseResult.setData(voList); - return baseResult; - } - - /** - * 鍋滅敤涓庡惎鐢ㄧ紪鐮佽鍒� - * @param map 灏佽鍙傛暟锛屽寘鎷琽id 缂栫爜瑙勫垯涓婚敭 update 鏇存柊鐘舵�佺殑鎿嶄綔 - * @return 鎵ц缁撴灉 - */ - @PostMapping ("/updateStatus") - public BaseResult updateStatus(@RequestBody Map<String,String> map){ - if (CollectionUtils.isEmpty(map)){ - return BaseResult.fail("鍙傛暟閿欒"); - } - String oid = map.get("oid"); - String update = map.get("update"); - return codeRuleService.updateStatus(oid,update); - } - - /** - * 鍏嬮殕缂栫爜瑙勫垯 - * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈� - * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞� - */ - @PostMapping("/clone") - public BaseResult cloneCodeRule(@RequestBody CodeRuleDTO codeRuleDTO){ - return codeRuleService.cloneCodeRule(codeRuleDTO); - } - - /** - * 缂栫爜瑙勫垯娓呯┖鎵�鏈夊凡鐢熸垚鐨勭紪鐮� - * @param oid 缂栫爜瑙勫垯涓婚敭 - * @return 鎵ц缁撴灉 - */ - @DeleteMapping("/clearAllCode") - public BaseResult clearAllCode(String oid){ - return codeRuleService.clearAllCode(oid); - } } -- Gitblit v1.9.3