flex ibatis java 通过sql语句进行多条件模糊查询。
2012-12-19 20:01
856 查看
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.rainmon.pm.sqlmapper.SQLMoUserSetManager" >
<insert id="insertInspectLog" parameterType="com.rainmon.pm.model.PojoMoUserSetAction">
<select id="searchLog" parameterType="com.rainmon.pm.model.PojoMoUserSetAction" resultType="HashMap">
select * from inspectLog
where userNum > 1
<if test="userCode != null and userCode != 0">
and userNum like #{userCode}
</if>
<if test="ip != null and ip!=''">
and ip like #{ip}
</if>
<if test="beforelogintime != null and beforelogintime != ''">
and startTime < = #{beforelogintime}
</if>
<if test="laterlogintime != null and beforelogintime != ''">
and startTime > = #{laterlogintime}
</if>
<if test="today != null and today != ''">
and convert(varchar,starttime,23) like #{today}
</if>
<if test="betweenSmallTime != null and betweenSmallTime != ''">
and startTime >= #{betweenSmallTime}
</if>
<if test="betweenBigTime != null and betweenBigTime != ''">
and startTime <= #{betweenBigTime}
</if>
</select>
</mapper>
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.rainmon.pm.sqlmapper.SQLMoUserSetManager" >
<insert id="insertInspectLog" parameterType="com.rainmon.pm.model.PojoMoUserSetAction">
<select id="searchLog" parameterType="com.rainmon.pm.model.PojoMoUserSetAction" resultType="HashMap">
select * from inspectLog
where userNum > 1
<if test="userCode != null and userCode != 0">
and userNum like #{userCode}
</if>
<if test="ip != null and ip!=''">
and ip like #{ip}
</if>
<if test="beforelogintime != null and beforelogintime != ''">
and startTime < = #{beforelogintime}
</if>
<if test="laterlogintime != null and beforelogintime != ''">
and startTime > = #{laterlogintime}
</if>
<if test="today != null and today != ''">
and convert(varchar,starttime,23) like #{today}
</if>
<if test="betweenSmallTime != null and betweenSmallTime != ''">
and startTime >= #{betweenSmallTime}
</if>
<if test="betweenBigTime != null and betweenBigTime != ''">
and startTime <= #{betweenBigTime}
</if>
</select>
</mapper>
相关文章推荐
- 如何进行ibatis动态多条件组合查询以及模糊查询
- ibatis动态多条件查询及模糊查询(oracle,mysql,sql)
- 实现多条件模糊查询SQL语句
- 如何进行ibatis动态多条件组合查询以及模糊查询
- java加mysql按时间条件查询sql语句
- hibernate根据条件动态组装sql/hql语句(仿ibatis动态查询语句功能)
- 当只有一个输入条件的时匹配数据库表中多个字段模糊查询的SQL语句
- 在使用ibatis实现多条件模糊查询的语句
- java中根据是否输入日期进行动态查询的sql查询语句
- asp下实现多条件模糊查询SQL语句
- 如何进行ibatis动态多条件组合查询以及模糊查询(oracle,mysql)
- 实现多条件模糊查询SQL语句
- ASPNETCOREAPI 跨域处理 SQL 语句拼接 多条件分页查询 ASPNET CORE 核心 通过依赖注入(注入服务)
- ibatis动态多条件查询及模糊查询(oracle,mysql,sql)
- 在使用ibatis实现多条件模糊查询的语句
- SQL语句--查询结果作为条件与另一张表进行条件查询
- ibatis动态多条件查询及模糊查询(oracle,mysql,sql)
- 用sql语句,将两个字段合并,并当做条件进行查询的方法
- java加mysql按时间条件查询sql语句
- asp下实现多条件模糊查询SQL语句