Commit 99064cd3 authored by Deep Dey's avatar Deep Dey

feat: add filter with father email for get admission form api

parent af6cda23
......@@ -136,7 +136,8 @@ public class AdmissionFormController {
@RequestParam(required = false, defaultValue = "") String schoolName,
@RequestParam(required = false, defaultValue = "") String className,
@RequestParam(required = false, defaultValue = "") String interactionDate, // 2022-01-01
@RequestParam(required = false, defaultValue = "") String interactionTime // 10:00 AM
@RequestParam(required = false, defaultValue = "") String interactionTime,
@RequestParam(required = false, defaultValue = "") String correspondenceEmail// 10:00 AM
) throws Exception {
// TODO: validation of api key using redis
......@@ -149,7 +150,8 @@ public class AdmissionFormController {
schoolName,
className,
interactionDate,
interactionTime
interactionTime,
correspondenceEmail
)
),
HttpStatus.OK);
......@@ -217,6 +219,7 @@ public class AdmissionFormController {
schoolName,
null,
interactionDate,
null,
null
);
......@@ -256,6 +259,7 @@ public class AdmissionFormController {
schoolName,
null,
interactionDate,
null,
null
);
......@@ -295,6 +299,7 @@ public class AdmissionFormController {
schoolName,
null,
interactionDate,
null,
null
);
......
......@@ -79,13 +79,15 @@ public class AdmissionFormDAOController {
String schoolName,
String className,
String interactionDate,
String interactionTime
String interactionTime,
String correspondenceEmail
) {
return admissionFormDataRepository.getAdmissionFormDataList(
schoolName,
className,
interactionDate,
interactionTime
interactionTime,
correspondenceEmail
);
}
......
......@@ -158,7 +158,8 @@ public class AdmissionFormDataRepository {
String schoolName,
String className,
String interactionDate,
String interactionTime
String interactionTime,
String correspondenceEmail
) {
StringBuilder sql = new StringBuilder("SELECT * FROM admission_form_data WHERE 1 = 1");
MapSqlParameterSource parameters = new MapSqlParameterSource();
......@@ -179,6 +180,10 @@ public class AdmissionFormDataRepository {
sql.append(" AND interaction_time = :interactionTime");
parameters.addValue("interactionTime", interactionTime);
}
if (correspondenceEmail != null && !correspondenceEmail.isEmpty()) {
sql.append(" AND father_email = :correspondenceEmail");
parameters.addValue("correspondenceEmail", correspondenceEmail);
}
return namedParameterJdbcTemplate
.query(sql.toString(), parameters, new AdmissionFormMapper());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment