728x90
반응형
UPDATE SITE_GROUP_RELATION SET <isEqual property="condition" compareValue="0"> contents_priority = CASE contents_priority <iterate property="aaasdfasdf" open=" " close=" " conjunction=" "> WHEN #aaasdfasdf[].before# THEN #aaasdfasdf[].after# </iterate> ELSE contents_priority END WHERE <iterate property="aaasdfasdf" prepend="contents_priority IN" open="( " conjunction=" , " close=" ) "> #aaasdfasdf[].before# </iterate> AND site_contents_group_seq = #siteGroupSeq# </isEqual>
String[] before = settingBean.getSearchKind().replaceAll("$,", "").split(","); String[] after = settingBean.getSearchValue().replaceAll("$,", "").split(","); SettingBean sb = new SettingBean(); List<SettingBean> list = new ArrayList<SettingBean>(); Map<String, Object> map = new HashMap<String, Object>(); for (int i = 0; i < before.length; i++) { if (before[i] != after[i]) { sb = new SettingBean(); sb.setAfter(Integer.parseInt(after[i])); sb.setBefore(Integer.parseInt(before[i])); list.add(sb); } } map.put("siteGroupSeq", settingBean.getSite_seq()); map.put("condition", settingBean.getCondition()); map.put("aaasdfasdf", list);
728x90
반응형
'SQL > IBATIS' 카테고리의 다른 글
ibatis like 사용법 (0) | 2014.02.12 |
---|---|
ibatis dynamic query (0) | 2014.02.12 |
ibatis Transaction (0) | 2014.02.12 |
ibatis mysql rownum (0) | 2014.02.12 |
ibatis $ # 차이 (0) | 2014.02.12 |
ibatis iterate ( map , list , array ) (0) | 2014.02.12 |
iBatis 예제 - 3 (iBatis 프로시저(procedure)를 이용한 데이터 insert) (0) | 2014.02.12 |
iBatis 예제 - 2 (iBatis iterate를 이용한 동적 쿼리) (0) | 2014.02.12 |