BraveXaiver
V2EX  ›  问与答

请问 SpringJPA 有类似于接收 QuerryWrapper (mybatis-plus) 的那种写法吗?

  •  
  •   BraveXaiver · Mar 9, 2024 · 1345 views
    This topic created in 829 days ago, the information mentioned may be changed or developed.
    RT ,在考虑升级到使用 spring boot 3 ,但目前好像 mybatis plus 仍然不支持,有点落后了。不得不考虑 Spring JPA 。

    但我对 Spring JPA 的印象还停留在把 SQL 写在方法名中。那如果需求一多,可能方法就暴增。

    我还是期待能有类似于 mybatis plus 那样接收 QuerryWrapper 参数,然后 QueryWrapper 的参数构造的时候就像在写 SQL 语句,mybatis plus 根据这个参数拼出 SQL 的 Java 数据层库。

    Spring JPA 能做吗?不能的话有支持了 spring boot 3 的能做到的库吗?

    谢谢!
    5 replies    2024-03-10 09:35:22 +08:00
    cookii
        1
    cookii  
       Mar 10, 2024 via Android
    支持的
    cookii
        2
    cookii  
       Mar 10, 2024 via Android
    mybatis-plus 支持 springboot3
    xianzhe
        3
    xianzhe  
       Mar 10, 2024 via Android
    querydsl
    09an6YfX8rNvIG92
        4
    09an6YfX8rNvIG92  
       Mar 10, 2024 via Android
    直接用 jpql ,也能实现动态参数的查询
    lvye
        5
    lvye  
       Mar 10, 2024 via iPhone   ❤️ 1
    Mybatis Plus 支持 Spring Boot 3 有段时间了

    https://central.sonatype.com/artifact/com.baomidou/mybatis-plus-spring-boot3-starter

    需要用 Spring Boot 3 专门的 starter
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2853 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 14:56 · PVG 22:56 · LAX 07:56 · JFK 10:56
    ♥ Do have faith in what you're doing.