Skip to content

Commit

Permalink
fix: clean sql in string block, remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDmz committed Oct 24, 2024
1 parent 6775b4d commit c0204a7
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/main/java/fr/insee/pearljam/batch/dao/SurveyUnitDaoImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@ public SurveyUnitType mapRow(ResultSet rs, int rowNum) throws SQLException {
}
}

public SurveyUnitType getSurveyUnitByIdTest(String surveyUnitId) {
String qString = "SELECT su.* FROM survey_unit su INNER JOIN comment com on com.survey_unit_id = su.id WHERE id=?";
return pilotageJdbcTemplate.queryForObject(qString, new SurveyUnitTypeMapper(), surveyUnitId);
}


public void deleteSurveyUnitById(String surveyUnitId) {
String qString = "DELETE FROM survey_unit WHERE id=?";
pilotageJdbcTemplate.update(qString, surveyUnitId);
Expand All @@ -145,13 +139,13 @@ public long getSampleIdentifiersIdBySurveyUnitId(String surveyUnitId) {
public List<String> getSurveyUnitNVM(long instantDate) {
String qString = """
SELECT t.id FROM
"(SELECT su.id as id, v.management_start_date,
"(SELECT s.type FROM state s WHERE s.survey_unit_id=su.id ORDER BY s.date DESC LIMIT 1) as lastState
"FROM survey_unit su
"JOIN campaign c ON su.campaign_id=c.id
"JOIN visibility v ON v.campaign_id=c.id AND su.organization_unit_id=v.organization_unit_id) t
"WHERE t.lastState='NVM'
"AND t.management_start_date<=?
(SELECT su.id as id, v.management_start_date,
(SELECT s.type FROM state s WHERE s.survey_unit_id=su.id ORDER BY s.date DESC LIMIT 1) as lastState
FROM survey_unit su
JOIN campaign c ON su.campaign_id=c.id
JOIN visibility v ON v.campaign_id=c.id AND su.organization_unit_id=v.organization_unit_id) t
WHERE t.lastState='NVM'
AND t.management_start_date<=?
""";
return pilotageJdbcTemplate.queryForList(qString, String.class, instantDate);
}
Expand Down

0 comments on commit c0204a7

Please sign in to comment.