@Test @Sql(scripts = { "/sql/clearChartOfAccount.sql" }) @Sql(scripts = { "/sql/insertChartOfAccountData.sql" }) @Sql(scripts = { "/sql/clearAccountDetailType.sql" }) @Sql(scripts = { "/sql/insertAccountDetailType.sql" }) @Sql(scripts = { "/sql/clearChartOfAccountDetail.sql", "/sql/insertChartOfAccountDetail.sql" }) public void testFindById() { ChartOfAccountDetailEntity chartOfAccountDetailEntity = getChartOfAccountDetailEntity(); ChartOfAccountDetailEntity actualResult = chartOfAccountDetailJdbcRepository .findById(chartOfAccountDetailEntity); List<Map<String, Object>> result = namedParameterJdbcTemplate.query( "SELECT * FROM egf_chartofaccountdetail", new ChartOfAccountDetailResultExtractor()); assertThat(result.get(0).get("id")).isEqualTo("1"); assertThat(result.get(0).get("chartofaccountid")).isEqualTo("1"); assertThat(result.get(0).get("accountdetailtypeid")).isEqualTo("1"); }
public ChartOfAccountDetailEntity findById(ChartOfAccountDetailEntity 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<ChartOfAccountDetailEntity> chartofaccountdetails = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountDetailEntity.class)); if (chartofaccountdetails.isEmpty()) { return null; } else { return chartofaccountdetails.get(0); } }
ChartOfAccountDetailJdbcRepository extends JdbcRepository { public ChartOfAccountDetailEntity findById(ChartOfAccountDetailEntity 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<ChartOfAccountDetailEntity> chartofaccountdetails = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountDetailEntity.class)); if (chartofaccountdetails.isEmpty()) { return null; } else { return chartofaccountdetails.get(0); } } }
ChartOfAccountDetailJdbcRepository extends JdbcRepository { public ChartOfAccountDetailEntity findById(ChartOfAccountDetailEntity 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<ChartOfAccountDetailEntity> chartofaccountdetails = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountDetailEntity.class)); if (chartofaccountdetails.isEmpty()) { return null; } else { return chartofaccountdetails.get(0); } } ChartOfAccountDetailJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate,
            AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository); }
ChartOfAccountDetailJdbcRepository extends JdbcRepository { public ChartOfAccountDetailEntity findById(ChartOfAccountDetailEntity 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<ChartOfAccountDetailEntity> chartofaccountdetails = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountDetailEntity.class)); if (chartofaccountdetails.isEmpty()) { return null; } else { return chartofaccountdetails.get(0); } } ChartOfAccountDetailJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate,
            AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository); ChartOfAccountDetailEntity create(ChartOfAccountDetailEntity entity); ChartOfAccountDetailEntity update(ChartOfAccountDetailEntity entity); Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain); ChartOfAccountDetailEntity findById(ChartOfAccountDetailEntity entity); }
ChartOfAccountDetailJdbcRepository extends JdbcRepository { public ChartOfAccountDetailEntity findById(ChartOfAccountDetailEntity 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<ChartOfAccountDetailEntity> chartofaccountdetails = namedParameterJdbcTemplate.query( getByIdQuery.get(entity.getClass().getSimpleName()).toString(), paramValues, new BeanPropertyRowMapper(ChartOfAccountDetailEntity.class)); if (chartofaccountdetails.isEmpty()) { return null; } else { return chartofaccountdetails.get(0); } } ChartOfAccountDetailJdbcRepository(NamedParameterJdbcTemplate namedParameterJdbcTemplate,
            AccountDetailTypeJdbcRepository accountDetailTypeJdbcRepository); ChartOfAccountDetailEntity create(ChartOfAccountDetailEntity entity); ChartOfAccountDetailEntity update(ChartOfAccountDetailEntity entity); Pagination<ChartOfAccountDetail> search(ChartOfAccountDetailSearch domain); ChartOfAccountDetailEntity findById(ChartOfAccountDetailEntity entity);  }