MyBatis批量删除 多态sql,构建in语句
2011-07-01 11:46
delete in <delete id="delete" parameterType="list"> <![CDATA[ delete t_vehicle_motorcade where fid in ]]> <foreach collection="list" item="ids" open="(" separator="," close=")"> #{ids} </foreach> </delete> DAO里面直接传入List参数即可: @Override public int delete(List<String> id) { return getSqlSession().delete("VehicleMotorcade.delete",id); } 页面(ExtJS): xtype : 'button', text : '删除', iconCls:'icon-delete', handler:function(){ //删除 var selectRecords = []; selectRecords = getSelectRecord(); quest({ url: 'motorcadeDelete.action', params: { 'selectRecords': selectRecords //selectRecords对应Action里面有个List的对象 }, success: function(response){ var text = Ext.sponseText); Ext.Msg.alert('提示',ssage); //刷新Grid,附带上查询条件 storeReload(); } }); } // 获取选定记录 function getSelectRecord(){ var SelectionModel().getSelection(); var ids = []; for(var i=0; i<records.length; i+=1){ var member = records[i].get('id'); ids.push(member); //向数组后添加元素 } return ids; } |
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论