feat: 添加 vue3 时间区间查询

This commit is contained in:
xingyu 2022-07-21 15:07:04 +08:00
parent 22429140bd
commit bc233df980
4 changed files with 21 additions and 3 deletions

View File

@ -94,6 +94,19 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
return this; return this;
} }
public LambdaQueryWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object[] values) {
if (values!= null && values.length >0 && values[0] != null && values[1] != null) {
return (LambdaQueryWrapperX<T>) super.between(column, values[0], values[1]);
}
if (values != null && values[0] != null) {
return (LambdaQueryWrapperX<T>) ge(column, values[0]);
}
if (values != null && values[1] != null) {
return (LambdaQueryWrapperX<T>) le(column, values[2]);
}
return this;
}
// ========== 重写父类方法方便链式调用 ========== // ========== 重写父类方法方便链式调用 ==========
@Override @Override

View File

@ -37,6 +37,10 @@ public class UserPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime; private Date endTime;
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] createTime;
@ApiModelProperty(value = "部门编号", example = "1024", notes = "同时筛选子部门") @ApiModelProperty(value = "部门编号", example = "1024", notes = "同时筛选子部门")
private Long deptId; private Long deptId;

View File

@ -33,7 +33,8 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
.likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername()) .likeIfPresent(AdminUserDO::getUsername, reqVO.getUsername())
.likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile()) .likeIfPresent(AdminUserDO::getMobile, reqVO.getMobile())
.eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus()) .eqIfPresent(AdminUserDO::getStatus, reqVO.getStatus())
.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) .betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getBeginTime(),reqVO.getEndTime())
.betweenIfPresent(AdminUserDO::getCreateTime, reqVO.getCreateTime())
.inIfPresent(AdminUserDO::getDeptId, deptIds) .inIfPresent(AdminUserDO::getDeptId, deptIds)
.orderByDesc(AdminUserDO::getId)); .orderByDesc(AdminUserDO::getId));

View File

@ -101,7 +101,7 @@ const crudSchemas = reactive<CrudSchema[]>([
}, },
{ {
label: t('common.createTime'), label: t('common.createTime'),
field: 'daterange', field: 'createTime',
table: { table: {
show: false show: false
}, },
@ -115,7 +115,7 @@ const crudSchemas = reactive<CrudSchema[]>([
show: true, show: true,
component: 'DatePicker', component: 'DatePicker',
componentProps: { componentProps: {
type: 'daterange', type: 'datetimerange',
valueFormat: 'YYYY-MM-DD HH:mm:ss' valueFormat: 'YYYY-MM-DD HH:mm:ss'
} }
} }