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}",
整个语句也写下吧
设置某字段为当前时间,修改日期类型为timestamp并允许空,如下:create
table
`test`
(`aaaa`
varchar(50)
not
null,`createday`
timestamp
null
default
current_timestamp
on
update
current_timestamp)
engine=innodb
default
charset=utf8
如果是在navicat下 *** 作的话,设置字段的类型为timestamp,默认值写上
current_timestamp.
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)