Search in sources :

Example 6 with PaginationInnerInterceptor

use of com.baomidou.mybatisplus.solon.plugins.inner.PaginationInnerInterceptor in project solon by noear.

the class SelectBodyToPlainSelectTest method testPaginationInterceptorOrderByEmptyColumnFix.

@Test
void testPaginationInterceptorOrderByEmptyColumnFix() {
    String actualSql = new PaginationInnerInterceptor().concatOrderBy("select * from test", ITEMS);
    assertThat(actualSql).isEqualTo("SELECT * FROM test ORDER BY column ASC");
    String actualSqlWhere = new PaginationInnerInterceptor().concatOrderBy("select * from test where 1 = 1", ITEMS);
    assertThat(actualSqlWhere).isEqualTo("SELECT * FROM test WHERE 1 = 1 ORDER BY column ASC");
}
Also used : PaginationInnerInterceptor(com.baomidou.mybatisplus.solon.plugins.inner.PaginationInnerInterceptor) Test(org.junit.jupiter.api.Test)

Example 7 with PaginationInnerInterceptor

use of com.baomidou.mybatisplus.solon.plugins.inner.PaginationInnerInterceptor in project solon-examples by noear.

the class Config method db1_interceptor.

@Bean
public void db1_interceptor(@Db("db1") org.apache.ibatis.session.Configuration cfg) {
    MybatisPlusInterceptor plusInterceptor = new MybatisPlusInterceptor();
    plusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
    cfg.setCacheEnabled(false);
    cfg.addInterceptor(plusInterceptor);
}
Also used : MybatisPlusInterceptor(com.baomidou.mybatisplus.solon.plugins.MybatisPlusInterceptor) PaginationInnerInterceptor(com.baomidou.mybatisplus.solon.plugins.inner.PaginationInnerInterceptor) Bean(org.noear.solon.annotation.Bean)

Aggregations

PaginationInnerInterceptor (com.baomidou.mybatisplus.solon.plugins.inner.PaginationInnerInterceptor)7 Test (org.junit.jupiter.api.Test)5 MybatisPlusInterceptor (com.baomidou.mybatisplus.solon.plugins.MybatisPlusInterceptor)2 Bean (org.noear.solon.annotation.Bean)2 OrderItem (com.baomidou.mybatisplus.core.metadata.OrderItem)1 InnerInterceptor (com.baomidou.mybatisplus.solon.plugins.inner.InnerInterceptor)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1