借用MySQL函数实现
- long 转 timestamp:FROM_UNIXTIME(long, [format])
示例:限制10位时间戳,13位不可以FROM_UNIXTIME(1249488000)
或FROM_UNIXTIME(1249488000, ‘%Y-%M-%d %H:%m:%s‘)
整合到mybatis leaveTime为long型
<insert id="insertLiveOrder" parameterType="map">
insert into
reserve_record(orderId, uname, phoneNumber, roomType, reserveTime, preFee, status, startTime, endTime)
values (#{orderId}, #{uname}, #{phoneNumber}, #{roomType}, NOW(), #{preFee}, 0,
FROM_UNIXTIME(#{signTime}), FROM_UNIXTIME(#{leaveTime}))
</insert>
- timestamp转long:UNIX_TIMESTAMP
示例:
UNIX_TIMESTAMP(‘2020-07-11‘)