检索历史修改

This commit is contained in:
梁琦涛
2023-11-16 10:16:57 +08:00
parent 833ac1be92
commit 44036df8b6
4 changed files with 43 additions and 2 deletions
@@ -130,6 +130,16 @@ public class MybatisInterceptor implements Interceptor {
ReflectionUtils.setField(field,parameter,sysUser.getOrgCode());
}
}
// 注入逻辑删除默认值
if ("delFlag".equals(field.getName())) {
ReflectionUtils.makeAccessible(field);
Object localDelFlag = ReflectionUtils.getField(field,parameter);
if (localDelFlag == null || "".equals(localDelFlag)) {
// 登录人账号
ReflectionUtils.makeAccessible(field);
ReflectionUtils.setField(field,parameter,"0");
}
}
} catch (Exception e) {
log.error("异常", e);
}
@@ -136,4 +136,27 @@ public class DateUtil {
return dayStrings;
}
/**
*
* @author LQT
* @date 2023/11/16 9:24
* @param d 当前时间
* @param i 月份个月 比如 -3 为当前时间的前三个月 3 为当前时间后三个月
* @return java.util.List<java.lang.String>
*/
public static String getLastDate(Date d, int i) {
//得到日历
Calendar calendar = Calendar.getInstance();
//把当前时间赋给日历
calendar.setTime(d);
//设置为前3月
calendar.add(Calendar.MONTH, i);
//得到前3月的时间
Date dBefore = calendar.getTime();
//设置时间格式
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//格式化前3月的时间
return sdf.format(dBefore);
}
}
@@ -10,6 +10,7 @@ import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.util.MessageUtils;
import com.jero.common.api.vo.ResultCommon;
import com.jero.modules.laws.common.util.DateUtil;
import com.jero.modules.laws.home.entity.LawsHomeNormalSearchHistory;
import com.jero.modules.laws.home.service.ILawsHomeNormalSearchHistoryService;
import io.swagger.annotations.Api;
@@ -21,7 +22,10 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
@@ -53,6 +57,10 @@ public class LawsHomeNormalSearchHistoryController extends JeroController<LawsHo
HttpServletRequest req) {
QueryWrapper<LawsHomeNormalSearchHistory> queryWrapper = QueryGenerator.initQueryWrapper(lawsHomeNormalSearchHistory, req.getParameterMap());
Page<LawsHomeNormalSearchHistory> page = new Page<>(pageNo, pageSize);
// 三月前
String lastDate = DateUtil.getLastDate(new Date(), -3);
queryWrapper.ge("create_time",lastDate + " 00:00:00");
queryWrapper.orderByDesc("id");
IPage<LawsHomeNormalSearchHistory> pageList = lawsHomeNormalSearchHistoryService.page(page,queryWrapper);
return Result.OK(pageList);
}
@@ -46,8 +46,8 @@ public class LawsHomeNormalSearchHistory implements Serializable {
private String createBy;
/**创建日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyyMMdd EEEE")
@JsonFormat(timezone = "GMT+8",pattern = "yyyyMMdd EEEE")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;