@RequestMapping(value = "/qryEvnirOutlets/{pageNum}/{pageSize}",produces = "application/json") public JsObj qryEvnirInst(@PathVariable Long pageNum,@PathVariable Long pageSize,@RequestBody EvnirOutlets evnirOutlets) { JsObj jsObj = new JsObj(JsObj.CODE_SUCCESS); try { jsObj.setResObj(iEvnirOutletsService.list()); IPage<EvnirOutlets> pageParm = new Page<>(pageNum, pageSize); IPage page = this.iEvnirOutletsService.page(pageParm); jsObj.setResObj(page.getRecords()); jsObj.setTotal(page.getTotal()); } catch (Exception e) { log.error("查询网点异常", e); jsObj.setCodeMsg(JsObj.CODE_EXCEPETION, "查询网点异常"); } return jsObj; }按照时间顺序降序查询
时间: 2024-04-08 16:29:58 浏览: 80
你可以在这段代码中的`qryEvnirInst`方法中添加一个排序的参数来按照时间顺序降序查询。修改后的代码如下所示:
```java
@RequestMapping(value = "/qryEvnirOutlets/{pageNum}/{pageSize}", produces = "application/json")
public JsObj qryEvnirInst(@PathVariable Long pageNum, @PathVariable Long pageSize, @RequestBody EvnirOutlets evnirOutlets) {
JsObj jsObj = new JsObj(JsObj.CODE_SUCCESS);
try {
jsObj.setResObj(iEvnirOutletsService.list());
IPage<EvnirOutlets> pageParm = new Page<>(pageNum, pageSize);
pageParm.setDesc("time"); // 添加排序参数,按照时间顺序降序排序
IPage page = this.iEvnirOutletsService.page(pageParm);
jsObj.setResObj(page.getRecords());
jsObj.setTotal(page.getTotal());
} catch (Exception e) {
log.error("查询网点异常", e);
jsObj.setCodeMsg(JsObj.CODE_EXCEPETION, "查询网点异常");
}
return jsObj;
}
```
请确保你的`EvnirOutlets`实体类中有一个名为`time`的属性,且该属性的类型为时间类型。这样就能够按照时间顺序降序查询了。
阅读全文