From 3534b13391b2a6152d0f91b72fda343b13a947cb Mon Sep 17 00:00:00 2001
From: ludc <ludc@vci-tech.com>
Date: 星期三, 22 一月 2025 15:55:27 +0800
Subject: [PATCH] 分类码段码值管理查询去除null的情况,分类码段生成编码时去除码值为null的情况

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeRuleController.java |  328 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 190 insertions(+), 138 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..b9d1367b 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,219 @@
+/*
+ *      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.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 org.springframework.beans.factory.annotation.Autowired;
+import com.vci.ubcs.code.wrapper.CodeRuleWrapper;
+import com.vci.ubcs.starter.web.pagemodel.BladeQueryObject;
+import com.vci.ubcs.starter.web.util.VciBaseUtil;
+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.tool.api.R;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
+import javax.validation.Valid;
+import java.rmi.ServerException;
 import java.util.Collection;
 import java.util.Map;
 
-
 /**
- * 涓绘暟鎹紪鐮佽鍒欐帶鍒跺櫒
+ * 缂栫爜瑙勫垯 鎺у埗鍣�
  *
- * @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));
+	}
 
+	/**
+	 * 缂栫爜瑙勫垯 鑷畾涔夊垎椤�
+	 * @return baseQueryObject
+	 */
+	@GetMapping(value = "/gridCodeRule")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "鍒嗛〉", notes = "浼犲叆CodeRule")
+	public R<IPage<CodeRuleVO>> gridCodeRule(BladeQueryObject bladeQueryObject) {
+		IPage<CodeRuleVO> pages = codeRuleService.gridCodeRule(bladeQueryObject.getQuery().setDescs("CREATETIME"), bladeQueryObject.getConditionMap());
+		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 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 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;
-    }
+	/**
+	 * 鍒犻櫎涓绘暟鎹紪鐮佽鍒�
+	 * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈�
+	 * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
+	 */
+	@DeleteMapping( "/deleteData")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "鍒犻櫎", notes = "浼犲叆codeRuleDTO")
+	public R delCodeRule(@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 baseQueryObject 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑
-     * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞″垪琛紝鐢熸晥鐨勫唴瀹�
-     */
-    @GetMapping("/refDataGrid")
-    public DataGrid<CodeRuleVO> refDataGridCodeRule(BaseQueryObject baseQueryObject){
-        if(baseQueryObject == null){
-            baseQueryObject = new BaseQueryObject();
-        }
-        return codeRuleService.refDataGridCodeRule(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
-    }
+	/**
+	 * 鍙傜収涓绘暟鎹紪鐮佽鍒欏垪琛�
+	 * @param bladeQueryObject
+	 * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞″垪琛紝鐢熸晥鐨勫唴瀹�
+	 */
+	@GetMapping("/refDataGrid")
+	@ApiOperationSupport(order = 10)
+	@ApiOperation(value = "鍙傜収涓绘暟鎹紪鐮佽鍒欏垪琛�", notes = "浼犲叆oids")
+	public R<IPage<CodeRuleVO>> refDataGridCodeRule(BladeQueryObject bladeQueryObject){
+		return R.data(codeRuleService.refDataGridCodeRule(bladeQueryObject));
+	}
 
-    /**
-     * 鏌ョ湅涓绘暟鎹紪鐮佽鍒欑殑浣跨敤鑼冨洿
-     * @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 oid 涓婚敭
+	 * @return 浣跨敤鑼冨洿
+	 */
+	@GetMapping("/listUseRange")
+	@ApiOperationSupport(order = 11)
+	@ApiOperation(value = "鏌ョ湅涓绘暟鎹紪鐮佽鍒欑殑浣跨敤鑼冨洿", notes = "浼犲叆oid")
+	public R<Collection<CodeClassifyVO>> listUseRange(@Valid @RequestParam String oid){
+		return R.data(codeRuleService.listUseRangeInCodeClassify(oid));
+	}
 
-    /**
-     * 鍋滅敤涓庡惎鐢ㄧ紪鐮佽鍒�
-     * @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 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")
-    public BaseResult cloneCodeRule(@RequestBody CodeRuleDTO codeRuleDTO){
-        return codeRuleService.cloneCodeRule(codeRuleDTO);
-    }
+	/**
+	 * 鍏嬮殕缂栫爜瑙勫垯
+	 * @param codeRuleDTO 涓绘暟鎹紪鐮佽鍒欐暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈�
+	 * @return 涓绘暟鎹紪鐮佽鍒欐樉绀哄璞�
+	 */
+	@PostMapping("/clone")
+	@ApiOperationSupport(order = 13)
+	@ApiOperation(value = "鍏嬮殕缂栫爜瑙勫垯", notes = "浼犲叆codeRuleDTO")
+	public R cloneCodeRule(@RequestBody CodeRuleDTO codeRuleDTO) throws ServerException {
+		return codeRuleService.cloneCodeRule(codeRuleDTO);
+	}
 
-    /**
-     * 缂栫爜瑙勫垯娓呯┖鎵�鏈夊凡鐢熸垚鐨勭紪鐮�
-     * @param oid 缂栫爜瑙勫垯涓婚敭
-     * @return 鎵ц缁撴灉
-     */
-    @DeleteMapping("/clearAllCode")
-    public BaseResult clearAllCode(String oid){
-        return codeRuleService.clearAllCode(oid);
-    }
+	/**
+	 * 缂栫爜瑙勫垯娓呯┖鎵�鏈夊凡鐢熸垚鐨勭紪鐮�
+	 * @param oid 缂栫爜瑙勫垯涓婚敭
+	 * @return 鎵ц缁撴灉
+	 */
+	@DeleteMapping("/clearAllCode")
+	@ApiOperationSupport(order = 14)
+	@ApiOperation(value = "缂栫爜瑙勫垯娓呯┖鎵�鏈夊凡鐢熸垚鐨勭紪鐮�", notes = "浼犲叆oid")
+	public R clearAllCode(String oid){
+		return codeRuleService.clearAllCode(oid);
+	}
+
+	/**
+	 * 妫�鏌ョ浉浼肩紪鐮佽鍒�
+	 * @param oid
+	 * @return 鎵ц缁撴灉
+	 */
+	@GetMapping("/checkLikeCodeRule")
+	@ApiOperationSupport(order = 15)
+	@ApiOperation(value = "妫�鏌ョ浉浼肩紪鐮佽鍒�", notes = "浼犲叆oid")
+	public R checkLikeCodeRule(@Valid @RequestParam String oid){
+		return codeRuleService.checkLikeCodeRule(oid);
+	}
+
 }

--
Gitblit v1.9.3