springboot的mybatis使用CONCAT模糊查询

springboot的mybatis使用CONCAT模糊查询

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

<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>

相关推荐

  1. springbootmybatis使用CONCAT模糊查询

    2024-07-13 13:32:05       20 阅读
  2. mybatis 模糊查询几种方式

    2024-07-13 13:32:05       25 阅读
  3. SpringBoot使用mybatis-plus分页查询无效解决方案

    2024-07-13 13:32:05       65 阅读
  4. mybatis多字段模糊查询

    2024-07-13 13:32:05       57 阅读
  5. sql编程——join,concat,except,union all使用举例。

    2024-07-13 13:32:05       44 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-13 13:32:05       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-13 13:32:05       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-13 13:32:05       58 阅读
  4. Python语言-面向对象

    2024-07-13 13:32:05       69 阅读

热门阅读

  1. std::filesystem::current_path().generic_string()的bug

    2024-07-13 13:32:05       23 阅读
  2. 【Android】在渲染生效前提前测量View大小

    2024-07-13 13:32:05       22 阅读
  3. 基于节点嵌入的链接预测(暂时这样吧)

    2024-07-13 13:32:05       19 阅读
  4. C#中where的约束

    2024-07-13 13:32:05       22 阅读
  5. ABP框架中的ISoftDelete与软删除

    2024-07-13 13:32:05       25 阅读
  6. 三级_网络技术_13_局域网技术基础及应用

    2024-07-13 13:32:05       23 阅读
  7. 服务器数据出现丢失该怎样恢复?

    2024-07-13 13:32:05       17 阅读