Mybatis 一个搜索框对多个字段进行模糊查询
2023-09-14 09:03:40 时间
<select id="list" parameterType="ParamConfigCondition" resultType="ParamConfig">
SELECT
a.PARAM_CODE,
a.VALUE_CODE,
a.`NAME`,
a.IS_READ_ONLY,
a.DESCR
FROM
TPT_PARAM_CONFIG a
WHERE
1 = 1
<if test="paramCode != null and paramCode != ''">
AND a.PARAM_CODE = #{paramCode}
</if>
<if test="searchParam != null and searchParam != ''">
AND CONCAT(`VALUE_CODE`, `NAME`) LIKE CONCAT('%',#{searchParam},'%')
</if>
</select>
注:CONCAT(VALUE_CODE
, NAME
) 其中字段如果是关键字是要用”`”来引起来的,不然会报错!
相关文章
- Java实现LeetCode 839. 相似字符串组 (深度优先搜索,并查集,图)
- 第八十八节,html5+css3pc端固定布局,搜索区,插入大图,搜索框
- Lintcode---二叉查找树中搜索区间
- LIntcode---将二叉搜索树转成较大的树
- django中实现组合搜索
- LeetCode(108):将有序数组转换为二叉搜索树
- CRM的business partner和employee在后台的搜索
- 具有SmartFilterBar 的 SAP Fiori Elements 自动触发的搜索操作
- HDU 5305 Friends (搜索+剪枝) 2015多校联合第二场
- Leetcode 81. 搜索旋转排序数组 II
- 搜索引擎——用户搜索意图的理解及其难点解析,本质是利用机器学习用户的意图分类