Commit fd16e99aee8edc601206a527d08d58788e9176a4

Authored by JEECG开源社区
Committed by Gitee
2 parents fe7b2c32 26c62b91

!36 多条件排序无效问题修正

Merge pull request !36 from 燕山石头/deploy-wl
jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/system/query/QueryGenerator.java
... ... @@ -230,10 +230,19 @@ public class QueryGenerator {
230 230 //SQL注入check
231 231 SqlInjectionUtil.filterContent(column);
232 232  
  233 + // 排序规则修改
  234 + // 将现有排序
  235 + // 前端传递排序条件{....,column: 'column1,column2',order: 'desc'} 翻译成sql "column1,column2 desc"
  236 + // 修改为
  237 + // 前端传递排序条件{....,column: 'column1,column2',order: 'desc'} 翻译成sql "column1 desc,column2 desc"
233 238 if (order.toUpperCase().indexOf(ORDER_TYPE_ASC)>=0) {
234   - queryWrapper.orderByAsc(oConvertUtils.camelToUnderline(column));
  239 + String columnStr = oConvertUtils.camelToUnderline(column);
  240 + String[] columnArray = columnStr.split(",");
  241 + queryWrapper.orderByAsc(columnArray);
235 242 } else {
236   - queryWrapper.orderByDesc(oConvertUtils.camelToUnderline(column));
  243 + String columnStr = oConvertUtils.camelToUnderline(column);
  244 + String[] columnArray = columnStr.split(",");
  245 + queryWrapper.orderByDesc(columnArray);
237 246 }
238 247 }
239 248 }
... ...