论坛首页 入门技术论坛

ibatis传入list

浏览 7222 次
该帖已经被评为新手帖
作者 正文
   发表时间:2009-01-08   最后修改:2009-01-08
   List<Map<String , Object>> groupList = new ArrayList<Map<String , Object>>();
			List<Map<String , Object>> depList = new ArrayList<Map<String , Object>>();
			List<Map<String , Object>> personList = new ArrayList<Map<String , Object>>();
			
			HashMap paramMap = new HashMap();
			paramMap.put("groupList", paramGroupList);
			paramMap.put("depList", paramGroupList);
			paramMap.put("empList", paramPersonList);
			groupList = menuListBO.getGroupAuthList(paramMap);
			depList = menuListBO.getDepAuthList(paramMap);
			personList = menuListBO.getPersonList(paramMap);


<select id="selectDepAuthList" resultClass="dmap" parameterClass="java.util.HashMap">
   
         SELECT *
        FROM tt_dept
         <dynamic prepend="where"> 
        	<isNotNull prepend="and">
       			dept_id IN 
        	<iterate property="depList" open="(" close=")" conjunction=",">
        		 	#depList[]#
            </iterate>
        	</isNotNull>
   		</dynamic>
    </select>
   发表时间:2009-01-09  
.....前面省略
List<Long> list = new ArrayList<Long>();

for (int i = 0; i < temp.length; i++) {
list.add(i, Long.parseLong(temp[i]));
}

goodsService.updateSaleMore(list);




------------------------------------------------------------
xml



<!-- 批量修改 -->
   <update id="UpdateSaleOff" parameterClass="java.util.List">
 
  update b2c_tbl_goods set is_on_sale = 0 where
  
            <iterate conjunction="," open="goods_id in (" close=")" >  
                #[]#  
            </iterate>  

  </update>

——————————————————-————————————————————
DAO

SqlMapClient client = SqlMap.getSqlmap();
client.update("UpdateSaleOff", list);



0 请登录后投票
   发表时间:2009-01-09  
 
引用
<!-- 批量修改 -->
   <update id="UpdateSaleOff" parameterClass="java.util.List">

  update b2c_tbl_goods set is_on_sale = 0 where
 
            <iterate conjunction="," open="goods_id in (" close=")" > 
                #[]# 
            </iterate> 

  </update>
0 请登录后投票
   发表时间:2009-01-09  
看你这贴和看官方文档(还有中文版的)有什么区别?
0 请登录后投票
   发表时间:2009-01-10  
这。。。。
0 请登录后投票
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics