.orderByAsc(new QueryWrapper<TicketDemandEntity>().last("FIELD(status, 1, 0)"))会报错啊
时间: 2024-02-27 19:57:51 浏览: 28
如果报错可以尝试将代码改为:
```
IPage<TicketDemandEntity> page = this.page(
new Query<TicketDemandEntity>().getPage(params),
new LambdaQueryWrapper<TicketDemandEntity>()
.eq(StringUtils.isNotBlank(price), TicketDemandEntity::getPrice, price)
.eq(StringUtils.isNotBlank(isMany), TicketDemandEntity::getIsMany, isMany)
.eq(StringUtils.isNotBlank(status), TicketDemandEntity::getStatus, status)
.eq(StringUtils.isNotBlank(area), TicketDemandEntity::getArea, area)
.orderByDesc(TicketDemandEntity::getCreateDate)
.orderByAsc(new FieldSort("status", new String[]{"1", "0"}))
);
```
这里使用了MyBatis Plus提供的FieldSort类,可以按照指定的字段值顺序进行排序。例如new FieldSort("status", new String[]{"1", "0"})表示将status为1的排在前面,status为0的排在后面。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
根据这个页面制作一个js完善功能<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>购物车</title> <script src="script.js"></script> </head> <body> 欢迎来到我们的网站! 首页 商品 购物车 登录 <main> 购物车
商品1 价格:100元 <form> <label for="quantity1">数量:</label> <input type="number" id="quantity1" min="1" value="1"> <button type="submit">更新</button> </form> <button class="remove">删除</button>
商品2 价格:200元 <form> <label for="quantity2">数量:</label> <input type="number" id="quantity2" min="1" value="1"> <button type="submit">更新</button> </form> <button class="remove">删除</button> 总价:300元 <button id="checkout">结算</button> </main> </body> </html>
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)