mirror of
https://gitee.com/best_handsome/mybatis-plus-join
synced 2025-07-11 00:02:22 +08:00
模块化项目
This commit is contained in:
parent
3326a1b81d
commit
f29655c206
@ -55,7 +55,6 @@ public class MybatisPlusJoinAutoConfiguration {
|
||||
* mybatis plus join 拦截器
|
||||
*/
|
||||
@Bean
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
public MPJInterceptor mpjInterceptor() {
|
||||
return new MPJInterceptor();
|
||||
}
|
||||
|
@ -69,6 +69,7 @@
|
||||
<artifactId>mybatis-plus-join-boot-starter</artifactId>
|
||||
<version>1.3.0</version>
|
||||
</dependency>
|
||||
<!-- PageHelper 兼容性测试 -->
|
||||
<dependency>
|
||||
<groupId>com.github.pagehelper</groupId>
|
||||
<artifactId>pagehelper-spring-boot-starter</artifactId>
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.github.yulichang.test;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
|
||||
import com.github.yulichang.test.mapper.UserMapper;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ApplicationContextEvent;
|
||||
@ -10,18 +10,19 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@SuppressWarnings("unused")
|
||||
public class ListenerEvent implements ApplicationListener<ApplicationContextEvent> {
|
||||
|
||||
@Resource
|
||||
private HikariDataSource hikariDataSource;
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
List<TableInfo> infos = TableInfoHelper.getTableInfos();
|
||||
System.out.println("1");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,6 +8,8 @@ spring:
|
||||
init:
|
||||
schema-locations: classpath:db/schema.sql
|
||||
data-locations: classpath:db/data.sql
|
||||
|
||||
|
||||
mybatis-plus:
|
||||
global-config:
|
||||
db-config:
|
||||
@ -15,8 +17,9 @@ mybatis-plus:
|
||||
logic-delete-value: true
|
||||
logic-not-delete-value: false
|
||||
banner: true
|
||||
# configuration:
|
||||
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
configuration:
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
# 打印 mybatis plus join banner
|
||||
mybatis-plus-join:
|
||||
banner: false
|
||||
banner: true
|
@ -9,6 +9,7 @@ import com.github.yulichang.test.entity.UserDO;
|
||||
import com.github.yulichang.test.mapper.UserMapper;
|
||||
import com.github.yulichang.toolkit.MPJWrappers;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@ -25,9 +26,12 @@ import java.util.Map;
|
||||
* 移除了mybatis-plus 逻辑删除支持,逻辑删除需要在连表查询时自己添加对应的条件
|
||||
*/
|
||||
@SpringBootTest
|
||||
@SuppressWarnings("unused")
|
||||
class JoinTest {
|
||||
@Resource
|
||||
private UserMapper userMapper;
|
||||
@Resource
|
||||
private SqlSessionFactory sqlSessionFactory;
|
||||
|
||||
/**
|
||||
* 一对多
|
||||
|
Loading…
x
Reference in New Issue
Block a user