修复食堂排序问题导致的分页重复
This commit is contained in:
1 parent
14a01f5e27
commit
8e01a0d1d5
3 files changed
+11
-9
No files matched your search
+1
-5
@@ -54,11 +54,7 @@ public class CanteenSpuController {
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
|
||||
public R getCanteenSpuPage(@ParameterObject Page page, @ParameterObject CanteenSpuEntity canteenSpu) {
|
||||
LambdaQueryWrapper<CanteenSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()), CanteenSpuEntity::getName, canteenSpu.getName());
|
||||
wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()), CanteenSpuEntity::getCategoryId, canteenSpu.getCategoryId());
|
||||
wrapper.orderByAsc(CanteenSpuEntity::getSort);
|
||||
return R.ok(canteenSpuService.pageScope(page, wrapper));
|
||||
return R.ok(canteenSpuService.pageScope(page, canteenSpu));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -38,10 +38,10 @@ public interface CanteenSpuService extends IService<CanteenSpuEntity> {
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page
|
||||
* @param wrapper
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
Object pageScope(Page page, LambdaQueryWrapper<CanteenSpuEntity> wrapper);
|
||||
Object pageScope(Page page, CanteenSpuEntity canteenSpu);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
+8
-2
@@ -95,8 +95,14 @@ public class CanteenSpuServiceImpl extends ServiceImpl<CanteenSpuMapper, Canteen
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object pageScope(Page page, LambdaQueryWrapper<CanteenSpuEntity> wrapper) {
|
||||
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
public Object pageScope(Page page, CanteenSpuEntity canteenSpu) {
|
||||
LambdaQueryWrapper<CanteenSpuEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenSpu.getName()), CanteenSpuEntity::getName, canteenSpu.getName());
|
||||
wrapper.eq(Objects.nonNull(canteenSpu.getCategoryId()), CanteenSpuEntity::getCategoryId, canteenSpu.getCategoryId());
|
||||
wrapper.orderByAsc(CanteenSpuEntity::getSort).orderByDesc(CanteenSpuEntity::getId);
|
||||
|
||||
Page pageData = baseMapper.selectPageByScope(page, wrapper, DataScope.of());
|
||||
return pageData;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user