mybatis-字符串判断
来源:互联网 发布:vscode 代码提示 编辑:程序博客网 时间:2024/06/05 07:20
<select id="pageQueryAu"
parameterType="com.test.vo.PubParams"
resultMap="auVoResult">
SELECT
a.au_id, a.au_name_cn, l.language, a.release_company,
p.publisher_id, p.publisher_cn,
<choose>
<when test="codeType == '2'.toString()">
a.i_status as mpr_status,
2 as code_type,
</when>
<otherwise>
a.m_status,
1 as code_type,
</otherwise>
</choose>
a.create_time apply_code_time, a.app_time send_code_time
FROM
t_au a
INNER JOIN
t_pub p ON a.publisher_id = p.publisher_id
LEFT JOIN
t_lang l ON a.language = l.lang_id
WHERE
p.group_id = #{groupId}
<if test="publicationName != null and publicationName != ''">
AND LOWER(a.audio_name_cn) LIKE '%' || LOWER(TRIM(#{publicationName})) || '%'
</if>
<if test="publisherCn != null and publisherCn != ''">
AND LOWER(p.publisher_cn) LIKE '%' || LOWER(TRIM(#{publisherCn})) || '%'
</if>
<if test="status != null and status != '' and codeType == '2'.toString()">
AND a.i_status = #{status}
</if>
<if test="status != null and status != '' and codeType == '1'.toString()">
AND a.m_status = #{status}
</if>
<!--
某个隐藏的SQL会将这个code_type的值由2改成了1,因此不用这个字段判断
<if test="codeType != null and codeType != ''">
AND a.code_type = #{codeType}
</if>
-->
<if test="codeType == '2'.toString()">
AND a.i_status is not null
</if>
<if test="codeType == '1'.toString()">
AND a.m_status is not null
</if>
ORDER BY
<choose>
<when test="order != null and order != ''">
${order} ${sort}
</when>
<otherwise>
a.create_time DESC
</otherwise>
</choose>
limit #{rows} offset (#{page} - 1) * #{rows}
parameterType="com.test.vo.PubParams"
resultMap="auVoResult">
SELECT
a.au_id, a.au_name_cn, l.language, a.release_company,
p.publisher_id, p.publisher_cn,
<choose>
<when test="codeType == '2'.toString()">
a.i_status as mpr_status,
2 as code_type,
</when>
<otherwise>
a.m_status,
1 as code_type,
</otherwise>
</choose>
a.create_time apply_code_time, a.app_time send_code_time
FROM
t_au a
INNER JOIN
t_pub p ON a.publisher_id = p.publisher_id
LEFT JOIN
t_lang l ON a.language = l.lang_id
WHERE
p.group_id = #{groupId}
<if test="publicationName != null and publicationName != ''">
AND LOWER(a.audio_name_cn) LIKE '%' || LOWER(TRIM(#{publicationName})) || '%'
</if>
<if test="publisherCn != null and publisherCn != ''">
AND LOWER(p.publisher_cn) LIKE '%' || LOWER(TRIM(#{publisherCn})) || '%'
</if>
<if test="status != null and status != '' and codeType == '2'.toString()">
AND a.i_status = #{status}
</if>
<if test="status != null and status != '' and codeType == '1'.toString()">
AND a.m_status = #{status}
</if>
<!--
某个隐藏的SQL会将这个code_type的值由2改成了1,因此不用这个字段判断
<if test="codeType != null and codeType != ''">
AND a.code_type = #{codeType}
</if>
-->
<if test="codeType == '2'.toString()">
AND a.i_status is not null
</if>
<if test="codeType == '1'.toString()">
AND a.m_status is not null
</if>
ORDER BY
<choose>
<when test="order != null and order != ''">
${order} ${sort}
</when>
<otherwise>
a.create_time DESC
</otherwise>
</choose>
limit #{rows} offset (#{page} - 1) * #{rows}
</select>
<resultMap id="auVoResult"
type="com.test.vo.AuVo"
extends="baseVoRsult">
<id property="auId" column="au_id" />
<result property="auNameCn" column="au_name_cn" />
<result property="language" column="language" />
<result property="releaseCompany" column="release_company" />
</resultMap>
0 0
- mybatis-字符串判断
- Mybatis if 判断字符串
- mybatis中判断字符串
- mybatis if字符串相等判断。。
- mybatis 判断字符串是否相等
- MyBatis if test 字符串判断问题
- 关于mybatis传递string字符串判断
- MyBatis if test 字符串判断问题
- mybatis 在if 里判断字符串
- mybatis中if标签判断字符串相等
- mybatis if标签判断字符串相等
- mybatis 用if标签判断字符串相等
- mybatis if test 字符串判断问题
- mybatis在映射文件里面判断字符串注意事项
- mybatis sqlmapper test 判断非字符串类型的值
- Mybatis中 if test 判断数值字符串注意项
- mybatis if条件判断字符串类型是否一致
- mybatis if判断int类型的查询条件如何判断空和空字符串
- 数据结构实验之链表六:有序链表的建立
- Class.getResource与Class.getClassLoader.getResource
- 数据结构实验之二叉树二:遍历二叉树
- 数据结构实验之二叉树二:遍历二叉树
- 自定义ImageView实现切图的无缝对接
- mybatis-字符串判断
- JAVA帮助文档全系列 JDK1.5 JDK1.6 JDK1.7 官方中英完整版下载
- 数据结构实验之二叉树的建立与遍历
- 数据结构实验之二叉树的建立与遍历
- Hibernate框架关系映射
- 数据结构实验之二叉树三:统计叶子数
- 数据结构实验之二叉树三:统计叶子数
- fop's font
- 1.1机器学习基础-python深度机器学习