时间:2021-07-01 10:21:17 帮助过:23人阅读
正确的写法:在<if>里面增加一对()
SELECT rrc.id, rrc.resource_name rrc.is_publish FROM res_resource_catalog AS rrc <where> <if test="keyWord != null and keyWord != ‘‘"> AND (rrc.resource_name LIKE concat(concat("%",#{keyWord}),"%") OR rrc.resource_abstract LIKE concat(concat("%",#{keyWord}),"%") OR rrc.id IN (SELECT DISTINCT resource_id FROM res_info_item WHERE item_name LIKE concat(concat("%",#{keyWord}),"%"))) </if> AND rrc.is_publish = 1 </where>
mysql根据关键词查询匹配多个字段时结果不正确
标签:tin catalog rom concat col log 增加 resource abstract