后端

实体类中时间注解

import org.springframework.format.annotation.DateTimeFormat;

@ApiModelProperty(value = "点赞范围起始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startDate;
@ApiModelProperty(value = "点赞范围终止时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endDate;

mybatis-plus查询

wrapper.between("CREATE_TIME", userFavoritePageParam.getStartDate(), userFavoritePageParam.getEndDate());

前端

HTML

   	<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
		<a-row :gutter="24">
			<a-col :span="6">
				<a-form-item label="创建时间" name="selectTime">
					<a-range-picker v-model:value="searchFormState.selectTime" value-format="YYYY-MM-DD HH:mm:ss" show-time />
				</a-form-item>
			</a-col>

			<a-col :span="6">
				<a-button type="primary" @click="table.refresh(true)">查询</a-button>
				<a-button style="margin: 0 8px" @click="reset">重置</a-button>
			</a-col>
		</a-row>
	</a-form>

JS

        const searchFormParam = JSON.parse(JSON.stringify(searchFormState))
		// selectTime范围查询条件重载
		if (searchFormParam.selectTime) {
			searchFormParam.startDate = searchFormParam.selectTime[0]
			searchFormParam.endDate = searchFormParam.selectTime[1]
			delete searchFormParam.selectTime
		}

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐