管道基础大数据平台系统开发-【后端】-Server
1
13693261870
2022-10-19 73e8f38ca1c41290d129dddbce3cb7136c7b4c89
src/main/java/com/lf/server/config/InitConfig.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lf.server.entity.bd.DlgAgnp;
import com.lf.server.helper.PathHelper;
@@ -59,8 +60,12 @@
        }
    }
    /**
     * 测试 Mybatis-Plus
     */
    private void testMybatisPlus() {
        DlgAgnp dlg = dlgAgnpMapper.selectById(1);
        dlg = dlgAgnpMapper.selectOne(2);
        Map<String, Object> map = new HashMap<String, Object>(3);
        map.put("gid", 2);
@@ -88,10 +93,16 @@
        // 页数 / 每页记录数
        Page<DlgAgnp> page = new Page<>(1, 10);
        // 分页 / 参数二:wrapper查询条件
        // 升序排序
        page.addOrder(OrderItem.asc("gid"));
        // 分页:Wrapper查询条件
        Page<DlgAgnp> userPage = dlgAgnpMapper.selectPage(page, null);
        // 总页数 / 总记录数:325 / 3247
        String str = userPage.getPages() + " / " + userPage.getTotal();
        List<DlgAgnp> list4 = userPage.getRecords();
        QueryWrapper<DlgAgnp> w3 = new QueryWrapper<>();
        w3.like("name", "多").ge("gid", 100);
        List<DlgAgnp> list5 = dlgAgnpMapper.selectList(w3);
    }
}