From d7a83f1396425c4e47da9b95f287b26cd5bb3344 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期三, 12 四月 2023 10:18:53 +0800 Subject: [PATCH] 后端代码整合 --- Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 103 insertions(+), 12 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 ed02431..881e106 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 @@ -21,8 +21,10 @@ import com.vci.ubcs.code.dto.CodeRuleDTO; import com.vci.ubcs.code.entity.CodeRule; import com.vci.ubcs.code.service.ICodeRuleService; +import com.vci.ubcs.code.vo.pagemodel.CodeClassifyVO; import com.vci.ubcs.code.vo.pagemodel.CodeRuleVO; import com.vci.ubcs.code.wrapper.CodeRuleWrapper; +import com.vci.ubcs.com.vci.starter.web.util.VciBaseUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.AllArgsConstructor; @@ -30,9 +32,12 @@ import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.util.Collection; +import java.util.Map; /** * 缂栫爜瑙勫垯 鎺у埗鍣� @@ -58,6 +63,7 @@ CodeRule detail = codeRuleService.getOne(Condition.getQueryWrapper(codeRule)); return R.data(CodeRuleWrapper.build().entityVO(detail)); } + /** * 缂栫爜瑙勫垯 鍒嗛〉 */ @@ -75,8 +81,8 @@ @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); + public R<IPage<CodeRuleVO>> gridCodeRule(CodeRuleVO CodeRule, Query query) { + IPage<CodeRuleVO> pages = codeRuleService.gridCodeRule(Condition.getPage(query.setDescs("CREATETIME")), CodeRule); return R.data(pages); } @@ -105,23 +111,108 @@ } /** - * 缂栫爜瑙勫垯 鏂板鎴栦慨鏀� - */ - @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") + @ApiOperationSupport(order = 7) + @ApiOperation(value = "鍒犻櫎", notes = "浼犲叆codeRuleDTO") public R delCodeRule(@Valid @RequestBody CodeRuleDTO codeRuleDTO) { return codeRuleService.deleteCodeRule(codeRuleDTO); } + /** + * 涓婚敭鑾峰彇涓绘暟鎹紪鐮佽鍒� + * @param oid 涓婚敭 + * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞� + */ + @GetMapping("/getObjectByOid") + @ApiOperationSupport(order = 8) + @ApiOperation(value = "涓婚敭鑾峰彇涓绘暟鎹紪鐮佽鍒�", notes = "浼犲叆oid") + public R<CodeRuleVO> getObjectByOid(@Valid @RequestParam String oid){ + CodeRuleVO codeRuleVO = codeRuleService.getObjectByOid(oid); + return R.data(codeRuleVO); + } + + /** + * 涓婚敭鎵归噺鑾峰彇涓绘暟鎹紪鐮佽鍒� + * @param oids 涓婚敭锛屽涓互閫楀彿鍒嗛殧锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓� + * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞� + */ + @GetMapping("/listDataByOids") + @ApiOperationSupport(order = 9) + @ApiOperation(value = "涓婚敭鎵归噺鑾峰彇涓绘暟鎹紪鐮佽鍒�", notes = "浼犲叆oids") + public R<Collection<CodeRuleVO>> listCodeRuleByOids(@Valid @RequestParam String oids){ + Collection<CodeRuleVO> voCollection = codeRuleService.listCodeRuleByOids(VciBaseUtil.str2List(oids)); + return R.data(voCollection); + } + + /** + * 鍙傜収涓绘暟鎹紪鐮佽鍒欏垪琛� + * @param CodeRule + * @param query + * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞″垪琛紝鐢熸晥鐨勫唴瀹� + */ + @GetMapping("/refDataGrid") + @ApiOperationSupport(order = 10) + @ApiOperation(value = "鍙傜収涓绘暟鎹紪鐮佽鍒欏垪琛�", notes = "浼犲叆oids") + public R<IPage<CodeRuleVO>> refDataGridCodeRule(CodeRuleVO CodeRule, Query query){ + return R.data(codeRuleService.refDataGridCodeRule(Condition.getPage(query),CodeRule)); + } + + /** + * 鏌ョ湅涓绘暟鎹紪鐮佽鍒欑殑浣跨敤鑼冨洿 + * @param oid 涓婚敭 + * @return 浣跨敤鑼冨洿 + */ + @GetMapping("/listUseRange") + @ApiOperationSupport(order = 11) + @ApiOperation(value = "鏌ョ湅涓绘暟鎹紪鐮佽鍒欑殑浣跨敤鑼冨洿", notes = "浼犲叆oid") + public R<Collection<CodeClassifyVO>> listUseRange(@Valid @RequestParam String oid){ + Collection<CodeClassifyVO> voList = codeRuleService.listUseRangeInCodeClassify(oid); + return R.data(voList); + } + + /** + * 鍋滅敤涓庡惎鐢ㄧ紪鐮佽鍒� + * @param map 灏佽鍙傛暟锛屽寘鎷琽id 缂栫爜瑙勫垯涓婚敭 update 鏇存柊鐘舵�佺殑鎿嶄綔 + * @return 鎵ц缁撴灉 + */ + @PostMapping ("/updateStatus") + @ApiOperationSupport(order = 12) + @ApiOperation(value = "鍋滅敤涓庡惎鐢ㄧ紪鐮佽鍒�", notes = "浼犲叆map") + public R updateStatus(@Valid @RequestBody Map<String,String> map){ + if (CollectionUtils.isEmpty(map)){ + return R.fail("鍙傛暟閿欒"); + } + String oid = map.get("oid"); + String update = map.get("update"); + return codeRuleService.updateStatus(oid,update); + } + + /** + * 鍏嬮殕缂栫爜瑙勫垯 + * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈� + * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞� + */ + @PostMapping("/clone") + @ApiOperationSupport(order = 13) + @ApiOperation(value = "鍏嬮殕缂栫爜瑙勫垯", notes = "浼犲叆codeRuleDTO") + public R cloneCodeRule(@RequestBody CodeRuleDTO codeRuleDTO){ + return codeRuleService.cloneCodeRule(codeRuleDTO); + } + + /** + * 缂栫爜瑙勫垯娓呯┖鎵�鏈夊凡鐢熸垚鐨勭紪鐮� + * @param oid 缂栫爜瑙勫垯涓婚敭 + * @return 鎵ц缁撴灉 + */ + @DeleteMapping("/clearAllCode") + @ApiOperationSupport(order = 14) + @ApiOperation(value = "缂栫爜瑙勫垯娓呯┖鎵�鏈夊凡鐢熸垚鐨勭紪鐮�", notes = "浼犲叆oid") + public R clearAllCode(String oid){ + return codeRuleService.clearAllCode(oid); + } + } -- Gitblit v1.9.3