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}",
整个语句也写下吧
MySQL中导入exsal日期时用char不用date因为excel中的日期格式可能存在不规范或者说不标准的情况,如果用date类型来存储就可能出错,而按字符串来存储就没事。当然,这样的日期数据是无法直接进行与日期时间相关的运算和比较的,必须在应用层面进行转换。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)