Only in the use of the summary of the process, I am still in constant practice ...
A helpful information about MyBatis website: http://www.mybatis.tk/
Use of multiple parameters
MyBatis query or UPDATE, if you need more than one parameter: object mapping, the creation of a Java object, and as an interface parameter, the object's properties can be directly accessed using the #{property name} ; map, the parameter is a map, key for the property name , value for the parameter value, this method is to pass parameter is required to establish a map temporary object @param parameter annotations, before the interface method parameters to add parameter name annotation, so that you can directly in the mapper through the parameter name access through the ordinal access, the first parameter #{0} or #{ PARAM1}, second parameter #{1}, #{param2}
Use of Time fields in MyBatis – return
Return of the Time field the author now uses the way to put back the string:
Date_format (Update_time, '%y-%c-%d%h:%i:%s ') updatetime
Use the MySQL time format method.
Or put back the data of the timestamp type, requiring that the object property parameter be put back to timestamp.
Use of Time fields in MyBatis-parameters
If you need to query data for a time range, you can query the data by using the following dynamic SQL:
<if test= "StartTime! = null" > and
lbr.update_time > #{starttime}
</if>
<if test= " EndTime! = null ">
and Lbr.update_time < #{endtime, Javatype=date, jdbctype=timestamp}
</if>
The interface method names for are as follows:
... Date startTime, Date endTime ...
I think this method will be more efficient than a format conversion.
4. Use of Time fields in MyBatis-write
Writes are written directly to the timestamp data, and some written jdbctype need to be described, as follows:
#{installtime, Jdbctype=timestamp}
Continue to update in ...