| | |
| | | |
| | | 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; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 测试 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); |
| | |
| | | |
| | | // 页数 / 每页记录数 |
| | | 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); |
| | | } |
| | | } |