//콤마 가 있을때.
String comma = resultData.getPrhibtLangNm();
String result[] = comma.split(",");
for(int i = 0; i < result.length; i++){
LOG.debug("=========" + result[i]);
boolean comparisonResult = prohibitionService.prohibitionComparisonResult(result[i]);
}
resultData.getPrhibtLangNm(); -> 값에 콤마가 있을 경우 순차적으로 콤마를 빼고 넘긴다.
//비교 Service
boolean prohibitionComparisonResult(String result)throws Exception;
// ServiceImpl
@Override
public boolean prohibitionComparisonResult(String result)throws Exception {
int rs = prohibitionMapper.prohibitionComparisonResult(result);
boolean data = false;
if(rs > 0){
///1이면 true > 데이터가 있는거
data = true;
}else{
///0이면 false > 데이터가 없는거
data = false;
}
return data;
}
//Mapper
int prohibitionComparisonResult(String result)throws Exception;
<select id="prohibitionComparisonResult" parameterType="해당vo" resultType="해당vo">
SELECT
CASE
WHEN Count(*)>=1 THEN 1
ELSE 0
END AS isexist
FROM com_prhibt_lang_mng
WHERE prhibt_lang_nm LIKE %#{prhibt_lang_nm}%
</select>
존재 여부 1/ 0으로 체크 -> 1일 때 true , 0일 때 false 반환
'java' 카테고리의 다른 글
백준 2566번 문제 최댓값(Java_자바) (0) | 2024.03.03 |
---|---|
백준 2738번 문제 행렬 덧셈 (Java_자바) (0) | 2024.03.03 |
JSP 세션 ID 와 세션 유지시간 을 출력해보자! (0) | 2020.08.27 |
java - HashSet 이용한 성적관리 프로그램 (0) | 2020.08.15 |
java - 스택 큐 (pop , push) 상속 ,추상 클래스 (0) | 2020.08.15 |