法律法规时间筛选修改

master
徐杰盟 2024-11-14 15:45:48 +08:00
parent 3b440067e6
commit 2c05f5a845
1 changed files with 23 additions and 6 deletions

View File

@ -20,6 +20,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;
@ -106,6 +107,7 @@ public class SzRuleByLawController extends AbstractCommonFileController {
@PostMapping("/page")
public R<Page<SzRuleByLaw>> page(@RequestBody @Validated SzRuleByLawPage page) {
LambdaQueryWrapper<SzRuleByLaw> query = Wrappers.lambdaQuery();
Calendar calendar=Calendar.getInstance();
if (Objects.nonNull(page.getType())) {
query.eq(SzRuleByLaw::getType, page.getType());
@ -127,24 +129,39 @@ public class SzRuleByLawController extends AbstractCommonFileController {
query.ge(SzRuleByLaw::getAnnouncementDate, page.getStmAd());
}
if (Objects.nonNull(page.getEtmAd())) {
query.le(SzRuleByLaw::getAnnouncementDate, page.getStmAd());
Date etmAd = page.getEtmAd();
if (Objects.nonNull(etmAd)) {
calendar.setTime(etmAd);
calendar.set(Calendar.HOUR,23);
calendar.set(Calendar.MINUTE,59);
calendar.set(Calendar.SECOND,59);
query.le(SzRuleByLaw::getAnnouncementDate, calendar.getTime());
}
if (Objects.nonNull(page.getStmIm())) {
query.ge(SzRuleByLaw::getImplementationDate, page.getStmIm());
}
if (Objects.nonNull(page.getEtmIm())) {
query.le(SzRuleByLaw::getImplementationDate, page.getEtmIm());
Date etmIm = page.getEtmIm();
if (Objects.nonNull(etmIm)) {
calendar.setTime(etmIm);
calendar.set(Calendar.HOUR,23);
calendar.set(Calendar.MINUTE,59);
calendar.set(Calendar.SECOND,59);
query.le(SzRuleByLaw::getImplementationDate, calendar.getTime());
}
if (Objects.nonNull(page.getStmUd())) {
query.ge(SzRuleByLaw::getUploadDate, page.getStmUd());
}
if (Objects.nonNull(page.getEtmUd())) {
query.le(SzRuleByLaw::getUploadDate, page.getEtmUd());
Date etmUd = page.getEtmUd();
if (Objects.nonNull(etmUd)) {
calendar.setTime(etmUd);
calendar.set(Calendar.HOUR,23);
calendar.set(Calendar.MINUTE,59);
calendar.set(Calendar.SECOND,59);
query.le(SzRuleByLaw::getUploadDate, calendar.getTime());
}
query.orderByDesc(SzRuleByLaw::getCreateTime);