JPA – Java Spring Boot – 查找/连接表

我是Java Spring Boot和JPA的新手。 我有两个表 – 一个是帐户表,网站将管理“TblLogin” – 另一个“TblPatient”将由网站上的第三方数据(非托管)填充。

//查找方法

  1. 所以在这个演示中 – 我有一个用户登录 – 电子邮件,密码 – 我需要先做一个不仅满足“findByEmail”的查找 – 而且还要“findByEmailAndPassword”并在密码值到达之前加密密码值做一个检查。

  2. 在找到acc – it然后获取pin col数据 – 如1345 – 并查看第三方表。 –

– 现在我确信有更复杂的方法 – 甚至可以通过加入? 但我不确定。

TblLogin acc = tblLoginRepository.findByEmail(email); String pin = acc.getPin(); TblPatient ext = tblPatientRepository.findByPatientID(pin); JSONObject response = new JSONObject(); response.put("tblLogin", acc.getEmail()); response.put("tblPatient", ext.getId()); 
  1. 它会是什么样的东西 – “findByEmailContainingAndPasswordContainingAllIgnoringCase(String email,String passwordEncoder.encode(password));” ?

或更像

findByEmailAndPasswordAllIgnoringCase(String email,String passwordEncoder.encode(password)));