List 생성
public static List<String> listWhere(String code, String gb){
List<String> codeList = new ArrayList<>();
String[] strCode = code.split(value);
for(int i=0; i< strCode.length; i++){
codeList.add(strCode[i].toString());
}
return codeList;
}
public void getCodes(List<String> codeList) {
Map<String, Object> search_map = new Map<String, Object>();
List
search_map.put("codeList", CommonUtil.listWhere(StringUtil.nullToStr("1001,1002,1003,1004"), "," ));
commonDAO.selectList("codeInfo.selectCodeList", search_map);
}
MyBatis
<select id="selectCodeList" resultType="codeMap">
SELECT *
FROM CODE
WHERE code IN
<foreach collection="codeList" item="code" index="index" separator="," open="(" close=")">
#{code}
</foreach>
</select>
반응형
'개발 > Java' 카테고리의 다른 글
JAVA 에서 Linux 명령어 실행 (0) | 2022.04.16 |
---|---|
Java Base64 인코딩, 디코딩 하는 방법 (0) | 2022.04.15 |
[Spring] CronSchedule 문법 (0) | 2022.03.18 |
[SpringBoot] Debug 실행 오류 (0) | 2022.03.15 |
java.util.LinkedHashMap cannot be cast to object (0) | 2021.07.26 |
댓글