认知
其实两者联合使用非常简单,只需要在使用分页插件的基础上使用其提供的orderByDesc/orderByAsc就能完美融合。写这篇博客只是给一些初学者一个方便的整理而已。下面会先给出完整的使用情况,在到后面分别解释两者的用法。以方便只关心这个用法或者赶时间的朋友。处于保密性考虑,我将大部分字段进行了删减,将项目名也进行了修改
Controller
@Slf4j
@Validated
@RestController
@RequestMapping("/com-organization")
public class ComOrganizationController {
@PostMapping(value = "/getPage")
public Response<IPage<ComOrganizationQueryParam>> getPage(@RequestBody @Valid ComOrganizationQueryParam param, BindingResult bindingResult) throws Exception {
if (bindingResult.hasErrors()) {
return Response.failed("参数有误:" + bindingResult.getFieldError().toString());
}
QueryWrapper<ComOrganization> queryWrapper = new QueryWrapper<ComOrganization>();
//如果前端有值传入 则将其赋值。无则就不赋值。为后面设置查询条件铺路
queryWrapper.eq(param.getCompanyId() !=