[ibatis] in 조건 생성하기
* ctrl
List<String> option_state_no = new ArrayList<String>();
option_state_no.add("1");
option_state_no.add("2");
condition.put("option_state_no", option_state_no);
List<Goods> goodsList = goodsService.getList(condition);
* svc
public List<Goods> getList(Map<String, Object> condition) throws Exception {
return goodsDao.getList(condition);
}
* dao
@SuppressWarnings("unchecked")
@Override
public List<Goods> getList(Map<String, Object> condition) throws Exception {
return (List<Goods>)sqlMap.queryForList("goods.list",condition);
}
* sql
<isNotEmpty property="option_state_list" prepend="AND">
<![CDATA[
b.STATE
]]>
<iterate prepend="IN" property="option_state_no" open="(" close=")" conjunction=",">
#option_state_no[]#
</iterate>
</isNotEmpty>
[ibatis] in 조건 생성하기
'programming > ibatis mybatis' 카테고리의 다른 글
[mybatis] oracle insert 리턴값 받기 selectKey (0) | 2014.10.23 |
---|---|
[mybatis] function 호출하고 리턴값 받기 (0) | 2014.08.04 |
[ibatis] in 조건으로 delete 하기 (0) | 2013.10.02 |
[ibatis] delete sql in 사용 (0) | 2013.06.30 |
[ibatis] sql문 예제5 procedure (0) | 2013.06.25 |