引入Fluent-mybatis并做初步测试
This commit is contained in:
parent
94be46d065
commit
ddba5accd4
|
@ -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://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true
|
||||||
username: root
|
username: root
|
||||||
password: root
|
password: 123456
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
lazy: true
|
lazy: true
|
||||||
|
|
|
@ -163,6 +163,21 @@
|
||||||
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 自己新增的依赖 Geniou -->
|
||||||
|
<!-- 引入fluent-mybatis 运行依赖包, scope为compile -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.atool</groupId>
|
||||||
|
<artifactId>fluent-mybatis</artifactId>
|
||||||
|
<version>1.7.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- 引入fluent-mybatis-processor, scope设置为provider 编译需要,运行时不需要 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.atool</groupId>
|
||||||
|
<artifactId>fluent-mybatis-processor</artifactId>
|
||||||
|
<version>1.7.2</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test;
|
||||||
|
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.FluentMybatis;
|
||||||
|
import cn.org.atool.fluent.mybatis.base.IEntity;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品对象 product
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2021-09-03
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@FluentMybatis
|
||||||
|
public class Product implements IEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private Date createDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Date updateDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品唯一编号
|
||||||
|
*/
|
||||||
|
private String productCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单价
|
||||||
|
*/
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运费
|
||||||
|
*/
|
||||||
|
private BigDecimal freight;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.mapper.ProductMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品测试
|
||||||
|
* @author Geniou
|
||||||
|
* @create 2021/9/6 18:41
|
||||||
|
*/
|
||||||
|
public class ProductTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProductMapper productMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,48 @@
|
||||||
|
package com.ruoyi.demo.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.mapper.ProductMapper;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.Product;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品测试控制
|
||||||
|
* @author Geniou
|
||||||
|
* @create 2021/9/6 19:11
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(value = "商品测试控制方法", tags = {"商品测试控制方法"})
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/demo/product")
|
||||||
|
public class ProductTestController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ProductMapper productMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询测试树表列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("测试语句")
|
||||||
|
@GetMapping("/mapperTest")
|
||||||
|
public void list() {
|
||||||
|
Product product = new Product();
|
||||||
|
product.setProductCode("M10001");
|
||||||
|
product.setProductName("测试商品");
|
||||||
|
product.setUnitPrice(BigDecimal.valueOf(2.5));
|
||||||
|
product.setFreight(BigDecimal.valueOf(1.5));
|
||||||
|
product.setCreateDateTime(new Date());
|
||||||
|
product.setUpdateDateTime(new Date());
|
||||||
|
productMapper.insert(product);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue