From 1b8120cacac0037fcb1f8ae747c2f54eb735368b Mon Sep 17 00:00:00 2001
From: ludc
Date: 星期二, 09 五月 2023 18:50:51 +0800
Subject: [PATCH] 代码整合

---
 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeButtonController.java |  152 ++++++++++++++++++++++++++------------------------
 1 files changed, 78 insertions(+), 74 deletions(-)

diff --git a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeButtonController.java b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeButtonController.java
index be3cfa6..ddf9b95 100644
--- a/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeButtonController.java
+++ b/Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/controller/CodeButtonController.java
@@ -19,11 +19,15 @@
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.vci.ubcs.code.dto.CodeButtonDTO;
 import com.vci.ubcs.code.entity.CodeButton;
 import com.vci.ubcs.code.mapper.CodeButtonMapper;
 import com.vci.ubcs.code.service.ICodeButtonService;
 import com.vci.ubcs.code.vo.pagemodel.CodeButtonVO;
 import com.vci.ubcs.code.wrapper.CodeButtonWrapper;
+import com.vci.ubcs.starter.web.pagemodel.BaseQueryObject;
+import com.vci.ubcs.starter.web.pagemodel.DataGrid;
+import com.vci.ubcs.starter.web.util.VciBaseUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -38,6 +42,7 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
+import java.util.Collection;
 
 /**
  * 妯℃澘鎵╁睍姹� 鎺у埗鍣�
@@ -47,90 +52,90 @@
  */
 @RestController
 @AllArgsConstructor
-@RequestMapping("/codebutton")
+@RequestMapping("/codeButtonController")
 @Api(value = "妯℃澘鎵╁睍姹�", tags = "妯℃澘鎵╁睍姹犳帴鍙�")
 public class CodeButtonController extends BladeController {
 
-	private final ICodeButtonService codebuttonService;
-
-	CodeButtonMapper codeButtonMapper;
+	private final ICodeButtonService codeButtonService;
 
 	/**
-	 * 妯℃澘鎵╁睍姹� 璇︽儏
+	 * 涓绘暟鎹腑鐨勬寜閽墿灞曞垪琛�
+	 * @param baseQueryObject 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑
+	 * @return 涓绘暟鎹腑鐨勬寜閽墿灞曟樉绀哄璞″垪琛�
 	 */
-	@GetMapping("/detail")
-	@ApiOperationSupport(order = 1)
-	@ApiOperation(value = "璇︽儏", notes = "浼犲叆codebutton")
-	public R<CodeButtonVO> detail(CodeButton codebutton) {
-		CodeButton detail = codeButtonMapper.selectOne(Condition.getQueryWrapper(codebutton));
-		return R.data(CodeButtonWrapper.build().entityVO(detail));
-	}
-	/**
-	 * 妯℃澘鎵╁睍姹� 鍒嗛〉
-	 */
-	@GetMapping("/list")
-	@ApiOperationSupport(order = 2)
-	@ApiOperation(value = "鍒嗛〉", notes = "浼犲叆codebutton")
-	public R<IPage<CodeButtonVO>> list(CodeButton codebutton, Query query) {
-		IPage<CodeButton> pages = codeButtonMapper.selectPage(Condition.getPage(query), Condition.getQueryWrapper(codebutton));
-		return R.data(CodeButtonWrapper.build().pageVO(pages));
-	}
-
-	/**
-	 * 妯℃澘鎵╁睍姹� 鑷畾涔夊垎椤�
-	 */
-	@GetMapping("/page")
-	@ApiOperationSupport(order = 3)
-	@ApiOperation(value = "鍒嗛〉", notes = "浼犲叆codebutton")
-	public R<IPage<CodeButtonVO>> page(CodeButtonVO codebutton, Query query) {
-		IPage<CodeButtonVO> pages = codebuttonService.selectcodebuttonPage(Condition.getPage(query), codebutton);
-		return R.data(pages);
-	}
-
-	/**
-	 * 妯℃澘鎵╁睍姹� 鏂板
-	 */
-	@PostMapping("/save")
-	@ApiOperationSupport(order = 4)
-	@ApiOperation(value = "鏂板", notes = "浼犲叆codebutton")
-	public R save(@Valid @RequestBody CodeButton codebutton) {
-		return R.status(SqlHelper.retBool(codeButtonMapper.insert(codebutton)));
-	}
-
-	/**
-	 * 妯℃澘鎵╁睍姹� 淇敼
-	 */
-	@PostMapping("/update")
-	@ApiOperationSupport(order = 5)
-	@ApiOperation(value = "淇敼", notes = "浼犲叆codebutton")
-	public R update(@Valid @RequestBody CodeButton codebutton) {
-		return R.status(SqlHelper.retBool(codeButtonMapper.updateById(codebutton)));
-	}
-
-	/**
-	 * 妯℃澘鎵╁睍姹� 鏂板鎴栦慨鏀�
-	 */
-	@PostMapping("/submit")
-	@ApiOperationSupport(order = 6)
-	@ApiOperation(value = "鏂板鎴栦慨鏀�", notes = "浼犲叆codebutton")
-	public R submit(@Valid @RequestBody CodeButton codebutton) {
-		if(codebutton.getOid() != null){
-			return R.status(SqlHelper.retBool(codeButtonMapper.updateById(codebutton)));
+	@GetMapping("/gridCodeButton")
+	public R<IPage<CodeButtonVO>> gridCodeButton(BaseQueryObject baseQueryObject){
+		if(baseQueryObject == null){
+			baseQueryObject = new BaseQueryObject();
 		}
-		return R.status(SqlHelper.retBool(codeButtonMapper.insert(codebutton)));
+		return R.data(codeButtonService.gridCodeButton(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()));
 	}
 
 	/**
-	 * 妯℃澘鎵╁睍姹� 鍒犻櫎
+	 * 澧炲姞 涓绘暟鎹腑鐨勬寜閽墿灞�
+	 * @param codeButtonDTO 涓绘暟鎹腑鐨勬寜閽墿灞曟暟鎹紶杈撳璞�
+	 * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞�
 	 */
-	@PostMapping("/remove")
-	@ApiOperationSupport(order = 7)
-	@ApiOperation(value = "閫昏緫鍒犻櫎", notes = "浼犲叆ids")
-	public R remove(@ApiParam(value = "涓婚敭闆嗗悎", required = true) @RequestParam String ids) {
-//		return codebuttonService.deleteCodeButton(ids);
-		return R.status(SqlHelper.retBool(codeButtonMapper.deleteBatchIds(Func.toLongList(ids))));
+	@PostMapping( "/addSave")
+	public R<CodeButtonVO> addSave(@RequestBody CodeButtonDTO codeButtonDTO){
+		CodeButtonVO codeButtonVO = codeButtonService.addSave(codeButtonDTO);
+		return R.data(codeButtonVO);
 	}
 
+	/**
+	 * 淇敼 涓绘暟鎹腑鐨勬寜閽墿灞�
+	 * @param codeButtonDTO 涓绘暟鎹腑鐨勬寜閽墿灞曟暟鎹紶杈撳璞�
+	 * @return 鎵ц缁撴灉锛宻uccess涓簍rue琛ㄧず鎴愬姛锛宮sg鏄け璐ョ殑鎻愮ず淇℃伅锛宱bj鏄坊鍔犲畬鎴愬悗鐨勬樉绀哄璞�
+	 */
+	@PutMapping("/editSave")
+	public R<CodeButtonVO> editSave(@RequestBody CodeButtonDTO codeButtonDTO){
+		CodeButtonVO codeButtonVO = codeButtonService.editSave(codeButtonDTO);
+		return R.data(codeButtonVO);
+	}
+
+	/**
+	 * 鍒犻櫎涓绘暟鎹腑鐨勬寜閽墿灞�
+	 * @param codeButtonDTO 涓绘暟鎹腑鐨勬寜閽墿灞曟暟鎹紶杈撳璞★紝oid鍜宼s闇�瑕佷紶杈�
+	 * @return 鍒犻櫎缁撴灉鍙嶉锛氾細success锛氭垚鍔燂紝fail锛氬け璐�
+	 */
+	@DeleteMapping( "/deleteData")
+	public R delCodeButton( CodeButtonDTO codeButtonDTO) {
+		return codeButtonService.deleteCodeButton(codeButtonDTO);
+	}
+
+	/**
+	 * 涓婚敭鑾峰彇涓绘暟鎹腑鐨勬寜閽墿灞�
+	 * @param oid 涓婚敭
+	 * @return 涓绘暟鎹腑鐨勬寜閽墿灞曟樉绀哄璞�
+	 */
+	@GetMapping("/getObjectByOid")
+	public R<CodeButtonVO> getObjectByOid(String oid){
+		CodeButtonVO codeButtonVO = codeButtonService.getObjectByOid(oid);
+		return R.data(codeButtonVO);
+	}
+
+	/**
+	 * 涓婚敭鎵归噺鑾峰彇涓绘暟鎹腑鐨勬寜閽墿灞�
+	 * @param oids 涓婚敭锛屽涓互閫楀彿鍒嗛殧锛屼絾鏄彈鎬ц兘褰卞搷锛屽缓璁竴娆℃煡璇笉瓒呰繃10000涓�
+	 * @return 涓绘暟鎹腑鐨勬寜閽墿灞曟樉绀哄璞�
+	 */
+	@GetMapping("/listDataByOids")
+	public R<Collection<CodeButtonVO>> listCodeButtonByOids(String oids){
+		return R.data(codeButtonService.listCodeButtonByOids(VciBaseUtil.str2List(oids)));
+	}
+
+	/**
+	 * 鍙傜収涓绘暟鎹腑鐨勬寜閽墿灞曞垪琛�
+	 * @param baseQueryObject 鍩虹鏌ヨ瀵硅薄锛屽寘鍚煡璇㈡潯浠讹紝鍒嗛〉锛屾帓搴忕瓑
+	 * @return 涓绘暟鎹腑鐨勬寜閽墿灞曟樉绀哄璞″垪琛紝鐢熸晥鐨勫唴瀹�
+	 */
+	@GetMapping("/refDataGrid")
+	public R<IPage<CodeButtonVO>> refDataGridCodeButton(BaseQueryObject baseQueryObject){
+		if(baseQueryObject == null){
+			baseQueryObject = new BaseQueryObject();
+		}
+		return R.data(codeButtonService.refDataGridCodeButton(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper()));
+	}
 
 	/**
 	 * 鍚敤
@@ -139,7 +144,7 @@
 	 */
 	@PostMapping("/enableData")
 	public R enableOrgDuty(@ApiParam(value = "涓婚敭闆嗗悎", required = true) @RequestParam String oid) {
-		return codebuttonService.enableCodeButton(oid);
+		return codeButtonService.enableCodeButton(oid);
 	}
 
 	/**
@@ -149,8 +154,7 @@
 	 */
 	@PostMapping("/disableData")
 	public R disableOrgDuty(@ApiParam(value = "涓婚敭闆嗗悎", required = true) @RequestParam String oid) {
-		return codebuttonService.disableOrgDuty(oid);
+		return codeButtonService.disableOrgDuty(oid);
 	}
-
 
 }

--
Gitblit v1.9.3