+ D.nextDay(),获取下一天

This commit is contained in:
mazhicheng 2020-06-26 12:35:40 +08:00
parent 8f58dc05d5
commit 3c4804a8ea
3 changed files with 18 additions and 6 deletions

View File

@ -141,6 +141,18 @@ public class D extends DateUtils{
return sdf.format(date);
}
/**
* 获取日期的下一天
* @param date 基准日期
* @return yyyy-MM-dd
*/
public static Date nextDay(Date date){
if(date == null){
return null;
}
return addDays(date, 1);
}
/***
* 获取格式化的日期时间
* @param date

View File

@ -59,7 +59,7 @@ public class TestJoinQuery {
public void testDateCompaire(){
Department example = departmentService.getSingleEntity(null);
DepartmentDTO departmentDTO = new DepartmentDTO();
departmentDTO.setBegin(example.getCreateTime());
departmentDTO.setCreateTime(example.getCreateTime());
QueryWrapper<Department> queryWrapper = QueryBuilder.toQueryWrapper(departmentDTO);
List<Department> list = departmentService.getEntityList(queryWrapper);
Assert.assertTrue(list.size() >= 1);

View File

@ -59,15 +59,15 @@ public class DepartmentDTO extends Department {
@DataAccessCheckpoint(type = CheckpointType.ORG)
private Long orgId;
// 查询单个日期
@BindQuery(comparison = Comparison.GE, field = "createTime")
private Date begin;
private Date createTime;
@BindQuery(comparison = Comparison.LT, field = "createTime")
private Date end;
private Date createTimeEnd;
public void setBegin(Date date){
this.begin = date;
this.end = D.addDays(date, 1);
private Date getCreateTimeEnd(){
return D.nextDay(createTime);
}
}