date_format(t1.record_time, '%H:%i:%s')
SELECT t2.class_name,t1.class_no,t1.course_id,t1.course_name,t1.id,t1.pic_url,t1.record_time,t1.sign_day,t1.status,t1.student_name,t1.student_no FROM t_e_sign t1 LEFT JOIN t_e_sys_org t2 ON t2.org_code = t1.class_no WHERE IF (:studentName is not null, t1.student_name LIKE CONCAT('%',:studentName,'%') , 1 = 1) and IF (:className is not null, t2.class_name LIKE CONCAT('%',:className,'%') , 1 = 1) and IF (:startTime is not null, date_format(t1.record_time, '%Y-%m-%d') >=:startTime , 1 = 1) and IF (:endTime is not null, date_format(t1.record_time, '%Y-%m-%d') <=:endTime , 1 = 1) and IF (:startdetailTime is not null, date_format(t1.record_time, '%H:%i:%s') >=:startdetailTime , 1 = 1) and IF (:enddetailTime is not null, date_format(t1.record_time, '%H:%i:%s') <=:enddetailTime , 1 = 1) ORDER BY ?#{#pageable}",
整个语句也写下吧
两个函数: 你想按照时间段查询,那么将你的时间段(字符串格式)转换成int型(也就是timestamp),与你数据库里的时间字段进行比较。 或者将你数据库里的字段转换成字符串格式然后进行比较。 使用到的函数分别为unix_timestamp和from_unixtime。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)