增加mall模块,测试Fluent-Mybatis
This commit is contained in:
parent
a72109cd7a
commit
6a5146d7b0
1
pom.xml
1
pom.xml
|
@ -234,6 +234,7 @@
|
||||||
<module>ruoyi-demo</module>
|
<module>ruoyi-demo</module>
|
||||||
<module>ruoyi-extend</module>
|
<module>ruoyi-extend</module>
|
||||||
<module>ruoyi-oss</module>
|
<module>ruoyi-oss</module>
|
||||||
|
<module>ruoyi-mall</module>
|
||||||
</modules>
|
</modules>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ token:
|
||||||
# 令牌密钥
|
# 令牌密钥
|
||||||
secret: abcdefghijklmnopqrstuvwxyz
|
secret: abcdefghijklmnopqrstuvwxyz
|
||||||
# 令牌有效期(默认30分钟)
|
# 令牌有效期(默认30分钟)
|
||||||
expireTime: 30
|
expireTime: 300
|
||||||
|
|
||||||
# 重复提交
|
# 重复提交
|
||||||
repeat-submit:
|
repeat-submit:
|
||||||
|
|
|
@ -2,182 +2,198 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
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">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>ruoyi-vue-plus</artifactId>
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
<groupId>com.ruoyi</groupId>
|
<groupId>com.ruoyi</groupId>
|
||||||
<version>3.0.0</version>
|
<version>3.0.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>ruoyi-common</artifactId>
|
<artifactId>ruoyi-common</artifactId>
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
common通用工具
|
common通用工具
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<!-- Spring框架基本的核心工具 -->
|
<!-- Spring框架基本的核心工具 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-context-support</artifactId>
|
<artifactId>spring-context-support</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringWeb模块 -->
|
<!-- SpringWeb模块 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework</groupId>
|
<groupId>org.springframework</groupId>
|
||||||
<artifactId>spring-web</artifactId>
|
<artifactId>spring-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- spring security 安全认证 -->
|
<!-- spring security 安全认证 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-security</artifactId>
|
<artifactId>spring-boot-starter-security</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 自定义验证注解 -->
|
<!-- 自定义验证注解 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.validation</groupId>
|
<groupId>javax.validation</groupId>
|
||||||
<artifactId>validation-api</artifactId>
|
<artifactId>validation-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--常用工具类 -->
|
<!--常用工具类 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- JSON工具类 -->
|
<!-- JSON工具类 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- excel工具 -->
|
<!-- excel工具 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi-ooxml</artifactId>
|
<artifactId>poi-ooxml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba</groupId>
|
<groupId>com.alibaba</groupId>
|
||||||
<artifactId>easyexcel</artifactId>
|
<artifactId>easyexcel</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- yml解析器 -->
|
<!-- yml解析器 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yaml</groupId>
|
<groupId>org.yaml</groupId>
|
||||||
<artifactId>snakeyaml</artifactId>
|
<artifactId>snakeyaml</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--Token生成与解析-->
|
<!--Token生成与解析-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.jsonwebtoken</groupId>
|
<groupId>io.jsonwebtoken</groupId>
|
||||||
<artifactId>jjwt</artifactId>
|
<artifactId>jjwt</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- redis 缓存操作 -->
|
<!-- redis 缓存操作 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- pool 对象池 -->
|
<!-- pool 对象池 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-pool2</artifactId>
|
<artifactId>commons-pool2</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- servlet包 -->
|
<!-- servlet包 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javax.servlet</groupId>
|
<groupId>javax.servlet</groupId>
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-extension</artifactId>
|
<artifactId>mybatis-plus-extension</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
<artifactId>hutool-all</artifactId>
|
<artifactId>hutool-all</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.openfeign</groupId>
|
<groupId>io.github.openfeign</groupId>
|
||||||
<artifactId>feign-okhttp</artifactId>
|
<artifactId>feign-okhttp</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.codecentric</groupId>
|
<groupId>de.codecentric</groupId>
|
||||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.xiaoymin</groupId>
|
<groupId>com.github.xiaoymin</groupId>
|
||||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 自动生成YML配置关联JSON文件 -->
|
<!-- 自动生成YML配置关联JSON文件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--redisson-->
|
<!--redisson-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.redisson</groupId>
|
<groupId>org.redisson</groupId>
|
||||||
<artifactId>redisson-spring-boot-starter</artifactId>
|
<artifactId>redisson-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- dynamic-datasource 多数据源-->
|
<!-- dynamic-datasource 多数据源-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- sql性能分析插件 -->
|
<!-- sql性能分析插件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>p6spy</groupId>
|
<groupId>p6spy</groupId>
|
||||||
<artifactId>p6spy</artifactId>
|
<artifactId>p6spy</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
<artifactId>lock4j-redisson-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 自己新增的依赖 Geniou -->
|
<!-- 自己新增的依赖 Geniou -->
|
||||||
<!-- 引入fluent-mybatis 运行依赖包, scope为compile -->
|
<!-- 引入fluent-mybatis 运行依赖包, scope为compile -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.atool</groupId>
|
<groupId>com.github.atool</groupId>
|
||||||
<artifactId>fluent-mybatis</artifactId>
|
<artifactId>fluent-mybatis</artifactId>
|
||||||
<version>1.7.2</version>
|
<version>1.7.2</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- 引入fluent-mybatis-processor, scope设置为provider 编译需要,运行时不需要 -->
|
<!-- 引入fluent-mybatis-processor, scope设置为provider 编译需要,运行时不需要 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.atool</groupId>
|
<groupId>com.github.atool</groupId>
|
||||||
<artifactId>fluent-mybatis-processor</artifactId>
|
<artifactId>fluent-mybatis-processor</artifactId>
|
||||||
<version>1.7.2</version>
|
<version>1.7.2</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.security</groupId>
|
||||||
|
<artifactId>spring-security-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Mysql驱动包 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,62 +0,0 @@
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
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,16 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.dao.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.dao.base.ProductCategoryBaseDao;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.dao.intf.ProductCategoryDao;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductCategoryDaoImpl: 数据操作接口实现
|
||||||
|
*
|
||||||
|
* 这只是一个减少手工创建的模板文件
|
||||||
|
* 可以任意添加方法和实现, 更改作者和重定义类名
|
||||||
|
* <p/>@author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class ProductCategoryDaoImpl extends ProductCategoryBaseDao implements ProductCategoryDao {
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.dao.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.dao.base.ProductCategoryRelationBaseDao;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.dao.intf.ProductCategoryRelationDao;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductCategoryRelationDaoImpl: 数据操作接口实现
|
||||||
|
*
|
||||||
|
* 这只是一个减少手工创建的模板文件
|
||||||
|
* 可以任意添加方法和实现, 更改作者和重定义类名
|
||||||
|
* <p/>@author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class ProductCategoryRelationDaoImpl extends ProductCategoryRelationBaseDao implements ProductCategoryRelationDao {
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.dao.impl;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.dao.base.ProductBaseDao;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.dao.intf.ProductDao;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductDaoImpl: 数据操作接口实现
|
||||||
|
*
|
||||||
|
* 这只是一个减少手工创建的模板文件
|
||||||
|
* 可以任意添加方法和实现, 更改作者和重定义类名
|
||||||
|
* <p/>@author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public class ProductDaoImpl extends ProductBaseDao implements ProductDao {
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.dao.intf;
|
||||||
|
|
||||||
|
import cn.org.atool.fluent.mybatis.base.IBaseDao;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.entity.ProductCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductCategoryDao: 数据操作接口
|
||||||
|
*
|
||||||
|
* 这只是一个减少手工创建的模板文件
|
||||||
|
* 可以任意添加方法和实现, 更改作者和重定义类名
|
||||||
|
* <p/>@author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
public interface ProductCategoryDao extends IBaseDao<ProductCategory> {
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.dao.intf;
|
||||||
|
|
||||||
|
import cn.org.atool.fluent.mybatis.base.IBaseDao;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.entity.ProductCategoryRelation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductCategoryRelationDao: 数据操作接口
|
||||||
|
*
|
||||||
|
* 这只是一个减少手工创建的模板文件
|
||||||
|
* 可以任意添加方法和实现, 更改作者和重定义类名
|
||||||
|
* <p/>@author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
public interface ProductCategoryRelationDao extends IBaseDao<ProductCategoryRelation> {
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.dao.intf;
|
||||||
|
|
||||||
|
import cn.org.atool.fluent.mybatis.base.IBaseDao;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.entity.Product;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductDao: 数据操作接口
|
||||||
|
*
|
||||||
|
* 这只是一个减少手工创建的模板文件
|
||||||
|
* 可以任意添加方法和实现, 更改作者和重定义类名
|
||||||
|
* <p/>@author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
public interface ProductDao extends IBaseDao<Product> {
|
||||||
|
}
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.entity;
|
||||||
|
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.FluentMybatis;
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.RefMethod;
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.TableField;
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.TableId;
|
||||||
|
import cn.org.atool.fluent.mybatis.base.IEntity;
|
||||||
|
import cn.org.atool.fluent.mybatis.base.RichEntity;
|
||||||
|
import cn.org.atool.fluent.mybatis.functions.TableSupplier;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.lang.Class;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Override;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.lang.SuppressWarnings;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Product: 数据映射实体定义
|
||||||
|
*
|
||||||
|
* @author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
@Data
|
||||||
|
@Accessors(
|
||||||
|
chain = true
|
||||||
|
)
|
||||||
|
@EqualsAndHashCode(
|
||||||
|
callSuper = false
|
||||||
|
)
|
||||||
|
@FluentMybatis(
|
||||||
|
table = "product",
|
||||||
|
schema = "ruoyi",
|
||||||
|
suffix = ""
|
||||||
|
)
|
||||||
|
public class Product extends RichEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField("create_date_time")
|
||||||
|
private Date createDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运费
|
||||||
|
*/
|
||||||
|
@TableField("freight")
|
||||||
|
private BigDecimal freight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品唯一编号
|
||||||
|
*/
|
||||||
|
@TableField("product_code")
|
||||||
|
private String productCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
@TableField("product_name")
|
||||||
|
private String productName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单价
|
||||||
|
*/
|
||||||
|
@TableField("unit_price")
|
||||||
|
private BigDecimal unitPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField("update_date_time")
|
||||||
|
private Date updateDateTime;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Serializable findPk() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final Class<? extends IEntity> entityClass() {
|
||||||
|
return Product.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final Product changeTableBelongTo(TableSupplier supplier) {
|
||||||
|
return super.changeTableBelongTo(supplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final Product changeTableBelongTo(String table) {
|
||||||
|
return super.changeTableBelongTo(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现定义在{@link cn.org.atool.fluent.mybatis.base.IRefs}子类Refs上
|
||||||
|
*/
|
||||||
|
@RefMethod
|
||||||
|
public List<ProductCategory> findProductCategoryList() {
|
||||||
|
return super.invoke("findProductCategoryList", true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,135 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.entity;
|
||||||
|
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.FluentMybatis;
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.RefMethod;
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.TableField;
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.TableId;
|
||||||
|
import cn.org.atool.fluent.mybatis.base.IEntity;
|
||||||
|
import cn.org.atool.fluent.mybatis.base.RichEntity;
|
||||||
|
import cn.org.atool.fluent.mybatis.functions.TableSupplier;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.lang.Class;
|
||||||
|
import java.lang.Integer;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Override;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.lang.SuppressWarnings;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductCategory: 数据映射实体定义
|
||||||
|
*
|
||||||
|
* @author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@FluentMybatis(table = "product_category", schema = "ruoyi", suffix = "")
|
||||||
|
public class ProductCategory extends RichEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类名称
|
||||||
|
*/
|
||||||
|
@TableField("category_name")
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类类型(Title-标题,Value-值)
|
||||||
|
*/
|
||||||
|
@TableField("category_type")
|
||||||
|
private String categoryType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField("create_date_time")
|
||||||
|
private Date createDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级
|
||||||
|
*/
|
||||||
|
@TableField("level_no")
|
||||||
|
private Integer levelNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父级分类主键
|
||||||
|
*/
|
||||||
|
@TableField("parent_id")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序号
|
||||||
|
*/
|
||||||
|
@TableField("sort_num")
|
||||||
|
private Integer sortNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类状态(Enable-启用,Disable-禁用,Delete-删除)
|
||||||
|
*/
|
||||||
|
@TableField("status_type")
|
||||||
|
private String statusType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@TableField("update_date_time")
|
||||||
|
private Date updateDateTime;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Serializable findPk() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final Class<? extends IEntity> entityClass() {
|
||||||
|
return ProductCategory.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final ProductCategory changeTableBelongTo(TableSupplier supplier) {
|
||||||
|
return super.changeTableBelongTo(supplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final ProductCategory changeTableBelongTo(String table) {
|
||||||
|
return super.changeTableBelongTo(table);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现定义在{@link cn.org.atool.fluent.mybatis.base.IRefs}子类Refs上
|
||||||
|
*/
|
||||||
|
@RefMethod
|
||||||
|
public List<Product> findProductList() {
|
||||||
|
return super.invoke("findProductList", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现定义在{@link cn.org.atool.fluent.mybatis.base.IRefs}子类Refs上
|
||||||
|
*/
|
||||||
|
@RefMethod("parentId = id")
|
||||||
|
public List<ProductCategory> findProductCategoryList() {
|
||||||
|
return super.invoke("findProductCategoryList", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实现定义在{@link cn.org.atool.fluent.mybatis.base.IRefs}子类Refs上
|
||||||
|
*/
|
||||||
|
@RefMethod("id = parentId")
|
||||||
|
public ProductCategory findProductCategory() {
|
||||||
|
return super.invoke("findProductCategory", true);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.ruoyi.common.core.domain.entity.test.entity;
|
||||||
|
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.FluentMybatis;
|
||||||
|
import cn.org.atool.fluent.mybatis.annotation.TableField;
|
||||||
|
import cn.org.atool.fluent.mybatis.base.IEntity;
|
||||||
|
import cn.org.atool.fluent.mybatis.base.RichEntity;
|
||||||
|
import cn.org.atool.fluent.mybatis.functions.TableSupplier;
|
||||||
|
|
||||||
|
import java.lang.Class;
|
||||||
|
import java.lang.Long;
|
||||||
|
import java.lang.Override;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.lang.SuppressWarnings;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ProductCategoryRelation: 数据映射实体定义
|
||||||
|
*
|
||||||
|
* @author Powered By Fluent Mybatis
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unchecked"})
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@FluentMybatis(table = "product_category_relation", schema = "ruoyi", suffix = "")
|
||||||
|
public class ProductCategoryRelation extends RichEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品分类主键
|
||||||
|
*/
|
||||||
|
@TableField("product_category_id")
|
||||||
|
private Long productCategoryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品主键
|
||||||
|
*/
|
||||||
|
@TableField("product_id")
|
||||||
|
private Long productId;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final Class<? extends IEntity> entityClass() {
|
||||||
|
return ProductCategoryRelation.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final ProductCategoryRelation changeTableBelongTo(TableSupplier supplier) {
|
||||||
|
return super.changeTableBelongTo(supplier);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public final ProductCategoryRelation changeTableBelongTo(String table) {
|
||||||
|
return super.changeTableBelongTo(table);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
package com.ruoyi.common;
|
||||||
|
|
||||||
|
import cn.org.atool.generator.FileGenerator;
|
||||||
|
import cn.org.atool.generator.annotation.Relation;
|
||||||
|
import cn.org.atool.generator.annotation.RelationType;
|
||||||
|
import cn.org.atool.generator.annotation.Table;
|
||||||
|
import cn.org.atool.generator.annotation.Tables;
|
||||||
|
import cn.org.atool.generator.database.model.ConfigKey;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 代码生成测试
|
||||||
|
* @author Geniou
|
||||||
|
* @create 2021/9/9 12:17
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class GeneratorTest {
|
||||||
|
|
||||||
|
static final String url =
|
||||||
|
"jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true";
|
||||||
|
static final String basePackage = "com.ruoyi.common.core.domain.entity.test";
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
FileGenerator.build(RelationMTM.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Tables(
|
||||||
|
url = url, username = "root", password = "123456",
|
||||||
|
basePack = basePackage,
|
||||||
|
srcDir = "src/main/java/com/ruoyi/common/core/domain/entity/test",
|
||||||
|
tables = @Table(value = {"product_category", "product", "product_category_relation"})
|
||||||
|
)
|
||||||
|
static class Noting{}
|
||||||
|
|
||||||
|
@Tables(
|
||||||
|
url = url, username = "root", password = "123456",
|
||||||
|
basePack = basePackage,
|
||||||
|
srcDir = "src\\main\\java\\",
|
||||||
|
tables = {@Table(value = {"product", "product_category", "product_category_relation"})},
|
||||||
|
relations = {
|
||||||
|
@Relation(source = "product", target = "product_category", type = RelationType.TwoWay_N_N),
|
||||||
|
@Relation(source = "product_category", target = "product_category", type = RelationType.TwoWay_1_N,
|
||||||
|
where = "id = parent_id")
|
||||||
|
},
|
||||||
|
entitySuffix = ""
|
||||||
|
)
|
||||||
|
static class RelationMTM{}
|
||||||
|
|
||||||
|
}
|
|
@ -1,13 +1,17 @@
|
||||||
package com.ruoyi.demo.controller;
|
package com.ruoyi.demo.controller;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.mapper.ProductMapper;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.entity.test.Product;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.entity.Product;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.entity.ProductCategory;
|
||||||
|
import com.ruoyi.common.core.domain.entity.test.mapper.ProductMapper;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@ -23,17 +27,19 @@ import java.util.Date;
|
||||||
@Api(value = "商品测试控制方法", tags = {"商品测试控制方法"})
|
@Api(value = "商品测试控制方法", tags = {"商品测试控制方法"})
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/demo/product")
|
@RequestMapping("/demo/product")
|
||||||
public class ProductTestController {
|
public class ProductTestController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ProductMapper productMapper;
|
private ProductMapper productMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询测试树表列表
|
* 测试插入
|
||||||
*/
|
*/
|
||||||
@ApiOperation("测试语句")
|
@ApiOperation("测试插入商品")
|
||||||
@GetMapping("/mapperTest")
|
@PostMapping("/insertProduct")
|
||||||
public void list() {
|
public void insertProduct() {
|
||||||
Product product = new Product();
|
Product product = new Product();
|
||||||
product.setProductCode("M10001");
|
product.setProductCode("M10001");
|
||||||
product.setProductName("测试商品");
|
product.setProductName("测试商品");
|
||||||
|
@ -42,7 +48,87 @@ public class ProductTestController {
|
||||||
product.setCreateDateTime(new Date());
|
product.setCreateDateTime(new Date());
|
||||||
product.setUpdateDateTime(new Date());
|
product.setUpdateDateTime(new Date());
|
||||||
productMapper.insert(product);
|
productMapper.insert(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试插入
|
||||||
|
*/
|
||||||
|
@ApiOperation("测试插入商品分类")
|
||||||
|
@PostMapping("/insertProductCategory")
|
||||||
|
public void insertProductCategory() {
|
||||||
|
ProductCategory productCategory = new ProductCategory();
|
||||||
|
productCategory.setCategoryName("一年级");
|
||||||
|
productCategory.setCategoryType("Title");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 测试查询
|
||||||
|
// */
|
||||||
|
// @ApiOperation("测试查询")
|
||||||
|
// @GetMapping("/queryTest")
|
||||||
|
// public AjaxResult<Product> query(@Validated Product bo) {
|
||||||
|
// Product product = productMapper.findById(bo.getId());
|
||||||
|
// return new AjaxResult<Product>().setData(product);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 测试查询2(根据实体类字段)
|
||||||
|
// */
|
||||||
|
// @ApiOperation("测试查询2")
|
||||||
|
// @GetMapping("/query2Test")
|
||||||
|
// public AjaxResult<List<Product>> query2(@Validated Product bo) {
|
||||||
|
// ProductQuery productQuery = productMapper.query().where.eqByEntity(bo).end();
|
||||||
|
// List<Product> products = productMapper.listEntity(productQuery);
|
||||||
|
// log.info("query2 rows = {}", CollUtil.size(products));
|
||||||
|
// return new AjaxResult<List<Product>>().setData(products);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// /**
|
||||||
|
// * 测试删除
|
||||||
|
// */
|
||||||
|
// @ApiOperation("测试删除")
|
||||||
|
// @DeleteMapping("/deleteTest")
|
||||||
|
// public AjaxResult<Void> delete(@Validated Product bo) {
|
||||||
|
// return toAjax(productMapper.deleteById(bo.getId()));
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 测试删除2
|
||||||
|
// */
|
||||||
|
// @ApiOperation("测试删除2(根据相关参数)")
|
||||||
|
// @DeleteMapping("/delete2Test")
|
||||||
|
// public AjaxResult<Void> delete2(@Validated Product bo) {
|
||||||
|
// ProductQuery productQuery = productMapper.query().where.eqByEntity(bo).end();
|
||||||
|
// List<Product> products = productMapper.listEntity(productQuery);
|
||||||
|
// int row = productMapper.delete(productQuery);
|
||||||
|
// return toAjax(row);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// static final String url =
|
||||||
|
// "jdbc:mysql://localhost:3306/ruoyi?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true";
|
||||||
|
// static final String basePackage = "com.ruoyi.common.core.domain.entity.test";
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * 测试删除2
|
||||||
|
// */
|
||||||
|
// @ApiOperation("生成测试")
|
||||||
|
// @DeleteMapping("/generatorTest")
|
||||||
|
// public AjaxResult<Void> generatorTest() {
|
||||||
|
// FileGenerator.build(Noting.class);
|
||||||
|
// return toAjax(true);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// @Tables(
|
||||||
|
// url = url, username = "root", password = "123456",
|
||||||
|
// basePack = basePackage,
|
||||||
|
// srcDir = "src/main/java/com/ruoyi/common/core/domain/entity/test",
|
||||||
|
// tables = @Table(value = {"product_category", "product", "product_category_relation"})
|
||||||
|
// )
|
||||||
|
// static class Noting{}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?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>3.0.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-mall</artifactId>
|
||||||
|
|
||||||
|
</project>
|
Loading…
Reference in New Issue