perf: 台桌列表增加分页

This commit is contained in:
2024-10-25 09:53:26 +08:00
parent 537b9b408b
commit e2a624e653
4 changed files with 28 additions and 5 deletions

View File

@@ -53,8 +53,8 @@ public class TbShopTableController {
@GetMapping @GetMapping
@ApiOperation("查询/shop/table") @ApiOperation("查询/shop/table")
public ResponseEntity<Object> queryTbShopTable(TbShopTableQueryCriteria criteria){ public ResponseEntity<Object> queryTbShopTable(@Validated TbShopTableQueryCriteria criteria){
return new ResponseEntity<>(tbShopTableService.queryAllNoPage(criteria),HttpStatus.OK); return new ResponseEntity<>(tbShopTableService.queryAllPage(criteria),HttpStatus.OK);
} }
@PostMapping @PostMapping

View File

@@ -18,6 +18,8 @@ package cn.ysk.cashier.dto.shop;
import lombok.Data; import lombok.Data;
import cn.ysk.cashier.annotation.Query; import cn.ysk.cashier.annotation.Query;
import javax.validation.constraints.NotNull;
/** /**
* @website https://eladmin.vip * @website https://eladmin.vip
* @author lyf * @author lyf
@@ -32,6 +34,7 @@ public class TbShopTableQueryCriteria{
/** 精确 */ /** 精确 */
@Query @Query
@NotNull
private Integer shopId; private Integer shopId;
@Query @Query
@@ -39,4 +42,7 @@ public class TbShopTableQueryCriteria{
@Query @Query
private Long qrcode; private Long qrcode;
private Integer page = 1;
private Integer size = 99999;
} }

View File

@@ -217,11 +217,28 @@ public class TbShopTableServiceImpl implements TbShopTableService {
} }
@Override @Override
public Map<String, Object> queryAllNoPage(TbShopTableQueryCriteria criteria) { public Map<String, Object> queryAllPage(TbShopTableQueryCriteria criteria) {
if (null == criteria.getAreaId() || criteria.getAreaId() == 0) { if (null == criteria.getAreaId() || criteria.getAreaId() == 0) {
criteria.setAreaId(null); criteria.setAreaId(null);
} }
List<TbShopTable> tbShopTableList = tbShopTableRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder));
LambdaQueryWrapper<TbShopTable> query = new LambdaQueryWrapper<TbShopTable>()
.eq(TbShopTable::getShopId, criteria.getShopId());
if (StrUtil.isNotBlank(criteria.getName())) {
query.like(TbShopTable::getName, criteria.getName());
}
if (criteria.getAreaId() != null) {
query.eq(TbShopTable::getAreaId, criteria.getAreaId());
}
if (criteria.getQrcode() != null) {
query.eq(TbShopTable::getQrcode, criteria.getQrcode());
}
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbShopTable> shopTablePage =
mpShopTableService.page(new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(criteria.getPage(), criteria.getSize()), query);
List<TbShopTable> tbShopTableList = shopTablePage.getRecords();
ArrayList<Map<String, Object>> infoList = new ArrayList<>(); ArrayList<Map<String, Object>> infoList = new ArrayList<>();
for (TbShopTable date : tbShopTableList) { for (TbShopTable date : tbShopTableList) {
if (StrUtil.isBlank(date.getQrcode())) { if (StrUtil.isBlank(date.getQrcode())) {

View File

@@ -43,7 +43,7 @@ public interface TbShopTableService {
*/ */
Map<String,Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable); Map<String,Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable);
Map<String,Object> queryAllNoPage(TbShopTableQueryCriteria criteria); Map<String,Object> queryAllPage(TbShopTableQueryCriteria criteria);
/** /**
* 查询所有数据不分页 * 查询所有数据不分页