1. 程式人生 > >ibatis 傳遞陣列作為引數

ibatis 傳遞陣列作為引數

<delete id="deleteRy">
         <![CDATA[
               DELETE FROM  T_RLZY_RY  where ID IN 
         ]]>
        <iterate close=")" open="("  conjunction=",">
            <![CDATA[
                 #[]# 
            ]]> 
       </iterate>  
 </delete>


 <delete id="updateLzyyByIds" parameterClass="Map">
          <![CDATA[
                  UPDATE  T_RLZY_RY SET LZYY=#lzyy#  where ID IN 
          ]]>
          <iterate close=")" open="(" property="ids"  conjunction=",">
                  <![CDATA[
                         #ids[]# 
           ]]> 
          </iterate>  
 </delete>

程式呼叫

   Map map=new HashMap();
   map.put("jgid", jgid);
   map.put("ids", ids.split(","));
   map.put("lzyy", lzyy);
   sqlClient.update("ry.updateLzyyByIds", map);

  sqlClient.delete("ry.deleteRy", ids.split(","));