diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java index de82d29..c24646f 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/gsp/GspSearchListForm.java @@ -66,6 +66,11 @@ public class GspSearchListForm { /** 出库日期结束 */ private String endDateCk; + /** 排序字段 */ + private String sortProp; + + /** 排序方向 ascending、descending */ + private String order; public Long getMdId() { @@ -211,4 +216,20 @@ public class GspSearchListForm { public void setJlzt(Integer jlzt) { this.jlzt = jlzt; } + + public String getSortProp() { + return sortProp; + } + + public void setSortProp(String sortProp) { + this.sortProp = sortProp; + } + + public String getOrder() { + return order; + } + + public void setOrder(String order) { + this.order = order; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java index 525bac5..558b2e2 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/GspServiceImpl.java @@ -307,6 +307,15 @@ public class GspServiceImpl extends ServiceImpl implements IGspS if(form.getArchive() != null && form.getArchive() == DaztEnum.ygd.getValue()) { queryWrapper.in("zjzt", ZjztEnum.dgd.getValue(), ZjztEnum.gd.getValue(), ZjztEnum.djd.getValue()); } + if(StringUtils.isEmpty(form.getSortProp()) || StringUtils.isEmpty(form.getOrder())) { + queryWrapper.orderByDesc("id"); + } else { + if(StringUtils.equals(form.getOrder(), "ascending")) { + queryWrapper.orderByAsc(form.getSortProp()); + } else { + queryWrapper.orderByDesc(form.getSortProp()); + } + } return this.list(queryWrapper); }