|
@@ -1,11 +1,15 @@
|
|
|
package com.mrxu.framework.boot.entity;
|
|
package com.mrxu.framework.boot.entity;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.mrxu.framework.boot.MrxuConst;
|
|
|
|
|
|
|
+import com.mrxu.framework.common.util.DateFunc;
|
|
|
import com.mrxu.framework.common.util.MrxuAssert;
|
|
import com.mrxu.framework.common.util.MrxuAssert;
|
|
|
|
|
+import com.mrxu.framework.common.util.MrxuConst;
|
|
|
import com.mrxu.framework.common.util.StrFunc;
|
|
import com.mrxu.framework.common.util.StrFunc;
|
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
import io.swagger.annotations.ApiModelProperty;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
+
|
|
|
public class PageParam<T> extends Page<T> {
|
|
public class PageParam<T> extends Page<T> {
|
|
|
|
|
|
|
|
public static final String timeRangeTypeToday = "today";
|
|
public static final String timeRangeTypeToday = "today";
|
|
@@ -77,4 +81,79 @@ public class PageParam<T> extends Page<T> {
|
|
|
this.tenantId = tenantId;
|
|
this.tenantId = tenantId;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public List<Integer> getIds(String ids) {
|
|
|
|
|
+ if(StrFunc.isEmpty(ids) || "0".equals(ids)) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ List<Integer> rs = new ArrayList<>();
|
|
|
|
|
+ for(String temp: ids.split(",")) {
|
|
|
|
|
+ rs.add(Integer.valueOf(temp));
|
|
|
|
|
+ }
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String[] getDateArray(String dateRange) {
|
|
|
|
|
+ String[] arr = getTimeArray(dateRange);
|
|
|
|
|
+ if(arr == null) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ arr[0] = arr[0].trim().substring(MrxuConst.zero,10);
|
|
|
|
|
+ arr[1] = arr[1].trim().substring(MrxuConst.zero,10);
|
|
|
|
|
+ return arr;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public String[] getTimeArray(String timeRange) {
|
|
|
|
|
+ if(StrFunc.isNotEmpty(timeRange)) {
|
|
|
|
|
+ String[] rs = new String[2];
|
|
|
|
|
+ if(PageParam.timeRangeTypeToday.equals(timeRange)) {
|
|
|
|
|
+ rs[0] = DateFunc.getTodayStart();
|
|
|
|
|
+ rs[1] = DateFunc.getTodayEnd();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(PageParam.timeRangeTypeYesterday.equals(timeRange)) {
|
|
|
|
|
+ rs[0] = DateFunc.getYesterdayStart();
|
|
|
|
|
+ rs[1] = DateFunc.getYesterdayEnd();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(PageParam.timeRangeTypeTomorrow.equals(timeRange)) {
|
|
|
|
|
+ rs[0] = DateFunc.getTomorrowStart();
|
|
|
|
|
+ rs[1] = DateFunc.getTomorrowEnd();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(PageParam.timeRangeTypeAfterTomorrow.equals(timeRange)) {
|
|
|
|
|
+ rs[0] = DateFunc.getAfterTomorrowStart();
|
|
|
|
|
+ rs[1] = DateFunc.getAfterTomorrowEnd();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(PageParam.timeRangeTypeThisWeek.equals(timeRange)) {
|
|
|
|
|
+ rs[0] = DateFunc.getWeekStart();
|
|
|
|
|
+ rs[1] = DateFunc.getWeekEnd();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(PageParam.timeRangeTypeLastWeek.equals(timeRange)) {
|
|
|
|
|
+ rs[0] = DateFunc.getLastWeekStart();
|
|
|
|
|
+ rs[1] = DateFunc.getLastWeekEnd();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(PageParam.timeRangeTypeThisMonth.equals(timeRange)) {
|
|
|
|
|
+ rs[0] = DateFunc.getMonthStart();
|
|
|
|
|
+ rs[1] = DateFunc.getMonthEnd();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ if(PageParam.timeRangeTypeLastMonth.equals(timeRange)) {
|
|
|
|
|
+ rs[0] = DateFunc.getLastMonthStart();
|
|
|
|
|
+ rs[1] = DateFunc.getLastMonthEnd();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ String[] arr = timeRange.split("~");
|
|
|
|
|
+ rs[0] = arr[0].trim();
|
|
|
|
|
+ rs[1] = arr[1].trim();
|
|
|
|
|
+ return rs;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|