@Test @Sql(scripts = { "/sql/clearChartOfAccount.sql", "/sql/insertChartOfAccountData.sql" }) public void testFindById() { ChartOfAccountEntity chartOfAccountEntity = getChartOfAccountEntity(); ChartOfAccountEntity actualResult =chartOfAccountJdbcRepository.findById(chartOfAccountEntity); List<Map<String, Object>> result = namedParameterJdbcTemplate.query("SELECT * FROM egf_chartofaccount", new ChartOfAccountResultExtractor()); assertThat(result.get(0).get("id")).isEqualTo("2"); assertThat(result.get(0).get("name")).isEqualTo("name"); assertThat(result.get(0).get("glcode")).isEqualTo("glcode"); }
public ChartOfAccountEntity findById(ChartOfAccountEntity 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<ChartOfAccountEntity> chartofaccounts = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountEntity.class)); if (chartofaccounts.isEmpty()) { return null; } else { return chartofaccounts.get(0); } }
ChartOfAccountJdbcRepository extends JdbcRepository { public ChartOfAccountEntity findById(ChartOfAccountEntity 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<ChartOfAccountEntity> chartofaccounts = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountEntity.class)); if (chartofaccounts.isEmpty()) { return null; } else { return chartofaccounts.get(0); } } }
ChartOfAccountJdbcRepository extends JdbcRepository { public ChartOfAccountEntity findById(ChartOfAccountEntity 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<ChartOfAccountEntity> chartofaccounts = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountEntity.class)); if (chartofaccounts.isEmpty()) { return null; } else { return chartofaccounts.get(0); } } ChartOfAccountJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate,
            ChartOfAccountDetailJdbcRepository chartOfAccountDetailJdbcRepository); }
ChartOfAccountJdbcRepository extends JdbcRepository { public ChartOfAccountEntity findById(ChartOfAccountEntity 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<ChartOfAccountEntity> chartofaccounts = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountEntity.class)); if (chartofaccounts.isEmpty()) { return null; } else { return chartofaccounts.get(0); } } ChartOfAccountJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate,
            ChartOfAccountDetailJdbcRepository chartOfAccountDetailJdbcRepository); ChartOfAccountEntity create(ChartOfAccountEntity entity); ChartOfAccountEntity update(ChartOfAccountEntity entity); Pagination<ChartOfAccount> search(ChartOfAccountSearch domain); ChartOfAccountEntity findById(ChartOfAccountEntity entity); }
ChartOfAccountJdbcRepository extends JdbcRepository { public ChartOfAccountEntity findById(ChartOfAccountEntity 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<ChartOfAccountEntity> chartofaccounts = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountEntity.class)); if (chartofaccounts.isEmpty()) { return null; } else { return chartofaccounts.get(0); } } ChartOfAccountJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate,
            ChartOfAccountDetailJdbcRepository chartOfAccountDetailJdbcRepository); ChartOfAccountEntity create(ChartOfAccountEntity entity); ChartOfAccountEntity update(ChartOfAccountEntity entity); Pagination<ChartOfAccount> search(ChartOfAccountSearch domain); ChartOfAccountEntity findById(ChartOfAccountEntity entity);  }