| | |
| | | } |
| | | } |
| | | |
| | | public String getSql(Class<? extends DataFieldSortFunc> cls, String fieldName) { |
| | | public String getOrderBySql(Class<? extends DataFieldSortFunc> cls, String fieldName) { |
| | | String sql = map.get(cls); |
| | | if (!Cools.isEmpty(sql)) { |
| | | return "ORDER BY FIELD(" + fieldName + ", " + sql + ") ASC, create_time DESC"; |
| | |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Bus, BaseParam> pageParam = new PageParam<>(baseParam, Bus.class); |
| | | QueryWrapper<Bus> wrapper = pageParam.buildWrapper(true); |
| | | if (createTimeDesc(pageParam.getOrders())) { |
| | | wrapper.last(businessSortService.getSql(BusStsType.class, "bus_sts")); |
| | | if (hasCreateTimeDesc(pageParam.getOrders())) { |
| | | wrapper.last(businessSortService.getOrderBySql(BusStsType.class, "bus_sts")); |
| | | } |
| | | PageParam<Bus, BaseParam> page = busService.page(pageParam, wrapper); |
| | | for (Bus record : page.getRecords()) { |
| | |
| | | return t; |
| | | } |
| | | |
| | | public Boolean createTimeDesc(List<OrderItem> orderItems) { |
| | | public Boolean hasCreateTimeDesc(List<OrderItem> orderItems) { |
| | | if (Cools.isEmpty(orderItems)) { |
| | | return true; |
| | | } |