修改
This commit is contained in:
1
pom.xml
1
pom.xml
@ -37,6 +37,7 @@
|
||||
<!-- 依赖声明 -->
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
<!-- SpringBoot的依赖配置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
@ -17,11 +17,6 @@
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring框架基本的核心工具 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
@ -93,10 +88,7 @@
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-framework</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ruoyi-vue-plus</artifactId>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<version>${ruoyi-vue-plus.version}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ruoyi-demo</artifactId>
|
||||
|
||||
<description>
|
||||
demo模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,56 +0,0 @@
|
||||
package com.ruoyi.demo.bo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDate;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 古树信息列分页查询对象 t_tress
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-10-31
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("古树信息列分页查询对象")
|
||||
public class TTressQueryBo 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;
|
||||
/** 别名 */
|
||||
@ApiModelProperty("别名")
|
||||
private String treeAlias;
|
||||
/** 年龄 */
|
||||
@ApiModelProperty("年龄")
|
||||
private Integer age;
|
||||
/** 地址 */
|
||||
@ApiModelProperty("地址")
|
||||
private String address;
|
||||
|
||||
}
|
@ -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,117 +0,0 @@
|
||||
package com.ruoyi.demo.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.demo.domain.TTress;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
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.demo.bo.TTressQueryBo;
|
||||
import com.ruoyi.demo.service.ITTressService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 古树信息列Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-10-31
|
||||
*/
|
||||
@Api(value = "古树信息列控制器", tags = {"古树信息列管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/demo/tress")
|
||||
public class TTressController extends BaseController {
|
||||
|
||||
private final ITTressService iTTressService;
|
||||
|
||||
/**
|
||||
* 查询全部古树信息
|
||||
*/
|
||||
@ApiOperation("查询全部古树信息")
|
||||
@GetMapping("/all")
|
||||
public AjaxResult all() {
|
||||
return AjaxResult.success(iTTressService.list());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询古树信息列列表
|
||||
*/
|
||||
@ApiOperation("查询古树信息列列表")
|
||||
@PreAuthorize("@ss.hasPermi('demo:tress:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<TTress> list(@Validated TTressQueryBo bo) {
|
||||
return iTTressService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出古树信息列列表
|
||||
*/
|
||||
@ApiOperation("导出古树信息列列表")
|
||||
@PreAuthorize("@ss.hasPermi('demo:tress:export')")
|
||||
@Log(title = "古树信息列", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<TTress> export(@Validated TTressQueryBo bo) {
|
||||
List<TTress> list = iTTressService.queryList(bo);
|
||||
ExcelUtil<TTress> util = new ExcelUtil<TTress>(TTress.class);
|
||||
return util.exportExcel(list, "古树信息列");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取古树信息列详细信息
|
||||
*/
|
||||
@ApiOperation("获取古树信息列详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('demo:tress:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<TTress> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Integer id) {
|
||||
return AjaxResult.success(iTTressService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增古树信息列
|
||||
*/
|
||||
@ApiOperation("新增古树信息列")
|
||||
@PreAuthorize("@ss.hasPermi('demo:tress:add')")
|
||||
@Log(title = "古树信息列", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody TTress bo) {
|
||||
return toAjax(iTTressService.insert(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改古树信息列
|
||||
*/
|
||||
@ApiOperation("修改古树信息列")
|
||||
@PreAuthorize("@ss.hasPermi('demo:tress:edit')")
|
||||
@Log(title = "古树信息列", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody TTress bo) {
|
||||
return toAjax(iTTressService.update(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除古树信息列
|
||||
*/
|
||||
@ApiOperation("删除古树信息列")
|
||||
@PreAuthorize("@ss.hasPermi('demo:tress:remove')")
|
||||
@Log(title = "古树信息列" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Integer[] ids) {
|
||||
return toAjax(iTTressService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
@ -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,207 +0,0 @@
|
||||
package com.ruoyi.demo.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.LocalDate;
|
||||
|
||||
/**
|
||||
* 古树信息列对象 t_tress
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-10-31
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
@TableName("t_tress")
|
||||
@ApiModel("古树信息列视图对象")
|
||||
public class TTress implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/** id */
|
||||
@ApiModelProperty("id")
|
||||
@TableId(value = "id")
|
||||
private Integer id;
|
||||
|
||||
/** 古树标号 */
|
||||
@Excel(name = "古树标号")
|
||||
@ApiModelProperty("古树标号")
|
||||
private String treeNo;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
@ApiModelProperty("图片")
|
||||
private String pics;
|
||||
|
||||
/** 中文树名 */
|
||||
@Excel(name = "中文树名")
|
||||
@ApiModelProperty("中文树名")
|
||||
private String treeName;
|
||||
|
||||
/** 阿拉丁名 */
|
||||
@Excel(name = "阿拉丁名")
|
||||
@ApiModelProperty("阿拉丁名")
|
||||
private String treeNameE;
|
||||
|
||||
/** 别名 */
|
||||
@Excel(name = "别名")
|
||||
@ApiModelProperty("别名")
|
||||
private String treeAlias;
|
||||
|
||||
/** 科 */
|
||||
@Excel(name = "科")
|
||||
@ApiModelProperty("科")
|
||||
private String family;
|
||||
|
||||
/** 属 */
|
||||
@Excel(name = "属")
|
||||
@ApiModelProperty("属")
|
||||
private String genus;
|
||||
|
||||
/** 类型 */
|
||||
@Excel(name = "类型")
|
||||
@ApiModelProperty("类型")
|
||||
private String type;
|
||||
|
||||
/** 年龄 */
|
||||
@Excel(name = "年龄")
|
||||
@ApiModelProperty("年龄")
|
||||
private Integer age;
|
||||
|
||||
/** 地址 */
|
||||
@Excel(name = "地址")
|
||||
@ApiModelProperty("地址")
|
||||
private String address;
|
||||
|
||||
/** 详细地址 */
|
||||
@Excel(name = "详细地址")
|
||||
@ApiModelProperty("详细地址")
|
||||
private String detailedAddress;
|
||||
|
||||
/** 管护单位 */
|
||||
@Excel(name = "管护单位")
|
||||
@ApiModelProperty("管护单位")
|
||||
private String careUnit;
|
||||
|
||||
/** 古树状态 */
|
||||
@Excel(name = "古树状态")
|
||||
@ApiModelProperty("古树状态")
|
||||
private String treeStatus;
|
||||
|
||||
/** 浏览量 */
|
||||
@Excel(name = "浏览量")
|
||||
@ApiModelProperty("浏览量")
|
||||
private Integer viewsCount;
|
||||
|
||||
/** 经度 */
|
||||
@Excel(name = "经度")
|
||||
@ApiModelProperty("经度")
|
||||
private String longitude;
|
||||
|
||||
/** 纬度 */
|
||||
@Excel(name = "纬度")
|
||||
@ApiModelProperty("纬度")
|
||||
private String latitude;
|
||||
|
||||
/** 创建时间 */
|
||||
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("创建时间")
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/** 更新时间 */
|
||||
@Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("更新时间")
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/** 高度 */
|
||||
@Excel(name = "高度")
|
||||
@ApiModelProperty("高度")
|
||||
private String highly;
|
||||
|
||||
/** 直径(胸围) */
|
||||
@Excel(name = "直径(胸围)")
|
||||
@ApiModelProperty("直径(胸围)")
|
||||
private BigDecimal diameter;
|
||||
|
||||
/** 生长势 */
|
||||
@Excel(name = "生长势")
|
||||
@ApiModelProperty("生长势")
|
||||
private String growthVigor;
|
||||
|
||||
/** 平均冠幅 */
|
||||
@Excel(name = "平均冠幅")
|
||||
@ApiModelProperty("平均冠幅")
|
||||
private String averageCanopy;
|
||||
|
||||
/** 东西冠幅 */
|
||||
@Excel(name = "东西冠幅")
|
||||
@ApiModelProperty("东西冠幅")
|
||||
private String dongXiCanopy;
|
||||
|
||||
/** 南北冠幅 */
|
||||
@Excel(name = "南北冠幅")
|
||||
@ApiModelProperty("南北冠幅")
|
||||
private String nanBeiCanopy;
|
||||
|
||||
/** 海拔 */
|
||||
@Excel(name = "海拔")
|
||||
@ApiModelProperty("海拔")
|
||||
private String altitude;
|
||||
|
||||
/** 坡向 */
|
||||
@Excel(name = "坡向")
|
||||
@ApiModelProperty("坡向")
|
||||
private String slopeDirection;
|
||||
|
||||
/** 坡度 */
|
||||
@Excel(name = "坡度")
|
||||
@ApiModelProperty("坡度")
|
||||
private String slopeDegree;
|
||||
|
||||
/** 坡位 */
|
||||
@Excel(name = "坡位")
|
||||
@ApiModelProperty("坡位")
|
||||
private String slopePosition;
|
||||
|
||||
/** 土壤名称 */
|
||||
@Excel(name = "土壤名称")
|
||||
@ApiModelProperty("土壤名称")
|
||||
private String soilName;
|
||||
|
||||
/** 土壤紧密度 */
|
||||
@Excel(name = "土壤紧密度")
|
||||
@ApiModelProperty("土壤紧密度")
|
||||
private String soilCompactness;
|
||||
|
||||
/** 生长环境 */
|
||||
@Excel(name = "生长环境")
|
||||
@ApiModelProperty("生长环境")
|
||||
private String growthEnvironment;
|
||||
|
||||
/** 历史/详情 */
|
||||
@Excel(name = "历史/详情")
|
||||
@ApiModelProperty("历史/详情")
|
||||
private String historyDetails;
|
||||
|
||||
/** 树木奇特性状 */
|
||||
@Excel(name = "树木奇特性状")
|
||||
@ApiModelProperty("树木奇特性状")
|
||||
private String peculiarCharacter;
|
||||
|
||||
}
|
@ -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.demo.domain.TTress;
|
||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||
import org.apache.ibatis.annotations.CacheNamespace;
|
||||
|
||||
/**
|
||||
* 古树信息列Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-10-31
|
||||
*/
|
||||
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||
public interface TTressMapper extends BaseMapperPlus<TTress> {
|
||||
|
||||
}
|
@ -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,55 +0,0 @@
|
||||
package com.ruoyi.demo.service;
|
||||
|
||||
import com.ruoyi.demo.domain.TTress;
|
||||
import com.ruoyi.demo.bo.TTressQueryBo;
|
||||
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 ruoyi
|
||||
* @date 2021-10-31
|
||||
*/
|
||||
public interface ITTressService extends IServicePlus<TTress> {
|
||||
/**
|
||||
* 查询单个
|
||||
* @return
|
||||
*/
|
||||
TTress queryById(Integer id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<TTress> queryPageList(TTressQueryBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<TTress> queryList(TTressQueryBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入古树信息列
|
||||
* @param bo 古树信息列新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insert(TTress bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改古树信息列
|
||||
* @param bo 古树信息列编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean update(TTress bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Integer> ids, Boolean isValid);
|
||||
}
|
@ -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,88 +0,0 @@
|
||||
package com.ruoyi.demo.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.demo.bo.TTressQueryBo;
|
||||
import com.ruoyi.demo.domain.TTress;
|
||||
import com.ruoyi.demo.mapper.TTressMapper;
|
||||
import com.ruoyi.demo.service.ITTressService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 古树信息列Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2021-10-31
|
||||
*/
|
||||
@Service
|
||||
public class TTressServiceImpl extends ServicePlusImpl<TTressMapper, TTress> implements ITTressService {
|
||||
|
||||
@Override
|
||||
public TTress queryById(Integer id){
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<TTress> queryPageList(TTressQueryBo bo) {
|
||||
Page<TTress> result = page(PageUtils.buildPage(), buildQueryWrapper(bo));
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TTress> queryList(TTressQueryBo bo) {
|
||||
return list(buildQueryWrapper(bo));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<TTress> buildQueryWrapper(TTressQueryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<TTress> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StrUtil.isNotBlank(bo.getTreeName()), TTress::getTreeName, bo.getTreeName());
|
||||
lqw.like(StrUtil.isNotBlank(bo.getTreeAlias()), TTress::getTreeAlias, bo.getTreeAlias());
|
||||
lqw.between(params.get("beginAge") != null && params.get("endAge") != null,
|
||||
TTress::getAge ,params.get("beginAge"), params.get("endAge"));
|
||||
lqw.like(StrUtil.isNotBlank(bo.getAddress()), TTress::getAddress, bo.getAddress());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insert(TTress bo) {
|
||||
TTress add = BeanUtil.toBean(bo, TTress.class);
|
||||
validEntityBeforeSave(add);
|
||||
return save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(TTress bo) {
|
||||
TTress update = BeanUtil.toBean(bo, TTress.class);
|
||||
validEntityBeforeSave(update);
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(TTress entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Integer> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
}
|
@ -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,45 +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.TTressMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.demo.domain.TTress" id="TTressResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="treeNo" column="tree_no"/>
|
||||
<result property="pics" column="pics"/>
|
||||
<result property="treeName" column="tree_name"/>
|
||||
<result property="treeNameE" column="tree_name_e"/>
|
||||
<result property="treeAlias" column="tree_alias"/>
|
||||
<result property="family" column="family"/>
|
||||
<result property="genus" column="genus"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="age" column="age"/>
|
||||
<result property="address" column="address"/>
|
||||
<result property="detailedAddress" column="detailed_address"/>
|
||||
<result property="careUnit" column="care_unit"/>
|
||||
<result property="treeStatus" column="tree_status"/>
|
||||
<result property="viewsCount" column="views_count"/>
|
||||
<result property="longitude" column="longitude"/>
|
||||
<result property="latitude" column="latitude"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="highly" column="highly"/>
|
||||
<result property="diameter" column="diameter"/>
|
||||
<result property="growthVigor" column="growth_vigor"/>
|
||||
<result property="averageCanopy" column="average_canopy"/>
|
||||
<result property="dongXiCanopy" column="dong_xi_canopy"/>
|
||||
<result property="nanBeiCanopy" column="nan_bei_canopy"/>
|
||||
<result property="altitude" column="altitude"/>
|
||||
<result property="slopeDirection" column="slope_direction"/>
|
||||
<result property="slopeDegree" column="slope_degree"/>
|
||||
<result property="slopePosition" column="slope_position"/>
|
||||
<result property="soilName" column="soil_name"/>
|
||||
<result property="soilCompactness" column="soil_compactness"/>
|
||||
<result property="growthEnvironment" column="growth_environment"/>
|
||||
<result property="historyDetails" column="history_details"/>
|
||||
<result property="peculiarCharacter" column="peculiar_character"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
@ -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>
|
@ -1,16 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
This is the JRebel configuration file. It maps the running application to your IDE workspace, enabling JRebel reloading for this project.
|
||||
Refer to https://manuals.jrebel.com/jrebel/standalone/config.html for more information.
|
||||
-->
|
||||
<application generated-by="intellij" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.zeroturnaround.com" xsi:schemaLocation="http://www.zeroturnaround.com http://update.zeroturnaround.com/jrebel/rebel-2_3.xsd">
|
||||
|
||||
<id>ruoyi-demo</id>
|
||||
|
||||
<classpath>
|
||||
<dir name="E:/intellijWork/old-tress-sys/ruoyi-demo/target/classes">
|
||||
</dir>
|
||||
</classpath>
|
||||
|
||||
</application>
|
@ -1,10 +1,10 @@
|
||||
# 代码生成
|
||||
gen:
|
||||
gen:
|
||||
# 作者
|
||||
author: ruoyi
|
||||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
||||
packageName: com.ruoyi.system
|
||||
packageName: com.ruoyi.common
|
||||
# 自动去除表前缀,默认是false
|
||||
autoRemovePre: false
|
||||
autoRemovePre: true
|
||||
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
|
||||
tablePrefix: sys_
|
||||
tablePrefix: common_
|
||||
|
@ -1,18 +1,17 @@
|
||||
package com.ruoyi.wgz.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.constant.Constants;
|
||||
import com.ruoyi.common.core.domain.model.LoginUser;
|
||||
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.framework.web.service.TokenService;
|
||||
|
||||
import com.ruoyi.wgz.bo.WgzUserQueryBo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserLongInReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserRegisterReq;
|
||||
@ -21,7 +20,6 @@ import com.ruoyi.wgz.common.SnowflakeIdUtil;
|
||||
import com.ruoyi.wgz.domain.WgzUser;
|
||||
import com.ruoyi.wgz.mapper.WgzUserMapper;
|
||||
import com.ruoyi.wgz.service.IWgzUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
@ -40,8 +38,8 @@ import java.util.Map;
|
||||
@Service
|
||||
public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser> implements IWgzUserService {
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
// @Autowired
|
||||
// private TokenService tokenService;
|
||||
|
||||
@Override
|
||||
public WgzUser queryById(String id){
|
||||
@ -144,22 +142,22 @@ public class WgzUserServiceImpl extends ServicePlusImpl<WgzUserMapper, WgzUser>
|
||||
throw new RuntimeException("密码错误!");
|
||||
}
|
||||
//4、创建token返回wgzUser
|
||||
String token = tokenService.createToken(wgzUser);
|
||||
WgzAppUserLongInRes res = new WgzAppUserLongInRes();
|
||||
res.setToken(token);
|
||||
// String token = tokenService.createToken(wgzUser);
|
||||
// WgzAppUserLongInRes res = new WgzAppUserLongInRes();
|
||||
// res.setToken(token);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String createToken(WgzUser wu) {
|
||||
String token = IdUtil.fastUUID();
|
||||
loginUser.setToken(token);
|
||||
setUserAgent(loginUser);
|
||||
refreshToken(loginUser);
|
||||
|
||||
Map<String, Object> claims = new HashMap<>();
|
||||
claims.put(Constants.LOGIN_USER_KEY, token);
|
||||
return createToken(claims);
|
||||
}
|
||||
// public String createToken(WgzUser wu) {
|
||||
// String token = IdUtil.fastUUID();
|
||||
// loginUser.setToken(token);
|
||||
// setUserAgent(loginUser);
|
||||
// refreshToken(loginUser);
|
||||
//
|
||||
// Map<String, Object> claims = new HashMap<>();
|
||||
// claims.put(Constants.LOGIN_USER_KEY, token);
|
||||
// return createToken(claims);
|
||||
// }
|
||||
}
|
||||
|
Reference in New Issue
Block a user