Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[功能改进]: 条件构造器支持传入另一个 QueryWrapper 作为条件值 #6353

Open
rui8832 opened this issue Jul 23, 2024 · 0 comments

Comments

@rui8832
Copy link

rui8832 commented Jul 23, 2024

当前程序版本

v3.5.7

功能改进

当前查询条件:

    // 查询条件:联系人
    if (StringUtils.isNotEmpty(req.getContactName())
        && !SqlInjectionUtils.check(req.getContactName())) {
      // 阿弥陀佛,罪过罪过
      String sql_contact =
          String.format(
              "SELECT clue_id FROM cl_clue_contact WHERE `name` LIKE '%%%s%%'",
              req.getContactName());
      lqwr.inSql(ClClueInfoEntity::getId, sql_contact);
    }

期望查询条件:

    // 查询条件:联系人
    if (StringUtils.isNotEmpty(req.getContactName())) {
      LambdaQueryWrapper<ClClueContactEntity> lqwr_contact = new LambdaQueryWrapper<>();
      lqwr_contact.select(ClClueContactEntity::getClueId);
      lqwr_contact.like(ClClueContactEntity::getName, "%" + req.getContactName() + "%");
      lqwr.inSql(ClClueInfoEntity::getId, lqwr_contact);
    }

参考资料

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant