This commit is contained in:
LiJianZhao 2025-05-08 16:52:32 +08:00
parent 01a8237bb0
commit c0e343a34c
1 changed files with 5 additions and 2 deletions

View File

@ -84,15 +84,18 @@ public class SocialDiagnoseService extends BaseService {
*/
public List<SocialDiagnose> getDiagnosis(String keyword) {
QueryWrapper<SocialDiagnose> queryWrapper = new QueryWrapper<>();
queryWrapper.select("*,CHAR_LENGTH(name) as name_length");
if (keyword != null && !keyword.isEmpty()) {
String key = keyword.trim().toUpperCase();
queryWrapper.and(wrapper -> wrapper.like("name", key)
.or().like("code", key)
.or().like("pinyin_full", key)
.or().like("pinyin_first", key));
}
queryWrapper.orderByDesc("use_num","id");
queryWrapper.orderByDesc("use_num");
queryWrapper.orderByAsc("name_length");
queryWrapper.orderByDesc("id");
queryWrapper.last("limit 60");
return socialDiagnoseMapper.selectList(queryWrapper);
}