Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
LaMartin-Webomagic
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Deep Dey
LaMartin-Webomagic
Commits
d99c021c
Commit
d99c021c
authored
Jul 01, 2024
by
Deep Dey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: force typecasting of null by RowMapper
parent
c9ca230b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
42 deletions
+63
-42
lamartinBackend/src/main/java/com/example/LaMartin/admission/mapper/AdmissionFormMapper.java
...xample/LaMartin/admission/mapper/AdmissionFormMapper.java
+46
-42
lamartinBackend/src/main/java/com/example/LaMartin/common/utils/RowMapperUtil.java
...java/com/example/LaMartin/common/utils/RowMapperUtil.java
+17
-0
No files found.
lamartinBackend/src/main/java/com/example/LaMartin/admission/mapper/AdmissionFormMapper.java
View file @
d99c021c
package
com
.
example
.
LaMartin
.
admission
.
mapper
;
import
com.example.LaMartin.admission.model.AdmissionFormData
;
import
com.example.LaMartin.common.utils.RowMapperUtil
;
import
org.jetbrains.annotations.NotNull
;
import
org.springframework.jdbc.core.RowMapper
;
import
org.springframework.stereotype.Component
;
...
...
@@ -16,51 +17,54 @@ public class AdmissionFormMapper implements RowMapper<AdmissionFormData> {
AdmissionFormData
formData
=
new
AdmissionFormData
();
formData
.
setId
(
rs
.
getLong
(
"id"
));
formData
.
setSchool
(
rs
.
getString
(
"school"
));
formData
.
setCategory
(
rs
.
getString
(
"category"
));
formData
.
setFullName
(
rs
.
getString
(
"full_name"
));
formData
.
setAdmissionClass
(
rs
.
getString
(
"admission_class"
));
formData
.
setDateOfBirth
(
rs
.
getString
(
"date_of_birth"
));
formData
.
setNationality
(
rs
.
getString
(
"nationality"
));
formData
.
setReligion
(
rs
.
getString
(
"religion"
));
formData
.
setMotherTongue
(
rs
.
getString
(
"mother_tongue"
));
formData
.
setCommunity
(
rs
.
getString
(
"community"
));
formData
.
setOtherChildren
(
rs
.
getString
(
"other_children"
));
formData
.
setMaritalStatus
(
rs
.
getString
(
"marital_status"
));
formData
.
setSchool
(
RowMapperUtil
.
getString
(
rs
,
"school"
));
formData
.
setCategory
(
RowMapperUtil
.
getString
(
rs
,
"category"
));
formData
.
setFullName
(
RowMapperUtil
.
getString
(
rs
,
"full_name"
));
formData
.
setAdmissionClass
(
RowMapperUtil
.
getString
(
rs
,
"admission_class"
));
formData
.
setDateOfBirth
(
RowMapperUtil
.
getString
(
rs
,
"date_of_birth"
));
formData
.
setNationality
(
RowMapperUtil
.
getString
(
rs
,
"nationality"
));
formData
.
setReligion
(
RowMapperUtil
.
getString
(
rs
,
"religion"
));
formData
.
setMotherTongue
(
RowMapperUtil
.
getString
(
rs
,
"mother_tongue"
));
formData
.
setCommunity
(
RowMapperUtil
.
getString
(
rs
,
"community"
));
formData
.
setOtherChildren
(
RowMapperUtil
.
getString
(
rs
,
"other_children"
));
formData
.
setMaritalStatus
(
RowMapperUtil
.
getString
(
rs
,
"marital_status"
));
formData
.
setFatherName
(
rs
.
getString
(
"father_name"
));
formData
.
setFatherMobile
(
rs
.
getString
(
"father_mobile"
));
formData
.
setFatherEmail
(
rs
.
getString
(
"father_email"
));
formData
.
setFatherNationality
(
rs
.
getString
(
"father_nationality"
));
formData
.
setFatherReligion
(
rs
.
getString
(
"father_religion"
));
formData
.
setFatherMotherTongue
(
rs
.
getString
(
"father_mother_tongue"
));
formData
.
setFatherCommunity
(
rs
.
getString
(
"father_community"
));
formData
.
setFatherSchoolInfo
(
rs
.
getString
(
"father_school_info"
));
formData
.
setFatherCollegeInfo
(
rs
.
getString
(
"father_college_info"
));
formData
.
setFatherUniversityInfo
(
rs
.
getString
(
"father_university_info"
));
formData
.
setFatherProfessionalQualification
(
rs
.
getString
(
"father_professional_qualification"
));
formData
.
setFatherOccupation
(
rs
.
getString
(
"father_occupation"
));
formData
.
setFatherMonthlyIncome
(
rs
.
getString
(
"father_monthly_income"
));
formData
.
setFatherWorkplaceInfo
(
rs
.
getString
(
"father_workplace_info"
));
formData
.
setFatherName
(
RowMapperUtil
.
getString
(
rs
,
"father_name"
));
formData
.
setFatherMobile
(
RowMapperUtil
.
getString
(
rs
,
"father_mobile"
));
formData
.
setFatherEmail
(
RowMapperUtil
.
getString
(
rs
,
"father_email"
));
formData
.
setFatherNationality
(
RowMapperUtil
.
getString
(
rs
,
"father_nationality"
));
formData
.
setFatherReligion
(
RowMapperUtil
.
getString
(
rs
,
"father_religion"
));
formData
.
setFatherMotherTongue
(
RowMapperUtil
.
getString
(
rs
,
"father_mother_tongue"
));
formData
.
setFatherCommunity
(
RowMapperUtil
.
getString
(
rs
,
"father_community"
));
formData
.
setFatherSchoolInfo
(
RowMapperUtil
.
getString
(
rs
,
"father_school_info"
));
formData
.
setFatherCollegeInfo
(
RowMapperUtil
.
getString
(
rs
,
"father_college_info"
));
formData
.
setFatherUniversityInfo
(
RowMapperUtil
.
getString
(
rs
,
"father_university_info"
));
formData
.
setFatherProfessionalQualification
(
RowMapperUtil
.
getString
(
rs
,
"father_professional_qualification"
));
formData
.
setFatherOccupation
(
RowMapperUtil
.
getString
(
rs
,
"father_occupation"
));
formData
.
setFatherMonthlyIncome
(
RowMapperUtil
.
getString
(
rs
,
"father_monthly_income"
));
formData
.
setFatherWorkplaceInfo
(
RowMapperUtil
.
getString
(
rs
,
"father_workplace_info"
));
formData
.
setMotherName
(
rs
.
getString
(
"mother_name"
));
formData
.
setMotherMobile
(
rs
.
getString
(
"mother_mobile"
));
formData
.
setMotherEmail
(
rs
.
getString
(
"mother_email"
));
formData
.
setMotherNationality
(
rs
.
getString
(
"mother_nationality"
));
formData
.
setMotherReligion
(
rs
.
getString
(
"mother_religion"
));
formData
.
setMotherMotherTongue
(
rs
.
getString
(
"mother_mother_tongue"
));
formData
.
setMotherCommunity
(
rs
.
getString
(
"mother_community"
));
formData
.
setMotherSchoolInfo
(
rs
.
getString
(
"mother_school_info"
));
formData
.
setMotherCollegeInfo
(
rs
.
getString
(
"mother_college_info"
));
formData
.
setMotherUniversityInfo
(
rs
.
getString
(
"mother_university_info"
));
formData
.
setMotherProfessionalQualification
(
rs
.
getString
(
"mother_professional_qualification"
));
formData
.
setMotherOccupation
(
rs
.
getString
(
"mother_occupation"
));
formData
.
setMotherMonthlyIncome
(
rs
.
getString
(
"mother_monthly_income"
));
formData
.
setMotherWorkplaceInfo
(
rs
.
getString
(
"mother_workplace_info"
));
formData
.
setMotherName
(
RowMapperUtil
.
getString
(
rs
,
"mother_name"
));
formData
.
setMotherMobile
(
RowMapperUtil
.
getString
(
rs
,
"mother_mobile"
));
formData
.
setMotherEmail
(
RowMapperUtil
.
getString
(
rs
,
"mother_email"
));
formData
.
setMotherNationality
(
RowMapperUtil
.
getString
(
rs
,
"mother_nationality"
));
formData
.
setMotherReligion
(
RowMapperUtil
.
getString
(
rs
,
"mother_religion"
));
formData
.
setMotherMotherTongue
(
RowMapperUtil
.
getString
(
rs
,
"mother_mother_tongue"
));
formData
.
setMotherCommunity
(
RowMapperUtil
.
getString
(
rs
,
"mother_community"
));
formData
.
setMotherSchoolInfo
(
RowMapperUtil
.
getString
(
rs
,
"mother_school_info"
));
formData
.
setMotherCollegeInfo
(
RowMapperUtil
.
getString
(
rs
,
"mother_college_info"
));
formData
.
setMotherUniversityInfo
(
RowMapperUtil
.
getString
(
rs
,
"mother_university_info"
));
formData
.
setMotherProfessionalQualification
(
RowMapperUtil
.
getString
(
rs
,
"mother_professional_qualification"
));
formData
.
setMotherOccupation
(
RowMapperUtil
.
getString
(
rs
,
"mother_occupation"
));
formData
.
setMotherMonthlyIncome
(
RowMapperUtil
.
getString
(
rs
,
"mother_monthly_income"
));
formData
.
setMotherWorkplaceInfo
(
RowMapperUtil
.
getString
(
rs
,
"mother_workplace_info"
));
formData
.
setCandidateImageName
(
rs
.
getString
(
"candidate_image_name"
));
formData
.
setFatherImageName
(
rs
.
getString
(
"father_image_name"
));
formData
.
setMotherImageName
(
rs
.
getString
(
"mother_image_name"
));
formData
.
setCandidateImageName
(
RowMapperUtil
.
getString
(
rs
,
"candidate_image_name"
));
formData
.
setFatherImageName
(
RowMapperUtil
.
getString
(
rs
,
"father_image_name"
));
formData
.
setMotherImageName
(
RowMapperUtil
.
getString
(
rs
,
"mother_image_name"
));
formData
.
setInteractionDate
(
RowMapperUtil
.
getString
(
rs
,
"interaction_date"
));
formData
.
setInteractionTime
(
RowMapperUtil
.
getString
(
rs
,
"interaction_time"
));
return
formData
;
}
...
...
lamartinBackend/src/main/java/com/example/LaMartin/common/utils/RowMapperUtil.java
0 → 100644
View file @
d99c021c
package
com
.
example
.
LaMartin
.
common
.
utils
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.util.Objects
;
public
class
RowMapperUtil
{
@Nullable
public
static
String
getString
(
@NotNull
ResultSet
resultSet
,
String
keyName
)
throws
SQLException
{
String
data
=
resultSet
.
getString
(
keyName
);
return
Objects
.
equals
(
data
,
"null"
)
?
null
:
data
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment