feat: 待办时间范围查询

This commit is contained in:
裴浩宇 2024-05-13 18:20:40 +08:00
parent b86961c9d4
commit 3992e02eef
3 changed files with 22 additions and 1 deletions

View File

@ -141,8 +141,9 @@ public class LogAspect {
* 获取请求的参数放到log中
*
* @param operLog 操作日志
* @throws Exception 异常
*/
private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) {
private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog) throws Exception {
String requestMethod = operLog.getRequestMethod();
if (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)) {
String params = argsArrayToString(joinPoint.getArgs());

View File

@ -7,6 +7,8 @@ import com.pnkx.service.IPxToDoService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
@ -41,6 +43,19 @@ public class PxToDoServiceImpl implements IPxToDoService {
*/
@Override
public List<PxToDo> selectPxToDoList(PxToDo pxToDo) {
if (pxToDo.getParams().containsKey("date")) {
String date = pxToDo.getParams().get("date").toString();
// 创建一个日期时间格式化对象
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 解析字符串到LocalDateTime对象
LocalDateTime dateTime = LocalDateTime.parse(date, formatter);
// 加一个月
LocalDateTime plusMonth = dateTime.plusMonths(1);
pxToDo.getParams().put("endDate", plusMonth.format(formatter));
// 减一个月
LocalDateTime minusMonth = dateTime.minusMonths(1);
pxToDo.getParams().put("startDate", minusMonth.format(formatter));
}
return pxToDoMapper.selectPxToDoList(pxToDo);
}

View File

@ -55,6 +55,11 @@
<if test="version != null and version != ''">and version = #{version}</if>
<if test="finishBy != null and finishBy != ''">and finish_by = #{finishBy}</if>
<if test="finishTime != null and finishTime != ''">and finish_time = #{finishTime}</if>
<if test="params != null and params.date != null">
and (
plan_start_time &lt;= #{params.endDate} AND plan_end_time &gt;= #{params.startDate}
)
</if>
</where>
order by finish_time desc
</select>