net.sf.jsqlparser.parser.ParseException: Encountered “ “(“ “( ““ at line 5, column 13.

本人是个小白,对mybatis不是特别懂,被这个问题折磨了两三天,及其痛苦,事情发生背景

目的:使用分词后,根据分词后的匹配结果,得到一个匹配度,然后按匹配度排序返回

问题:接口是能得到正确的数据,就是控制台会报错

详情:

mybatis代码:

<!-- 获取列表 -->
    <select id="query" parameterType="java.util.Map" resultType="com.hi.hailiaowenan.affair.bean.LoveWord">
     select id, f_id as fId, f_id_name as fIdName, state, active, content, app_id as appId, is_top as isTop,
     user_id as userId, user_name as userName, avatar, title, image,
     download_init_count as downloadInitCount, collect_init_count as collectInitCount, download_count as downloadCount, 
     collect_count as collectCount,
        <if test="fvs != null and fvs.size > 0 and orderBy != null and orderBy == 'matching_degree DESC'">
           <foreach collection="fvs" open="(" close=")" separator="+" item="item">
               if(LOCATE(#{item},content),1,0)
           </foreach>
           as matching_degree,
       </if>
     create_time as createTime, update_time as updateTime
     from
     <include refid="table_name"></include>
    </select>

解决办法:pom.xml 添加依赖,如下

<!--必须使用0.9以上的版本-->
		<dependency>
		    <groupId>com.github.jsqlparser</groupId>
		    <artifactId>jsqlparser</artifactId>
		    <version>1.4</version>
		</dependency>

猜你喜欢

转载自blog.csdn.net/weixin_40918145/article/details/115347199