如何實現模糊查詢時間段

平定馬小跳發表於2020-12-03

前臺框架:

請選擇時間範圍:

layui.use(['layer','laydate'], function(){
var layer = layui.layer;
var laydate = layui.laydate;
laydate.render({
elem: '#keywords',
type: 'datetime',
range: true
});
});
如何資料傳入後臺
public PageTableResponse ListNew2(PageTableRequest strCon) {
PublicWhere where = new PublicWhere(strCon);
String key[] = new String[50];
if(!where.getKeywords().isEmpty()) {
String keywords = where.getKeywords();
StringBuilder year = new StringBuilder(keywords);
year.replace(20,21,"~");
String s = year.toString();
key = s.split("~",2);
where.setKeywords(key[0]);
where.setKeywords1(key[1]);
}
將值傳入後臺通過sql查詢



and t.annsetwarryanty_begintime >= #{keywords} and t.annsetwarryanty_endtime <= #{keywords1}



and t.status in

#{item}



and t.status != #{notStatus}



相關文章