@Test @Sql(scripts = { "/sql/clearAccountCodePurpose.sql", "/sql/insertAccountCodePurposeData.sql" }) public void test_find_by_id() { AccountCodePurposeEntity accountCodePurposeEntity = AccountCodePurposeEntity.builder().id("1").build(); accountCodePurposeEntity.setTenantId("default"); AccountCodePurposeEntity result = accountCodePurposeJdbcRepository.findById(accountCodePurposeEntity); assertThat(result.getId()).isEqualTo("1"); assertThat(result.getName()).isEqualTo("name"); }
public AccountCodePurposeEntity findById(AccountCodePurposeEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) { paramValues.put(s, getValue(getField(entity, s), entity)); } List<AccountCodePurposeEntity> accountcodepurposes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(AccountCodePurposeEntity.class)); if (accountcodepurposes.isEmpty()) { return null; } else { return accountcodepurposes.get(0); } }
AccountCodePurposeJdbcRepository extends JdbcRepository { public AccountCodePurposeEntity findById(AccountCodePurposeEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) { paramValues.put(s, getValue(getField(entity, s), entity)); } List<AccountCodePurposeEntity> accountcodepurposes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(AccountCodePurposeEntity.class)); if (accountcodepurposes.isEmpty()) { return null; } else { return accountcodepurposes.get(0); } } }
AccountCodePurposeJdbcRepository extends JdbcRepository { public AccountCodePurposeEntity findById(AccountCodePurposeEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) { paramValues.put(s, getValue(getField(entity, s), entity)); } List<AccountCodePurposeEntity> accountcodepurposes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(AccountCodePurposeEntity.class)); if (accountcodepurposes.isEmpty()) { return null; } else { return accountcodepurposes.get(0); } } AccountCodePurposeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); }
AccountCodePurposeJdbcRepository extends JdbcRepository { public AccountCodePurposeEntity findById(AccountCodePurposeEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) { paramValues.put(s, getValue(getField(entity, s), entity)); } List<AccountCodePurposeEntity> accountcodepurposes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(AccountCodePurposeEntity.class)); if (accountcodepurposes.isEmpty()) { return null; } else { return accountcodepurposes.get(0); } } AccountCodePurposeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); AccountCodePurposeEntity create(AccountCodePurposeEntity entity); AccountCodePurposeEntity update(AccountCodePurposeEntity entity); Pagination<AccountCodePurpose> search(AccountCodePurposeSearch domain); AccountCodePurposeEntity findById(AccountCodePurposeEntity entity); Boolean uniqueCheck(String fieldName, AccountCodePurposeEntity accountCodePurpose); }
AccountCodePurposeJdbcRepository extends JdbcRepository { public AccountCodePurposeEntity findById(AccountCodePurposeEntity entity) { List<String> list = allIdentitiferFields.get(entity.getClass().getSimpleName()); Map<String, Object> paramValues = new HashMap<>(); for (String s : list) { paramValues.put(s, getValue(getField(entity, s), entity)); } List<AccountCodePurposeEntity> accountcodepurposes = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(AccountCodePurposeEntity.class)); if (accountcodepurposes.isEmpty()) { return null; } else { return accountcodepurposes.get(0); } } AccountCodePurposeJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate); AccountCodePurposeEntity create(AccountCodePurposeEntity entity); AccountCodePurposeEntity update(AccountCodePurposeEntity entity); Pagination<AccountCodePurpose> search(AccountCodePurposeSearch domain); AccountCodePurposeEntity findById(AccountCodePurposeEntity entity); Boolean uniqueCheck(String fieldName, AccountCodePurposeEntity accountCodePurpose);  }