Skip to content

Commit

Permalink
feat(sirius): Add unix time query with PrefectType.PageUnixTime
Browse files Browse the repository at this point in the history
  • Loading branch information
yizzuide committed Nov 3, 2023
1 parent 666eec0 commit fd95005
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,28 @@ public class UniformQueryData<T> {
* 模型实体
*/
private T entity;

/**
* 开始时间
*/
private Date startDate;

/**
* 结束时间
*/
private Date endDate;

public Long getStartUnixTime() {
if (getStartDate() == null) {
return null;
}
return getStartDate().getTime() / 1000;
}

public Long getEndUnixTime() {
if (getEndDate() == null) {
return null;
}
return getEndDate().getTime() / 1000;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,9 @@ public UniformPage<T> selectByPage(UniformQueryPageData<T> queryPageData, Map<St
} else if (queryMatcher.prefect() == PrefectType.PageDate) {
queryWrapper.ge(Objects.nonNull(queryPageData.getStartDate()), columnName, queryPageData.getStartDate());
queryWrapper.le(Objects.nonNull(queryPageData.getEndDate()), columnName, queryPageData.getEndDate());
} else if (queryMatcher.prefect() == PrefectType.PageUnixTime) {
queryWrapper.ge(Objects.nonNull(queryPageData.getStartDate()), columnName, queryPageData.getStartUnixTime());
queryWrapper.le(Objects.nonNull(queryPageData.getEndDate()), columnName, queryPageData.getEndUnixTime());
} else if (queryMatcher.prefect() == PrefectType.OrderByPre) {
queryWrapper.orderBy(true, queryMatcher.forward(), columnName);
} else if (queryMatcher.prefect() == PrefectType.OrderByPost) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,10 @@ public enum PrefectType {
/**
* Using for `startDate` and `endDate` of {@link UniformQueryPageData} query.
*/
PageDate
PageDate,

/**
* Query with unix time relative to {@link PrefectType#PageDate}.
*/
PageUnixTime
}
9 changes: 6 additions & 3 deletions MilkomedaDemo/src/main/doc/bak.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ create schema milkomeda;
create schema milkomeda_r;
create schema milkomeda_01;

-- for milkomeda,milkomeda_r,milkomeda_01
-- apply to milkomeda, milkomeda_r, milkomeda_01
drop table if exists t_order;
create table t_order
(
id bigint not null primary key auto_increment,
Expand All @@ -18,7 +19,8 @@ create table t_order
comment 'order table';


-- for milkomeda
-- apply to milkomeda
drop table if exists t_order_001;
create table t_order_001
(
id bigint not null primary key auto_increment,
Expand All @@ -32,7 +34,8 @@ create table t_order_001
)
comment 'order table';


-- apply to milkomeda
drop table if exists job_inspection;
create table job_inspection
(
id bigint(32) not null,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
package com.github.yizzuide.milkomeda.demo.crust.controller;

import com.github.yizzuide.milkomeda.comet.core.CometResponseWrapper;
import com.github.yizzuide.milkomeda.crust.CrustContext;
import com.github.yizzuide.milkomeda.crust.CrustPermission;
import com.github.yizzuide.milkomeda.crust.CrustUserInfo;
import com.github.yizzuide.milkomeda.demo.crust.pojo.User;
import com.github.yizzuide.milkomeda.hydrogen.uniform.ResultVO;
import com.github.yizzuide.milkomeda.hydrogen.uniform.UniformResult;
import com.github.yizzuide.milkomeda.universe.context.WebContext;
import com.wf.captcha.SpecCaptcha;
import com.wf.captcha.base.Captcha;
import com.wf.captcha.utils.CaptchaUtil;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.util.WebUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
Expand Down Expand Up @@ -45,10 +43,7 @@ public void render(HttpServletRequest request, HttpServletResponse response) thr
captcha.setFont(new Font("Arial", Font.PLAIN, 24));
// 字符+数字组合
captcha.setCharType(Captcha.TYPE_DEFAULT);
CometResponseWrapper responseWrapper =
WebUtils.getNativeResponse(response, CometResponseWrapper.class);
Assert.notNull(responseWrapper, "Response wrapper not found");
CaptchaUtil.out(captcha, request, (HttpServletResponse)responseWrapper.getResponse());
CaptchaUtil.out(captcha, request, WebContext.getRawResponse());

// 验证输入
//CaptchaUtil.ver(code, request);
Expand Down

0 comments on commit fd95005

Please sign in to comment.