mybatis实现类似于全文检索的功能

mybatis实现类似于全文检索的功能

代码:

select 
                   distinct tsc.*,  
        from 
              t_standard_care tsc 
              left join t_care_file tcf on tsc.id=tcf.careId 
        
            
                (standNum like "%"#{checkThings}"%" or chinaName like "%"#{checkThings}"%" or 
                 state like "%"#{checkThings}"%" or issueDate like "%"#{checkThings}"%" or 
                 measureDate like "%"#{checkThings}"%"  
                )
            

注释:这一种写法可以实现类似于全文检索的功能,但是查询的速度、结果的重复性都较高,并且只有少量的字段 时这么用才可以

如果需要的匹配的字段 较多且数据量上千万的时候,非常不建议采用这一种方式。还是做全文检索的比较好。

 

你可能感兴趣的:(数据库-随笔)