perf: 台桌列表增加分页
This commit is contained in:
@@ -53,8 +53,8 @@ public class TbShopTableController {
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("查询/shop/table")
|
||||
public ResponseEntity<Object> queryTbShopTable(TbShopTableQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbShopTableService.queryAllNoPage(criteria),HttpStatus.OK);
|
||||
public ResponseEntity<Object> queryTbShopTable(@Validated TbShopTableQueryCriteria criteria){
|
||||
return new ResponseEntity<>(tbShopTableService.queryAllPage(criteria),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
|
||||
@@ -18,6 +18,8 @@ package cn.ysk.cashier.dto.shop;
|
||||
import lombok.Data;
|
||||
import cn.ysk.cashier.annotation.Query;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
* @author lyf
|
||||
@@ -32,6 +34,7 @@ public class TbShopTableQueryCriteria{
|
||||
|
||||
/** 精确 */
|
||||
@Query
|
||||
@NotNull
|
||||
private Integer shopId;
|
||||
|
||||
@Query
|
||||
@@ -39,4 +42,7 @@ public class TbShopTableQueryCriteria{
|
||||
|
||||
@Query
|
||||
private Long qrcode;
|
||||
|
||||
private Integer page = 1;
|
||||
private Integer size = 99999;
|
||||
}
|
||||
|
||||
@@ -217,11 +217,28 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAllNoPage(TbShopTableQueryCriteria criteria) {
|
||||
public Map<String, Object> queryAllPage(TbShopTableQueryCriteria criteria) {
|
||||
if (null == criteria.getAreaId() || criteria.getAreaId() == 0) {
|
||||
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<>();
|
||||
for (TbShopTable date : tbShopTableList) {
|
||||
if (StrUtil.isBlank(date.getQrcode())) {
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface TbShopTableService {
|
||||
*/
|
||||
Map<String,Object> queryAll(TbShopTableQueryCriteria criteria, Pageable pageable);
|
||||
|
||||
Map<String,Object> queryAllNoPage(TbShopTableQueryCriteria criteria);
|
||||
Map<String,Object> queryAllPage(TbShopTableQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 查询所有数据不分页
|
||||
|
||||
Reference in New Issue
Block a user