iBatis怎的比较时间大小?数据库里格式为String
iBatis怎样比较时间大小?数据库里格式为String
----------------------------------------
部分报错代码
这是我的代码 用name可以查询 但是如果用时间查询就报错 我用sql语句去mysql查询却可以直接查出数据,为什么在ibatis下不行? 或者是String不能比较大小?那什么我去mysql能查到数据呢?
<select id="queryPerByName" parameterClass="Personnel" resultClass="Personnel" >
select * from cms_personnel
<dynamic prepend="where">
<isNotEmpty prepend="and" property="name" >
name=#name#
</isNotEmpty>
<isNotEmpty prepend="and" property="s_time" >
<![CDATA[ s_time > '#s_time#' ]]>
</isNotEmpty>
<isNotEmpty prepend="and" property="e_time" >
<![CDATA[ e_time < '#e_time#' ]]>
</isNotEmpty>
</dynamic>
</select>
----------------------------------------
部分报错代码
DEBUG http-8080-5 - {conn-100054} Preparing Statement: select * from cms_personnel where s_time > "?"
DEBUG http-8080-5 - Fetching JDBC Connection from DataSource
DEBUG http-8080-5 - Returning JDBC Connection to DataSource
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the sum_queryPerByName-InlineParameterMap.
--- Check the parameter mapping for the 's_time' property.
--- Cause: java.sql.SQLException: No parameters defined during prepareCall()
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForObject(MappedStatement.java:120)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:518)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:493)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForObject(SqlMapClientImpl.java:82)
at com.base.dao.BaseDao.queryforlist(BaseDao.java:198)
这是我的代码 用name可以查询 但是如果用时间查询就报错 我用sql语句去mysql查询却可以直接查出数据,为什么在ibatis下不行? 或者是String不能比较大小?那什么我去mysql能查到数据呢?