up
This commit is contained in:
@@ -47,12 +47,20 @@
|
|||||||
|
|
||||||
<!-- 如果传入name参数,且不为空 -->
|
<!-- 如果传入name参数,且不为空 -->
|
||||||
<if test="name != null and name != ''">
|
<if test="name != null and name != ''">
|
||||||
AND pt.name LIKE CONCAT( '%', #{name}, '%')
|
<choose>
|
||||||
</if>
|
<!-- 如果name参数中包含汉字 -->
|
||||||
|
<when test="name.matches('.*[\u4e00-\u9fa5].*')">
|
||||||
<!-- 如果传入name参数,且不为空 -->
|
AND pt.name LIKE CONCAT('%', #{name}, '%')
|
||||||
<if test="name != null and name != ''">
|
</when>
|
||||||
AND pt.py_str LIKE CONCAT('%',#{name}, '%')
|
<!-- 如果name参数中只包含字母 -->
|
||||||
|
<when test="name.matches('^[a-zA-Z]+$')">
|
||||||
|
AND pt.py_str LIKE CONCAT('%', #{name}, '%')
|
||||||
|
</when>
|
||||||
|
<!-- 如果name参数中既包含汉字又包含字母 -->
|
||||||
|
<otherwise>
|
||||||
|
AND (pt.name LIKE CONCAT('%', #{name}, '%') OR pt.py_str LIKE CONCAT('%', #{name}, '%'))
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
ORDER BY pt.bus_no
|
ORDER BY pt.bus_no
|
||||||
@@ -72,11 +80,20 @@
|
|||||||
|
|
||||||
<!-- 如果传入name参数,且不为空 -->
|
<!-- 如果传入name参数,且不为空 -->
|
||||||
<if test="name != null and name != ''">
|
<if test="name != null and name != ''">
|
||||||
AND pt.name LIKE CONCAT('%',#{name}, '%')
|
<choose>
|
||||||
</if>
|
<!-- 如果name参数中包含汉字 -->
|
||||||
<!-- 如果传入name参数,且不为空 -->
|
<when test="name.matches('.*[\u4e00-\u9fa5].*')">
|
||||||
<if test="name != null and name != ''">
|
AND pt.name LIKE CONCAT('%', #{name}, '%')
|
||||||
AND pt.py_str LIKE CONCAT('%',#{name}, '%')
|
</when>
|
||||||
|
<!-- 如果name参数中只包含字母 -->
|
||||||
|
<when test="name.matches('^[a-zA-Z]+$')">
|
||||||
|
AND pt.py_str LIKE CONCAT('%', #{name}, '%')
|
||||||
|
</when>
|
||||||
|
<!-- 如果name参数中既包含汉字又包含字母 -->
|
||||||
|
<otherwise>
|
||||||
|
AND (pt.name LIKE CONCAT('%', #{name}, '%') OR pt.py_str LIKE CONCAT('%', #{name}, '%'))
|
||||||
|
</otherwise>
|
||||||
|
</choose>
|
||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
Reference in New Issue
Block a user