From 71a2a8245db4c04be3f96a9eb9b47931d3130650 Mon Sep 17 00:00:00 2001 From: zlyx <1242874891@qq.com> Date: 星期三, 18 一月 2023 17:09:43 +0800 Subject: [PATCH] refactor 重构 common, framework 包结构, 参照 cloud 版本拆分子模块 ; update 更新模块包名 ; delete 移除 sms 模块, oss 模块, framework 模块 (并入 common 模块) ; --- ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java | 35 +++++++++++++++++++---------------- 1 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java index 39cf3eb..84468c6 100644 --- a/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java +++ b/ruoyi-demo/src/main/java/com/ruoyi/demo/controller/TestBatchController.java @@ -1,12 +1,10 @@ package com.ruoyi.demo.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.R; +import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.demo.domain.TestDemo; import com.ruoyi.demo.mapper.TestDemoMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -22,7 +20,6 @@ * @author Lion Li * @date 2021-05-30 */ -@Api(value = "娴嬭瘯鎵归噺鏂规硶", tags = {"娴嬭瘯鎵归噺鏂规硶"}) @RequiredArgsConstructor @RestController @RequestMapping("/demo/batch") @@ -38,15 +35,18 @@ * <p> * 3.5.0 鐗堟湰 澧炲姞 rewriteBatchedStatements=true 鎵瑰鐞嗗弬鏁� 浣� MP 鍘熺敓鎵瑰鐞嗗彲浠ヨ揪鍒板悓鏍风殑閫熷害 */ - @ApiOperation(value = "鏂板鎵归噺鏂规硶") @PostMapping("/add") // @DS("slave") - public AjaxResult<Void> add() { + public R<Void> add() { List<TestDemo> list = new ArrayList<>(); for (int i = 0; i < 1000; i++) { - list.add(new TestDemo().setOrderNum(-1L).setTestKey("鎵归噺鏂板").setValue("娴嬭瘯鏂板")); + TestDemo testDemo = new TestDemo(); + testDemo.setOrderNum(-1); + testDemo.setTestKey("鎵归噺鏂板"); + testDemo.setValue("娴嬭瘯鏂板"); + list.add(testDemo); } - return toAjax(testDemoMapper.insertBatch(list) ? 1 : 0); + return toAjax(testDemoMapper.insertBatch(list)); } /** @@ -54,32 +54,35 @@ * <p> * 3.5.0 鐗堟湰 澧炲姞 rewriteBatchedStatements=true 鎵瑰鐞嗗弬鏁� 浣� MP 鍘熺敓鎵瑰鐞嗗彲浠ヨ揪鍒板悓鏍风殑閫熷害 */ - @ApiOperation(value = "鏂板鎴栨洿鏂版壒閲忔柟娉�") @PostMapping("/addOrUpdate") // @DS("slave") - public AjaxResult<Void> addOrUpdate() { + public R<Void> addOrUpdate() { List<TestDemo> list = new ArrayList<>(); for (int i = 0; i < 1000; i++) { - list.add(new TestDemo().setOrderNum(-1L).setTestKey("鎵归噺鏂板").setValue("娴嬭瘯鏂板")); + TestDemo testDemo = new TestDemo(); + testDemo.setOrderNum(-1); + testDemo.setTestKey("鎵归噺鏂板"); + testDemo.setValue("娴嬭瘯鏂板"); + list.add(testDemo); } testDemoMapper.insertBatch(list); for (int i = 0; i < list.size(); i++) { TestDemo testDemo = list.get(i); - testDemo.setTestKey("鎵归噺鏂板鎴栦慨鏀�").setValue("鎵归噺鏂板鎴栦慨鏀�"); + testDemo.setTestKey("鎵归噺鏂板鎴栦慨鏀�"); + testDemo.setValue("鎵归噺鏂板鎴栦慨鏀�"); if (i % 2 == 0) { testDemo.setId(null); } } - return toAjax(testDemoMapper.insertOrUpdateBatch(list) ? 1 : 0); + return toAjax(testDemoMapper.insertOrUpdateBatch(list)); } /** * 鍒犻櫎鎵归噺鏂规硶 */ - @ApiOperation(value = "鍒犻櫎鎵归噺鏂规硶") @DeleteMapping() // @DS("slave") - public AjaxResult<Void> remove() { + public R<Void> remove() { return toAjax(testDemoMapper.delete(new LambdaQueryWrapper<TestDemo>() .eq(TestDemo::getOrderNum, -1L))); } -- Gitblit v1.9.3