- Ctr
if ("selectCommonCodeInfo".equals(sActParam) ){
resultListMap = this.commonService.selectCommonCodeInfo(request, listMap);
}
- Service
public IListMap selectCommonCodeInfo(HttpServletRequest request, IListMap listMap) throws Exception {
Map paramMap = listMap.getParameterMap();
IListMap resultListMap = CommonUtil.makeListMap();
Iterator iterator = null;
List sortList = null;
sortList = new ArrayList((Collection)listMap.keySet());
Collections.sort(sortList);
iterator = sortList.iterator();
List list = null;
List CDList = null;
String strDs = null;
String strCovtID = null;
while(iterator.hasNext())
{
strDs = (String)iterator.next();
if(!strDs.equals("PARAM_MAP"))
{
list = listMap.getDataList(strDs);
strCovtID = strDs.toUpperCase();
strCovtID = ((strCovtID.replace("DS_", "")).replace("LIST", "")).replace("_EXIST", "");
if(!list.isEmpty())
{
CDList = new ArrayList();
for (int i=0 ; i< list.size(); i++) {
Map map = (Map)list.get(i);
CDList.add(map.get("CODE"));
}
if("PAYMTHDCD".equals(strCovtID)){
strCovtID = "PAY_MTHD_CD";
} else if("CUSTTCD".equals(strCovtID)){
strCovtID = "CUST_TCD";
} else if("PAYSTDDATETCD".equals(strCovtID)){
strCovtID = "PAY_STD_DATE_TCD";
}
paramMap.put("CODE_LIST", CDList);
paramMap.put("DS_ID", strCovtID);
paramMap.put("DS_SEARCH_TYPE", "VAL");
resultListMap.setDataList(strDs, this.commonDao.selectCommonCodeInfo(request, paramMap));
}
}
}
}
- DAO
public List selectCommonCodeInfo(HttpServletRequest request, Map paramMap) throws Exception {
return this.queryForList("TMDM_COMMON_CODE_INFO", paramMap);
}
-SQL
<select id="TMDM_COMMON_CODE_INFO" resultClass="java.util.HashMap" remapResults="true">
<isEqual prepend="" property="DS_SEARCH_TYPE" compareValue="VAL">
SQL
<isNotEmpty prepend="AND" property="DS_ID">
조건 = #DS_ID#
</isNotEmpty>
<isNotEmpty prepend="" property="CODE_LIST">
<iterate property="CODE_LIST" open=" AND 조건 IN (" close=")" conjunction=",">
#CODE_LIST[]#
</iterate>
</isNotEmpty>
</isEqual>
<isEqual prepend="" property="DS_SEARCH_TYPE" compareValue="ALL">
<isEqual prepend="" property="DS_ID" compareValue="CD_TCD">
SQL
</isEqual>
<isEqual prepend="" property="DS_ID" compareValue="CD">
SQL
</isEqual>
<isEqual prepend="" property="DS_ID" compareValue="FICOSTDEPT">
SQL
</isEqual>
<isEqual prepend="" property="DS_ID" compareValue="FIWBS">
SQL
</isEqual>
</isEqual>
</select>
============================================================================================
- 실행 SQL
select * from table where 1=1 and 조건 IN('A','B','C');