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