增加日期起止查询测试用例
This commit is contained in:
parent
6050d0c2b1
commit
9f8b3f042c
|
@ -177,19 +177,20 @@ public class S extends StringUtils{
|
|||
}
|
||||
}
|
||||
// 包含_
|
||||
String result = null;
|
||||
StringBuilder sb = null;
|
||||
String[] words = snakeCaseStr.split(Cons.SEPARATOR_UNDERSCORE);
|
||||
for(String word : words){
|
||||
if(V.notEmpty(word)){
|
||||
if(result == null){
|
||||
result = word.toLowerCase();
|
||||
}
|
||||
else{
|
||||
result += word.substring(0, 1).toUpperCase() + word.substring(1).toLowerCase();
|
||||
}
|
||||
if(V.isEmpty(word)){
|
||||
continue;
|
||||
}
|
||||
if(sb == null){
|
||||
sb = new StringBuilder(word.toLowerCase());
|
||||
}
|
||||
else{
|
||||
sb.append(word.substring(0, 1).toUpperCase()).append(word.substring(1).toLowerCase());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return sb != null? sb.toString() : null;
|
||||
}
|
||||
|
||||
/***
|
||||
|
|
|
@ -55,6 +55,16 @@ public class TestJoinQuery {
|
|||
@Autowired
|
||||
DepartmentService departmentService;
|
||||
|
||||
@Test
|
||||
public void testDateCompaire(){
|
||||
Department example = departmentService.getSingleEntity(null);
|
||||
DepartmentDTO departmentDTO = new DepartmentDTO();
|
||||
departmentDTO.setBegin(example.getCreateTime());
|
||||
QueryWrapper<Department> queryWrapper = QueryBuilder.toQueryWrapper(departmentDTO);
|
||||
List<Department> list = departmentService.getEntityList(queryWrapper);
|
||||
Assert.assertTrue(list.size() >= 1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSingleTableQuery(){
|
||||
Department entity = new Department();
|
||||
|
|
|
@ -19,12 +19,15 @@ import com.diboot.core.binding.data.CheckpointType;
|
|||
import com.diboot.core.binding.data.DataAccessCheckpoint;
|
||||
import com.diboot.core.binding.query.BindQuery;
|
||||
import com.diboot.core.binding.query.Comparison;
|
||||
import com.diboot.core.util.D;
|
||||
import diboot.core.test.binder.entity.Department;
|
||||
import diboot.core.test.binder.entity.Organization;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Department DTO
|
||||
* @author mazc@dibo.ltd
|
||||
|
@ -56,4 +59,15 @@ public class DepartmentDTO extends Department {
|
|||
@DataAccessCheckpoint(type = CheckpointType.ORG)
|
||||
private Long orgId;
|
||||
|
||||
@BindQuery(comparison = Comparison.GE, field = "createTime")
|
||||
private Date begin;
|
||||
|
||||
@BindQuery(comparison = Comparison.LT, field = "createTime")
|
||||
private Date end;
|
||||
|
||||
public void setBegin(Date date){
|
||||
this.begin = date;
|
||||
this.end = D.addDays(date, 1);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue