ibatis multiple update

SQL/IBATIS 2014. 2. 12. 20:50
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
반응형
블로그 이미지

nineDeveloper

안녕하세요 현직 개발자 입니다 ~ 빠르게 변화하는 세상에 뒤쳐지지 않도록 우리모두 열심히 공부합시다 ~! 개발공부는 넘나 재미있는 것~!

,