springboot的mybatis使用CONCAT模糊查询

springboot的mybatis使用CONCAT模糊查询

在mysql中like 可以直接使用字符串拼接,在xml中需要使用CONCAT来连接变量。

xml 复制代码
<mapper namespace="com.geofly.ynygzx.iscp.api.mapper.AppUpdateRecordMapper">
    <select id="getList" resultType="com.geofly.ynygzx.iscp.api.entity.AppUpdateRecord">
        select * from app_update_record where 1 = 1
        <if test="params.status != null and params.status != ''">
            and status = #{params.status}
        </if>
        <if test="params.version != null and params.version != ''">
            and version like CONCAT('%', #{params.version}, '%')
        </if>
        ORDER BY version desc, create_time desc
    </select>
</mapper>
相关推荐
橙子家24 分钟前
参数校验类异常(Argument Exception)【C# Exception 详解系列一】
后端
掘金挖土42 分钟前
前端手摸手跑路之 AI 应用开发(九)
前端·后端
全栈弄潮儿1 小时前
Python实战第8期:函数
后端·python·编程语言
码事漫谈1 小时前
你让 AI “尽力做”,它反而可能做不好
后端
孟健2 小时前
LLM API 安全防线:从 OpenCode 盗刷事件到 LiteLLM 多模型容灾实操
人工智能·后端·架构
程序员cxuan2 小时前
我用 WorkBuddy + ima 把公众号文章做成了知识库。
人工智能·后端·程序员
程序员cxuan3 小时前
玩了一天 REA,我号快没了
人工智能·后端·程序员
卷无止境3 小时前
暗流与破局:AI时代的代码安全审查工具全景指南
后端·python
smallyoung3 小时前
告别N+1:Spring Boot 一键数据翻译框架体系
java·后端·架构