如何从QueryDSL Spring引导中提取参数?

发布于 2025-01-31 17:32:19 字数 381 浏览 1 评论 0原文

众所周知,queryDSL可以将和平谓词作为参数,但是如何从此queryDSL中提取参数?因为我必须获得我在邮递员中通过的ID,以便可以使用它。

那是我的控制器:

@GetMapping
    ResponseEntity<Page<MedicalDataDto>> getMedicalData(Pageable pageable, @QuerydslPredicate(root = MedicalData.class) Predicate predicate){
        return ResponseEntity.ok(medicalDataService.getMedicalData(pageable,predicate));
    }

As we know that Querydsl get Peageable and Predicate as parameters but how can I extract the params from this querydsl? because I must get the Id that I passed in postman so that I can use it.

That's my controller :

@GetMapping
    ResponseEntity<Page<MedicalDataDto>> getMedicalData(Pageable pageable, @QuerydslPredicate(root = MedicalData.class) Predicate predicate){
        return ResponseEntity.ok(medicalDataService.getMedicalData(pageable,predicate));
    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

零度℉ 2025-02-07 17:32:19

使用类com.querydsl.core.types.predicateoperation(在一个以上的查询条件下)

使用类com.querydsl.core.core.types.dsl.booleanoperation(在单个查询条件的情况)。

在这里是类似的问题。

use class com.querydsl.core.types.PredicateOperation (in case of more than one query conditions)

use class com.querydsl.core.types.dsl.BooleanOperation (in case of single query condition).

here is the similar question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文