mybatis动态sql在and条件中嵌套or条件的写法。
来源:互联网 发布:北外网络教育登录 编辑:程序博客网 时间:2024/05/16 02:05
sql如下:
select * FROM T_CORRECT_END t
INNER JOIN GET_CHILD_DEPT(579) a
on t.DEPT_PK=a.PK_ID
WHERE t.DR = 0 AND a.DR = 0 AND t.VSTATUS >= 1
and (t.XM like '%张%' or t.ZJHM = '张' or
t.MOBILE_PHONE = '张' )
order by a.PK_ID asc
;
mapper.xml配置文件如下:
<select id="CorrectEnd_ListVO" resultMap="CorrectionEndVOMap"
parameterType="java.util.Map">
select
*
FROM T_CORRECT_END t
INNER JOIN GET_CHILD_DEPT(#{deptPk}) a
on t.DEPT_PK=a.PK_ID
<where>
<trim prefixOverrides="and">
t.DR=0 and a.DR=0 and t.VSTATUS>=1
<!-- 查询全部 -->
<if test="searchText != null and searchText != ''">
and (t.XM like '%${searchText}%' or t.ZJHM = #{searchText} or
t.MOBILE_PHONE = #{searchText})
</if>
<if test="xm != null and xm != ''">and t.XM like '%${xm}%'</if>
<!-- 证件号码: -->
<if test="zjhm != null and zjhm != ''">and t.ZJHM = #{zjhm} </if>
<!-- 手机号码: -->
<if test="mobilePhone != null and mobilePhone != ''">and t.MOBILE_PHONE = #{mobilePhone} </if>
</trim>
</where>
order by a.pk_id asc
</select>
- mybatis动态sql在and条件中嵌套or条件的写法。
- Mybatis动态sql条件查询中if判断Integer的条件写法
- Mybatis中动态sql(多条件查询)
- mybatis 拼装 and和or 查询条件
- MyBatis中动态SQL语句完成多条件查询
- mybatis中SQL块使用/动态条件查询
- MyBatis中动态SQL语句完成多条件查询
- SQL: where条件中AND、OR运算符的组合使用
- sql: where条件中AND、OR运算符的组合使用
- mybatis的动态条件查询
- Mybatis的动态拼接条件
- Mybatis的动态拼接条件
- mybatis的多条件查询案例(动态sql)
- mybatis 动态sql 根据条件执行相应的语句
- queryDataSet中多条件过滤数据集的sql写法
- ibatis里面sql语句中条件使用like的写法
- Mybatis动态SQL 条件查询,批量删除
- mybatis分页条件查询动态sql
- h264格式解析
- CUMT 1031 Order
- codevs 1080~1082 线段树练习系列(模板)
- 商业贷款增长促进了银行盈利
- springMVC实现文件上传
- mybatis动态sql在and条件中嵌套or条件的写法。
- MVC常见问题小总结
- 排序算法(六) 选择排序
- 好了,被百度地图的配置坑了一中午,做个总结吧
- 运用循环输出一个空心的菱形
- 事件(三)
- Android闪光灯实现
- poj2367(拓扑排序)
- 归并排序