代码之家  ›  专栏  ›  技术社区  ›  Luke101

如何将参数传递到spring数据存储库

  •  0
  • Luke101  · 技术社区  · 7 年前

        public interface AppRepository extends MongoRepository<App, String> {
        List<App> findAppsByUserAndIsDraft(String user, false);
    }
    

    我需要按用户名和IsDraft查找所有记录。正如你所看到的,我正在通过一个 false 对于IsDraft。这不起作用,因为spring给出了这个错误 identifyer or type expected . 有办法吗?

    1 回复  |  直到 7 年前
        1
  •  1
  •   Vipul Pandey    7 年前

    列出findAppsByUserAndIsDraft(字符串user,false); 将方法更改为 列出findAppsByUserAndIsDraftFalse(字符串用户);