ibatis mysql数据库 模糊查询 时间大小比较
2015-04-03 10:53
549 查看
<resultMap id="logResult" class="com.frame.vo.log.LogVo" >
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="operationType" column="operation_type" />
<result property="operationContent" column="operation_content" />
<result property="operationDate" column="operation_date" />
</resultMap>
<!-- getLogForPage查询where条件 -->
<sql id="queryLogWhere">
<dynamic prepend="where">
<isNotEmpty prepend="and" property="id">
t.id=#id#
</isNotEmpty>
<isNotEmpty prepend="and" property="userId">
t.user_id like concat('%',#userId#,'%')
</isNotEmpty>
<isNotEmpty prepend="and" property="operationType">
t.operation_type like concat('%',#operationType#,'%')
</isNotEmpty>
<isNotEmpty prepend="and" property="operationContent">
t.operation_content=#operationContent#
</isNotEmpty>
<isNotEmpty prepend="and" property="logDateStart">
<![CDATA[t.operation_date>=#logDateStart#]]>
</isNotEmpty>
<isNotEmpty prepend="and" property="logDateEnd">
<![CDATA[t.operation_date<=#logDateEnd#]]>
</isNotEmpty>
</dynamic>
order by t.operation_date desc
</sql>
<!-- getLogForPage查询入口 -->
<select id="queryLog" parameterClass="java.util.HashMap" resultMap="logResult">
select id, user_id, operation_type, operation_content, operation_date from t_m_log t
<include refid="queryLogWhere" />
<dynamic prepend="">
<isNotNull property="limitStart">
<isNotNull property="limitSize">
limit #limitStart#, #limitSize#
</isNotNull>
</isNotNull>
</dynamic>
</select>
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="operationType" column="operation_type" />
<result property="operationContent" column="operation_content" />
<result property="operationDate" column="operation_date" />
</resultMap>
<!-- getLogForPage查询where条件 -->
<sql id="queryLogWhere">
<dynamic prepend="where">
<isNotEmpty prepend="and" property="id">
t.id=#id#
</isNotEmpty>
<isNotEmpty prepend="and" property="userId">
t.user_id like concat('%',#userId#,'%')
</isNotEmpty>
<isNotEmpty prepend="and" property="operationType">
t.operation_type like concat('%',#operationType#,'%')
</isNotEmpty>
<isNotEmpty prepend="and" property="operationContent">
t.operation_content=#operationContent#
</isNotEmpty>
<isNotEmpty prepend="and" property="logDateStart">
<![CDATA[t.operation_date>=#logDateStart#]]>
</isNotEmpty>
<isNotEmpty prepend="and" property="logDateEnd">
<![CDATA[t.operation_date<=#logDateEnd#]]>
</isNotEmpty>
</dynamic>
order by t.operation_date desc
</sql>
<!-- getLogForPage查询入口 -->
<select id="queryLog" parameterClass="java.util.HashMap" resultMap="logResult">
select id, user_id, operation_type, operation_content, operation_date from t_m_log t
<include refid="queryLogWhere" />
<dynamic prepend="">
<isNotNull property="limitStart">
<isNotNull property="limitSize">
limit #limitStart#, #limitSize#
</isNotNull>
</isNotNull>
</dynamic>
</select>
相关文章推荐
- C++中 MFC DLL如何连接mysql数据库以及按条件查询和时间的比较
- 比较两个时间的大小
- C#比较两时间大小
- 【转】]ibatis模糊查询,条件控制
- symbian 比较两个时间的大小
- symbian 比较两个时间的大小
- SQL查询语句:关于时间的比较
- C#里面比较时间大小三种方法
- C#里面比较时间大小三种方法
- C#里面比较时间大小三种方法
- C#里面比较时间大小三种方法
- vs.2005 比较时间大小 可精确到秒
- ibatis中使用like模糊查询
- javascript可以直接比较时间字符串的大小
- Sqlserver中时间查询的一个比较快的语句
- ibatis中使用like模糊查询
- 关于时间的模糊查询
- C#比较两时间大小
- C#里面比较时间大小三种方法
- ArrayList 和 HashTable 和 HashSet 和 List 和 Dictionary 之间关于插入查询的时间比较