com.baomidou
mybatis-plus-boot-starter
${mybatis-plus.version}
org.apache.shardingsphere
sharding-jdbc-spring-boot-starter
${sharding-sphere.version}
org.apache.shardingsphere
sharding-jdbc-spring-namespace
${sharding-sphere.version}
org.projectlombok
lombok
true
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-maven-plugin
- 配置mysql-plus
@Configuration
@MapperScan(“com.github.jianzh5.blog.mapper”)
public class MybatisPlusConfig {
/**
- 攻击 SQL 阻断解析器
*/
@Bean
public PaginationInterceptor paginationInterceptor(){
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
List sqlParserList = new ArrayList<>();
sqlParserList.add(new BlockAttackSqlParser());
paginationInterceptor.setSqlParserList(sqlParserList);
return new PaginationInterceptor();
}
/**
- SQL执行效率插件
*/
@Bean
// @Profile({“dev”,“test”})
public PerformanceInterceptor performanceInterceptor() {
return new PerformanceInterceptor();
}
}
- 编写实体类Order
@Data
@TableName(“t_order”)
public class Order {
private Long id;
private String name;
private String type;
private Date gmtCr