当前使用版本(必填,否则不予处理)
3.3.1 3.5.1 MySQL 5.7.32
该问题是如何引起的?(确定最新版也有问题再提!!!)
使用orderBy或orderByDesc进行多字段排序时sql拼接多个Desc 与预期排序不符
重现步骤(如果有就写完整)
List<UserEntity> list = baseUserService.lambdaQuery().orderByDesc(UserEntity::getAuthenticationStatus, UserEntity::getCreateTime).list();
预期SQL为
SELECT id,mobile,nickname,avatar,gender,status,authentication_status,logoff,is_seller,password,withdrawal_password,salt,inviter_id,create_time,login_time,login_ip,login_app,login_device,login_device_os FROM ex_user ORDER BY authentication_status,create_time DESC
实际SQL为
SELECT id,mobile,nickname,avatar,gender,status,authentication_status,logoff,is_seller,password,withdrawal_password,salt,inviter_id,create_time,login_time,login_ip,login_app,login_device,login_device_os FROM ex_user ORDER BY authentication_status DESC,create_time DESC
实际sql在每一个排序字段后面都加了desc关键字导致排序与预期不符
报错信息
Comment From: MatrixMachine
使用版本均为mybatis-plus-boot-starter版本
Comment From: miemieYaho
实际SQL才是正确结果