Search in sources :

Example 1 with MyPage

use of com.maxqiu.demo.model.MyPage in project demo-SpringBoot by Max-Qiu.

the class TestPage method testMyPage.

/**
 * 自定义 page 对象
 */
@Test
void testMyPage() {
    // SELECT COUNT(*) FROM smp_user WHERE (age = ? AND username = ?) OR (age = ? AND username = ?)
    // select * from smp_user where (age = ? and username = ?) or (age = ? and username = ?) LIMIT ?
    MyPage<User> myPage = new MyPage<>(1, 5);
    myPage.setSelectInt(20);
    myPage.setSelectStr("Jack");
    ParamSome paramSome = new ParamSome(20, "Jack");
    MyPage<User> userMyPage = userMapper.mySelectPage(myPage, paramSome);
    System.out.println(userMyPage.getTotal());
}
Also used : User(com.maxqiu.demo.entity.User) ParamSome(com.maxqiu.demo.model.ParamSome) MyPage(com.maxqiu.demo.model.MyPage) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

User (com.maxqiu.demo.entity.User)1 MyPage (com.maxqiu.demo.model.MyPage)1 ParamSome (com.maxqiu.demo.model.ParamSome)1 Test (org.junit.jupiter.api.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1