mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 17:58:17 +08:00
删除无用demo
This commit is contained in:
parent
b51b8b1b41
commit
874228db13
4
pom.xml
4
pom.xml
@ -177,7 +177,7 @@
|
|||||||
<!-- demo模块 -->
|
<!-- demo模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-demo</artifactId>
|
<artifactId>ruoyi-mes</artifactId>
|
||||||
<version>${ruoyi-vue-plus.version}</version>
|
<version>${ruoyi-vue-plus.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -191,7 +191,7 @@
|
|||||||
<module>ruoyi-quartz</module>
|
<module>ruoyi-quartz</module>
|
||||||
<module>ruoyi-generator</module>
|
<module>ruoyi-generator</module>
|
||||||
<module>ruoyi-common</module>
|
<module>ruoyi-common</module>
|
||||||
<module>ruoyi-demo</module>
|
<module>ruoyi-mes</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|||||||
@ -51,7 +51,7 @@
|
|||||||
<!-- demo模块 -->
|
<!-- demo模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<artifactId>ruoyi-demo</artifactId>
|
<artifactId>ruoyi-mes</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@ -12,9 +12,9 @@ spring:
|
|||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
|
url: jdbc:mysql://47.92.199.156:3306/mes?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: mes_admin
|
||||||
password: root
|
password: mes_admin_123456
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
driverClassName: com.mysql.cj.jdbc.Driver
|
||||||
|
|||||||
@ -1,47 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表添加对象 test_demo
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试单表添加对象")
|
|
||||||
public class TestDemoAddBo {
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 排序号 */
|
|
||||||
@ApiModelProperty("排序号")
|
|
||||||
private Long orderNum;
|
|
||||||
|
|
||||||
/** key键 */
|
|
||||||
@ApiModelProperty("key键")
|
|
||||||
@NotBlank(message = "key键不能为空")
|
|
||||||
private String testKey;
|
|
||||||
|
|
||||||
/** 值 */
|
|
||||||
@ApiModelProperty("值")
|
|
||||||
@NotBlank(message = "值不能为空")
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
/** 创建时间 */
|
|
||||||
@ApiModelProperty("创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表编辑对象 test_demo
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试单表编辑对象")
|
|
||||||
public class TestDemoEditBo {
|
|
||||||
|
|
||||||
|
|
||||||
/** 主键 */
|
|
||||||
@ApiModelProperty("主键")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 排序号 */
|
|
||||||
@ApiModelProperty("排序号")
|
|
||||||
private Long orderNum;
|
|
||||||
|
|
||||||
|
|
||||||
/** key键 */
|
|
||||||
@ApiModelProperty("key键")
|
|
||||||
@NotBlank(message = "key键不能为空")
|
|
||||||
private String testKey;
|
|
||||||
|
|
||||||
|
|
||||||
/** 值 */
|
|
||||||
@ApiModelProperty("值")
|
|
||||||
@NotBlank(message = "值不能为空")
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表分页查询对象 test_demo
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ApiModel("测试单表分页查询对象")
|
|
||||||
public class TestDemoQueryBo extends BaseEntity {
|
|
||||||
|
|
||||||
/** 分页大小 */
|
|
||||||
@ApiModelProperty("分页大小")
|
|
||||||
private Integer pageSize;
|
|
||||||
/** 当前页数 */
|
|
||||||
@ApiModelProperty("当前页数")
|
|
||||||
private Integer pageNum;
|
|
||||||
/** 排序列 */
|
|
||||||
@ApiModelProperty("排序列")
|
|
||||||
private String orderByColumn;
|
|
||||||
/** 排序的方向desc或者asc */
|
|
||||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
|
||||||
private String isAsc;
|
|
||||||
|
|
||||||
|
|
||||||
/** key键 */
|
|
||||||
@ApiModelProperty("key键")
|
|
||||||
private String testKey;
|
|
||||||
/** 值 */
|
|
||||||
@ApiModelProperty("值")
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.util.Date;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表添加对象 test_tree
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试树表添加对象")
|
|
||||||
public class TestTreeAddBo {
|
|
||||||
|
|
||||||
/** 父id */
|
|
||||||
@ApiModelProperty("父id")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 树节点名 */
|
|
||||||
@ApiModelProperty("树节点名")
|
|
||||||
@NotBlank(message = "树节点名不能为空")
|
|
||||||
private String treeName;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import lombok.Data;
|
|
||||||
import java.util.Date;
|
|
||||||
import javax.validation.constraints.*;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表编辑对象 test_tree
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试树表编辑对象")
|
|
||||||
public class TestTreeEditBo {
|
|
||||||
|
|
||||||
|
|
||||||
/** 主键 */
|
|
||||||
@ApiModelProperty("主键")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
|
|
||||||
/** 父id */
|
|
||||||
@ApiModelProperty("父id")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
|
|
||||||
/** 树节点名 */
|
|
||||||
@ApiModelProperty("树节点名")
|
|
||||||
@NotBlank(message = "树节点名不能为空")
|
|
||||||
private String treeName;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
package com.ruoyi.demo.bo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表分页查询对象 test_tree
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@ApiModel("测试树表分页查询对象")
|
|
||||||
public class TestTreeQueryBo extends BaseEntity {
|
|
||||||
|
|
||||||
/** 分页大小 */
|
|
||||||
@ApiModelProperty("分页大小")
|
|
||||||
private Integer pageSize;
|
|
||||||
/** 当前页数 */
|
|
||||||
@ApiModelProperty("当前页数")
|
|
||||||
private Integer pageNum;
|
|
||||||
/** 排序列 */
|
|
||||||
@ApiModelProperty("排序列")
|
|
||||||
private String orderByColumn;
|
|
||||||
/** 排序的方向desc或者asc */
|
|
||||||
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
|
||||||
private String isAsc;
|
|
||||||
|
|
||||||
|
|
||||||
/** 树节点名 */
|
|
||||||
@ApiModelProperty("树节点名")
|
|
||||||
private String treeName;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
package com.ruoyi.demo.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.demo.feign.FeignTestService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* feign测试controller
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/feign/test")
|
|
||||||
public class FeignTestController {
|
|
||||||
|
|
||||||
private final FeignTestService feignTestService;
|
|
||||||
|
|
||||||
@GetMapping("/search/{wd}")
|
|
||||||
public AjaxResult search(@PathVariable String wd) {
|
|
||||||
String search = feignTestService.search(wd);
|
|
||||||
return AjaxResult.success("操作成功",search);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
package com.ruoyi.demo.controller;
|
|
||||||
|
|
||||||
import com.baomidou.lock.LockInfo;
|
|
||||||
import com.baomidou.lock.LockTemplate;
|
|
||||||
import com.baomidou.lock.annotation.Lock4j;
|
|
||||||
import com.baomidou.lock.executor.RedissonLockExecutor;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.time.LocalTime;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试分布式锁的样例
|
|
||||||
*
|
|
||||||
* @author shenxinquan
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/demo/redisLock")
|
|
||||||
public class RedisLockController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private LockTemplate lockTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试lock4j 注解
|
|
||||||
*/
|
|
||||||
@Lock4j(keys = {"#key"})
|
|
||||||
@GetMapping("/testLock4j")
|
|
||||||
public AjaxResult<String> testLock4j(String key,String value){
|
|
||||||
System.out.println("start:"+key+",time:"+ LocalTime.now().toString());
|
|
||||||
try {
|
|
||||||
Thread.sleep(10000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
System.out.println("end :"+key+",time:"+LocalTime.now().toString());
|
|
||||||
return AjaxResult.success("操作成功",value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试lock4j 工具
|
|
||||||
*/
|
|
||||||
@GetMapping("/testLock4jLockTemaplate")
|
|
||||||
public AjaxResult<String> testLock4jLockTemaplate(String key,String value){
|
|
||||||
final LockInfo lockInfo = lockTemplate.lock(key, 30000L, 5000L, RedissonLockExecutor.class);
|
|
||||||
if (null == lockInfo) {
|
|
||||||
throw new RuntimeException("业务处理中,请稍后再试");
|
|
||||||
}
|
|
||||||
// 获取锁成功,处理业务
|
|
||||||
try {
|
|
||||||
try {
|
|
||||||
Thread.sleep(8000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
System.out.println("执行简单方法1 , 当前线程:" + Thread.currentThread().getName());
|
|
||||||
} finally {
|
|
||||||
//释放锁
|
|
||||||
lockTemplate.releaseLock(lockInfo);
|
|
||||||
}
|
|
||||||
//结束
|
|
||||||
return AjaxResult.success("操作成功",value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试spring-cache注解
|
|
||||||
*/
|
|
||||||
@Cacheable(value = "test", key = "#key")
|
|
||||||
@GetMapping("/testCache")
|
|
||||||
public AjaxResult<String> testCache(String key) {
|
|
||||||
return AjaxResult.success("操作成功", key);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
package com.ruoyi.demo.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestPart;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* swagger3 用法示例
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@Api(value = "演示swagger3控制器", tags = {"演示swagger3接口"})
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/swagger/demo")
|
|
||||||
public class Swagger3DemoController {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上传请求
|
|
||||||
* 必须使用 @RequestPart 注解标注为文件
|
|
||||||
* dataType 必须为 "java.io.File"
|
|
||||||
*/
|
|
||||||
@ApiOperation(value = "通用上传请求")
|
|
||||||
@ApiImplicitParams({
|
|
||||||
@ApiImplicitParam(name = "file", value = "文件", dataType = "java.io.File", required = true),
|
|
||||||
})
|
|
||||||
@PostMapping(value = "/upload")
|
|
||||||
public AjaxResult<String> upload(@RequestPart("file") MultipartFile file) {
|
|
||||||
return AjaxResult.success("操作成功", file.getOriginalFilename());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
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.demo.domain.TestDemo;
|
|
||||||
import com.ruoyi.demo.service.ITestDemoService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试批量方法
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/demo/batch")
|
|
||||||
public class TestBatchController extends BaseController {
|
|
||||||
|
|
||||||
private final ITestDemoService iTestDemoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增批量方法
|
|
||||||
*/
|
|
||||||
@PostMapping()
|
|
||||||
public AjaxResult<Void> add() {
|
|
||||||
List<TestDemo> list = new ArrayList<>();
|
|
||||||
for (int i = 0; i < 1000; i++) {
|
|
||||||
list.add(new TestDemo().setOrderNum(-1L).setTestKey("批量新增").setValue("测试新增"));
|
|
||||||
}
|
|
||||||
return toAjax(iTestDemoService.saveAll(list) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改批量方法
|
|
||||||
*/
|
|
||||||
@DeleteMapping()
|
|
||||||
public AjaxResult<Void> edit() {
|
|
||||||
return toAjax(iTestDemoService.remove(new LambdaQueryWrapper<TestDemo>()
|
|
||||||
.eq(TestDemo::getOrderNum, -1L)) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
package com.ruoyi.demo.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoEditBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoQueryBo;
|
|
||||||
import com.ruoyi.demo.service.ITestDemoService;
|
|
||||||
import com.ruoyi.demo.vo.TestDemoVo;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表Controller
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Api(value = "测试单表控制器", tags = {"测试单表管理"})
|
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/demo/demo")
|
|
||||||
public class TestDemoController extends BaseController {
|
|
||||||
|
|
||||||
private final ITestDemoService iTestDemoService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询测试单表列表
|
|
||||||
*/
|
|
||||||
@ApiOperation("查询测试单表列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:list')")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo<TestDemoVo> list(@Validated TestDemoQueryBo bo) {
|
|
||||||
return iTestDemoService.queryPageList(bo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出测试单表列表
|
|
||||||
*/
|
|
||||||
@ApiOperation("导出测试单表列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:export')")
|
|
||||||
@Log(title = "测试单表", businessType = BusinessType.EXPORT)
|
|
||||||
@GetMapping("/export")
|
|
||||||
public AjaxResult<TestDemoVo> export(@Validated TestDemoQueryBo bo) {
|
|
||||||
List<TestDemoVo> list = iTestDemoService.queryList(bo);
|
|
||||||
ExcelUtil<TestDemoVo> util = new ExcelUtil<TestDemoVo>(TestDemoVo.class);
|
|
||||||
return util.exportExcel(list, "测试单表");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取测试单表详细信息
|
|
||||||
*/
|
|
||||||
@ApiOperation("获取测试单表详细信息")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:query')")
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public AjaxResult<TestDemoVo> getInfo(@NotNull(message = "主键不能为空")
|
|
||||||
@PathVariable("id") Long id) {
|
|
||||||
return AjaxResult.success(iTestDemoService.queryById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增测试单表
|
|
||||||
*/
|
|
||||||
@ApiOperation("新增测试单表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:add')")
|
|
||||||
@Log(title = "测试单表", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping()
|
|
||||||
public AjaxResult<Void> add(@Validated @RequestBody TestDemoAddBo bo) {
|
|
||||||
return toAjax(iTestDemoService.insertByAddBo(bo) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改测试单表
|
|
||||||
*/
|
|
||||||
@ApiOperation("修改测试单表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:edit')")
|
|
||||||
@Log(title = "测试单表", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping()
|
|
||||||
public AjaxResult<Void> edit(@Validated @RequestBody TestDemoEditBo bo) {
|
|
||||||
return toAjax(iTestDemoService.updateByEditBo(bo) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除测试单表
|
|
||||||
*/
|
|
||||||
@ApiOperation("删除测试单表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:demo:remove')")
|
|
||||||
@Log(title = "测试单表" , businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
||||||
@PathVariable Long[] ids) {
|
|
||||||
return toAjax(iTestDemoService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,107 +0,0 @@
|
|||||||
package com.ruoyi.demo.controller;
|
|
||||||
|
|
||||||
import com.ruoyi.common.annotation.Log;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeEditBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeQueryBo;
|
|
||||||
import com.ruoyi.demo.service.ITestTreeService;
|
|
||||||
import com.ruoyi.demo.vo.TestTreeVo;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表Controller
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Api(value = "测试树表控制器", tags = {"测试树表管理"})
|
|
||||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/demo/tree")
|
|
||||||
public class TestTreeController extends BaseController {
|
|
||||||
|
|
||||||
private final ITestTreeService iTestTreeService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询测试树表列表
|
|
||||||
*/
|
|
||||||
@ApiOperation("查询测试树表列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:list')")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public AjaxResult<List<TestTreeVo>> list(@Validated TestTreeQueryBo bo) {
|
|
||||||
return AjaxResult.success(iTestTreeService.queryList(bo));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 导出测试树表列表
|
|
||||||
*/
|
|
||||||
@ApiOperation("导出测试树表列表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:export')")
|
|
||||||
@Log(title = "测试树表", businessType = BusinessType.EXPORT)
|
|
||||||
@GetMapping("/export")
|
|
||||||
public AjaxResult<TestTreeVo> export(@Validated TestTreeQueryBo bo) {
|
|
||||||
List<TestTreeVo> list = iTestTreeService.queryList(bo);
|
|
||||||
ExcelUtil<TestTreeVo> util = new ExcelUtil<TestTreeVo>(TestTreeVo.class);
|
|
||||||
return util.exportExcel(list, "测试树表");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取测试树表详细信息
|
|
||||||
*/
|
|
||||||
@ApiOperation("获取测试树表详细信息")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:query')")
|
|
||||||
@GetMapping("/{id}")
|
|
||||||
public AjaxResult<TestTreeVo> getInfo(@NotNull(message = "主键不能为空")
|
|
||||||
@PathVariable("id") Long id) {
|
|
||||||
return AjaxResult.success(iTestTreeService.queryById(id));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增测试树表
|
|
||||||
*/
|
|
||||||
@ApiOperation("新增测试树表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:add')")
|
|
||||||
@Log(title = "测试树表", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping()
|
|
||||||
public AjaxResult<Void> add(@Validated @RequestBody TestTreeAddBo bo) {
|
|
||||||
return toAjax(iTestTreeService.insertByAddBo(bo) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改测试树表
|
|
||||||
*/
|
|
||||||
@ApiOperation("修改测试树表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:edit')")
|
|
||||||
@Log(title = "测试树表", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping()
|
|
||||||
public AjaxResult<Void> edit(@Validated @RequestBody TestTreeEditBo bo) {
|
|
||||||
return toAjax(iTestTreeService.updateByEditBo(bo) ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除测试树表
|
|
||||||
*/
|
|
||||||
@ApiOperation("删除测试树表")
|
|
||||||
@PreAuthorize("@ss.hasPermi('demo:tree:remove')")
|
|
||||||
@Log(title = "测试树表" , businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
||||||
@PathVariable Long[] ids) {
|
|
||||||
return toAjax(iTestTreeService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.controller;
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
package com.ruoyi.demo.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表对象 test_demo
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("test_demo")
|
|
||||||
public class TestDemo implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
@TableId(value = "id")
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 排序号 */
|
|
||||||
@OrderBy(isDesc = false, sort = 1)
|
|
||||||
private Long orderNum;
|
|
||||||
|
|
||||||
/** key键 */
|
|
||||||
private String testKey;
|
|
||||||
|
|
||||||
/** 值 */
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
/** 版本 */
|
|
||||||
@Version
|
|
||||||
private Long version;
|
|
||||||
|
|
||||||
/** 创建时间 */
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/** 创建人 */
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/** 更新时间 */
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/** 更新人 */
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/** 删除标志 */
|
|
||||||
private Long delFlag;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
package com.ruoyi.demo.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表对象 test_tree
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@Accessors(chain = true)
|
|
||||||
@TableName("test_tree")
|
|
||||||
public class TestTree implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID=1L;
|
|
||||||
|
|
||||||
|
|
||||||
/** 主键 */
|
|
||||||
@TableId(value = "id")
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 父id */
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 树节点名 */
|
|
||||||
private String treeName;
|
|
||||||
|
|
||||||
/** 版本 */
|
|
||||||
@Version
|
|
||||||
private Long version;
|
|
||||||
|
|
||||||
/** 创建时间 */
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/** 创建人 */
|
|
||||||
@TableField(fill = FieldFill.INSERT)
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/** 更新时间 */
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/** 更新人 */
|
|
||||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
/** 删除标志 */
|
|
||||||
@TableLogic
|
|
||||||
private Long delFlag;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.domain;
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
package com.ruoyi.demo.feign;
|
|
||||||
|
|
||||||
import com.ruoyi.demo.feign.constant.FeignTestConstant;
|
|
||||||
import com.ruoyi.demo.feign.fallback.FeignTestFallback;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* feign测试service
|
|
||||||
* 规范接口 Service 无感调用
|
|
||||||
* 常量管理请求路径 更加规范
|
|
||||||
* 自定义容错处理 安全可靠
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@FeignClient(
|
|
||||||
name = FeignTestConstant.BAIDU_NAME,
|
|
||||||
url = FeignTestConstant.BAIDU_URL,
|
|
||||||
fallback = FeignTestFallback.class)
|
|
||||||
public interface FeignTestService {
|
|
||||||
|
|
||||||
@GetMapping("/s")
|
|
||||||
String search(@RequestParam("wd") String wd);
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
package com.ruoyi.demo.feign.constant;
|
|
||||||
|
|
||||||
public class FeignTestConstant {
|
|
||||||
|
|
||||||
public static final String BAIDU_NAME = "baidu";
|
|
||||||
|
|
||||||
public static final String BAIDU_URL = "http://www.baidu.com";
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
package com.ruoyi.demo.feign.fallback;
|
|
||||||
|
|
||||||
|
|
||||||
import com.ruoyi.demo.feign.FeignTestService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* feign测试fallback
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Component
|
|
||||||
public class FeignTestFallback implements FeignTestService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String search(String wd) {
|
|
||||||
log.error("fallback");
|
|
||||||
return "报错啦";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.feign.fallback;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.feign;
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package com.ruoyi.demo.mapper;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
|
||||||
import com.ruoyi.demo.domain.TestDemo;
|
|
||||||
import org.apache.ibatis.annotations.CacheNamespace;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表Mapper接口
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
|
||||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
|
||||||
public interface TestDemoMapper extends BaseMapperPlus<TestDemo> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
package com.ruoyi.demo.mapper;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
|
||||||
import com.ruoyi.demo.domain.TestTree;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表Mapper接口
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
//@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
|
||||||
public interface TestTreeMapper extends BaseMapperPlus<TestTree> {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.mapper;
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
package com.ruoyi.demo.service;
|
|
||||||
|
|
||||||
import com.ruoyi.demo.domain.TestDemo;
|
|
||||||
import com.ruoyi.demo.vo.TestDemoVo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoQueryBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoEditBo;
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表Service接口
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
public interface ITestDemoService extends IServicePlus<TestDemo> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询单个
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
TestDemoVo queryById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询列表
|
|
||||||
*/
|
|
||||||
TableDataInfo<TestDemoVo> queryPageList(TestDemoQueryBo bo);
|
|
||||||
/**
|
|
||||||
* 查询列表
|
|
||||||
*/
|
|
||||||
List<TestDemoVo> queryList(TestDemoQueryBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据新增业务对象插入测试单表
|
|
||||||
* @param bo 测试单表新增业务对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean insertByAddBo(TestDemoAddBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据编辑业务对象修改测试单表
|
|
||||||
* @param bo 测试单表编辑业务对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean updateByEditBo(TestDemoEditBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验并删除数据
|
|
||||||
* @param ids 主键集合
|
|
||||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
|
||||||
}
|
|
||||||
@ -1,52 +0,0 @@
|
|||||||
package com.ruoyi.demo.service;
|
|
||||||
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeEditBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeQueryBo;
|
|
||||||
import com.ruoyi.demo.domain.TestTree;
|
|
||||||
import com.ruoyi.demo.vo.TestTreeVo;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表Service接口
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
public interface ITestTreeService extends IServicePlus<TestTree> {
|
|
||||||
/**
|
|
||||||
* 查询单个
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
TestTreeVo queryById(Long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询列表
|
|
||||||
*/
|
|
||||||
List<TestTreeVo> queryList(TestTreeQueryBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据新增业务对象插入测试树表
|
|
||||||
* @param bo 测试树表新增业务对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean insertByAddBo(TestTreeAddBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据编辑业务对象修改测试树表
|
|
||||||
* @param bo 测试树表编辑业务对象
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean updateByEditBo(TestTreeEditBo bo);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验并删除数据
|
|
||||||
* @param ids 主键集合
|
|
||||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
|
||||||
}
|
|
||||||
@ -1,95 +0,0 @@
|
|||||||
package com.ruoyi.demo.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
||||||
import com.ruoyi.common.core.page.PagePlus;
|
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
|
||||||
import com.ruoyi.common.utils.PageUtils;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoEditBo;
|
|
||||||
import com.ruoyi.demo.bo.TestDemoQueryBo;
|
|
||||||
import com.ruoyi.demo.domain.TestDemo;
|
|
||||||
import com.ruoyi.demo.mapper.TestDemoMapper;
|
|
||||||
import com.ruoyi.demo.service.ITestDemoService;
|
|
||||||
import com.ruoyi.demo.vo.TestDemoVo;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表Service业务层处理
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class TestDemoServiceImpl extends ServicePlusImpl<TestDemoMapper, TestDemo> implements ITestDemoService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TestDemoVo queryById(Long id) {
|
|
||||||
return getVoById(id, TestDemoVo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DataScope(isUser = true)
|
|
||||||
@Override
|
|
||||||
public TableDataInfo<TestDemoVo> queryPageList(TestDemoQueryBo bo) {
|
|
||||||
PagePlus<TestDemo, TestDemoVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo), TestDemoVo.class);
|
|
||||||
return PageUtils.buildDataInfo(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
@DataScope(isUser = true)
|
|
||||||
@Override
|
|
||||||
public List<TestDemoVo> queryList(TestDemoQueryBo bo) {
|
|
||||||
return listVo(buildQueryWrapper(bo), TestDemoVo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private LambdaQueryWrapper<TestDemo> buildQueryWrapper(TestDemoQueryBo bo) {
|
|
||||||
Map<String, Object> params = bo.getParams();
|
|
||||||
Object dataScope = params.get("dataScope");
|
|
||||||
LambdaQueryWrapper<TestDemo> lqw = Wrappers.lambdaQuery();
|
|
||||||
lqw.like(StrUtil.isNotBlank(bo.getTestKey()), TestDemo::getTestKey, bo.getTestKey());
|
|
||||||
lqw.eq(StrUtil.isNotBlank(bo.getValue()), TestDemo::getValue, bo.getValue());
|
|
||||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
|
||||||
TestDemo::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
|
||||||
lqw.apply(dataScope != null && StrUtil.isNotBlank(dataScope.toString()),
|
|
||||||
dataScope != null ? dataScope.toString() : null);
|
|
||||||
return lqw;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean insertByAddBo(TestDemoAddBo bo) {
|
|
||||||
TestDemo add = BeanUtil.toBean(bo, TestDemo.class);
|
|
||||||
validEntityBeforeSave(add);
|
|
||||||
return save(add);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean updateByEditBo(TestDemoEditBo bo) {
|
|
||||||
TestDemo update = BeanUtil.toBean(bo, TestDemo.class);
|
|
||||||
validEntityBeforeSave(update);
|
|
||||||
return updateById(update);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存前的数据校验
|
|
||||||
*
|
|
||||||
* @param entity 实体类数据
|
|
||||||
*/
|
|
||||||
private void validEntityBeforeSave(TestDemo entity) {
|
|
||||||
//TODO 做一些数据校验,如唯一约束
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
||||||
if (isValid) {
|
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
|
||||||
}
|
|
||||||
return removeByIds(ids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
package com.ruoyi.demo.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import com.ruoyi.common.annotation.DataScope;
|
|
||||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeAddBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeEditBo;
|
|
||||||
import com.ruoyi.demo.bo.TestTreeQueryBo;
|
|
||||||
import com.ruoyi.demo.domain.TestTree;
|
|
||||||
import com.ruoyi.demo.mapper.TestTreeMapper;
|
|
||||||
import com.ruoyi.demo.service.ITestTreeService;
|
|
||||||
import com.ruoyi.demo.vo.TestTreeVo;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表Service业务层处理
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class TestTreeServiceImpl extends ServicePlusImpl<TestTreeMapper, TestTree> implements ITestTreeService {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public TestTreeVo queryById(Long id) {
|
|
||||||
return getVoById(id, TestTreeVo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @DataSource(DataSourceType.SLAVE) // 切换从库查询
|
|
||||||
@DataScope(isUser = true)
|
|
||||||
@Override
|
|
||||||
public List<TestTreeVo> queryList(TestTreeQueryBo bo) {
|
|
||||||
return listVo(buildQueryWrapper(bo), TestTreeVo.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
private LambdaQueryWrapper<TestTree> buildQueryWrapper(TestTreeQueryBo bo) {
|
|
||||||
Map<String, Object> params = bo.getParams();
|
|
||||||
Object dataScope = params.get("dataScope");
|
|
||||||
LambdaQueryWrapper<TestTree> lqw = Wrappers.lambdaQuery();
|
|
||||||
lqw.like(StrUtil.isNotBlank(bo.getTreeName()), TestTree::getTreeName, bo.getTreeName());
|
|
||||||
lqw.between(params.get("beginCreateTime") != null && params.get("endCreateTime") != null,
|
|
||||||
TestTree::getCreateTime, params.get("beginCreateTime"), params.get("endCreateTime"));
|
|
||||||
lqw.apply(dataScope != null && StrUtil.isNotBlank(dataScope.toString()),
|
|
||||||
dataScope != null ? dataScope.toString() : null);
|
|
||||||
return lqw;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean insertByAddBo(TestTreeAddBo bo) {
|
|
||||||
TestTree add = BeanUtil.toBean(bo, TestTree.class);
|
|
||||||
validEntityBeforeSave(add);
|
|
||||||
return save(add);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean updateByEditBo(TestTreeEditBo bo) {
|
|
||||||
TestTree update = BeanUtil.toBean(bo, TestTree.class);
|
|
||||||
validEntityBeforeSave(update);
|
|
||||||
return updateById(update);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存前的数据校验
|
|
||||||
*
|
|
||||||
* @param entity 实体类数据
|
|
||||||
*/
|
|
||||||
private void validEntityBeforeSave(TestTree entity) {
|
|
||||||
//TODO 做一些数据校验,如唯一约束
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
||||||
if (isValid) {
|
|
||||||
//TODO 做一些业务上的校验,判断是否需要校验
|
|
||||||
}
|
|
||||||
return removeByIds(ids);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.service.impl;
|
|
||||||
@ -1 +0,0 @@
|
|||||||
package com.ruoyi.demo.service;
|
|
||||||
@ -1,83 +0,0 @@
|
|||||||
package com.ruoyi.demo.vo;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试单表视图对象 test_demo
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试单表视图对象")
|
|
||||||
public class TestDemoVo {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
* 如果是自定义id 或者 雪花id
|
|
||||||
* 需要增加序列化为字符串注解 因为Long到前端会失真
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("主键")
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@Excel(name = "部门id")
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@Excel(name = "用户id")
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 排序号 */
|
|
||||||
@Excel(name = "排序号")
|
|
||||||
@ApiModelProperty("排序号")
|
|
||||||
private Long orderNum;
|
|
||||||
|
|
||||||
/** key键 */
|
|
||||||
@Excel(name = "key键")
|
|
||||||
@ApiModelProperty("key键")
|
|
||||||
private String testKey;
|
|
||||||
|
|
||||||
/** 值 */
|
|
||||||
@Excel(name = "值")
|
|
||||||
@ApiModelProperty("值")
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
/** 创建时间 */
|
|
||||||
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty("创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
/** 创建人 */
|
|
||||||
@Excel(name = "创建人")
|
|
||||||
@ApiModelProperty("创建人")
|
|
||||||
private String createBy;
|
|
||||||
|
|
||||||
/** 更新时间 */
|
|
||||||
@Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty("更新时间")
|
|
||||||
private Date updateTime;
|
|
||||||
|
|
||||||
/** 更新人 */
|
|
||||||
@Excel(name = "更新人")
|
|
||||||
@ApiModelProperty("更新人")
|
|
||||||
private String updateBy;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
package com.ruoyi.demo.vo;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
|
||||||
import com.ruoyi.common.annotation.Excel;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 测试树表视图对象 test_tree
|
|
||||||
*
|
|
||||||
* @author Lion Li
|
|
||||||
* @date 2021-05-30
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@ApiModel("测试树表视图对象")
|
|
||||||
public class TestTreeVo {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 主键 */
|
|
||||||
@ApiModelProperty("主键")
|
|
||||||
@JsonSerialize(using = ToStringSerializer.class)
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 父id */
|
|
||||||
@Excel(name = "父id")
|
|
||||||
@ApiModelProperty("父id")
|
|
||||||
private Long parentId;
|
|
||||||
|
|
||||||
/** 部门id */
|
|
||||||
@Excel(name = "部门id")
|
|
||||||
@ApiModelProperty("部门id")
|
|
||||||
private Long deptId;
|
|
||||||
|
|
||||||
/** 用户id */
|
|
||||||
@Excel(name = "用户id")
|
|
||||||
@ApiModelProperty("用户id")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
/** 树节点名 */
|
|
||||||
@Excel(name = "树节点名")
|
|
||||||
@ApiModelProperty("树节点名")
|
|
||||||
private String treeName;
|
|
||||||
|
|
||||||
/** 创建时间 */
|
|
||||||
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@ApiModelProperty("创建时间")
|
|
||||||
private Date createTime;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.ruoyi.demo.mapper.TestDemoMapper">
|
|
||||||
|
|
||||||
<resultMap type="com.ruoyi.demo.domain.TestDemo" id="TestDemoResult">
|
|
||||||
<result property="id" column="id"/>
|
|
||||||
<result property="deptId" column="dept_id"/>
|
|
||||||
<result property="userId" column="user_id"/>
|
|
||||||
<result property="orderNum" column="order_num"/>
|
|
||||||
<result property="testKey" column="test_key"/>
|
|
||||||
<result property="value" column="value"/>
|
|
||||||
<result property="version" column="version"/>
|
|
||||||
<result property="createTime" column="create_time"/>
|
|
||||||
<result property="createBy" column="create_by"/>
|
|
||||||
<result property="updateTime" column="update_time"/>
|
|
||||||
<result property="updateBy" column="update_by"/>
|
|
||||||
<result property="delFlag" column="del_flag"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
<!DOCTYPE mapper
|
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.ruoyi.demo.mapper.TestTreeMapper">
|
|
||||||
|
|
||||||
<resultMap type="com.ruoyi.demo.domain.TestTree" id="TestTreeResult">
|
|
||||||
<result property="id" column="id"/>
|
|
||||||
<result property="parentId" column="parent_id"/>
|
|
||||||
<result property="deptId" column="dept_id"/>
|
|
||||||
<result property="userId" column="user_id"/>
|
|
||||||
<result property="treeName" column="tree_name"/>
|
|
||||||
<result property="version" column="version"/>
|
|
||||||
<result property="createTime" column="create_time"/>
|
|
||||||
<result property="createBy" column="create_by"/>
|
|
||||||
<result property="updateTime" column="update_time"/>
|
|
||||||
<result property="updateBy" column="update_by"/>
|
|
||||||
<result property="delFlag" column="del_flag"/>
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@ -9,10 +9,10 @@
|
|||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>ruoyi-demo</artifactId>
|
<artifactId>ruoyi-mes</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
demo模块
|
mes模块
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
Loading…
Reference in New Issue
Block a user