mybatis删除关键字数组对应项

mybatis删除cameraId关键字数组对应的条目

<delete id="deleteCameraVersionCheckInfo" parameterClass="java.util.HashMap">
		delete from camera_version_check_info where cameraVersionId =#cameraVersionId# 
		<isNotEmpty prepend="and" property="cameraId">
			cameraId in
		     <iterate conjunction="," open="(" close=")" property="cameraId">
			  	#cameraId[]#
			 </iterate>
  		</isNotEmpty>
	</delete>


前端:

function toDelete(){
        	  
        	 if(!checkSelect("cameraVersionCheckInfoList","id")){
            		return false;
            	}  
        	  var checked =$("#cameraVersionCheckInfoList").datagrid("getChecked");
        	  
        	  var cameraIds="" ;
        	  
        	  for( var i = 0 ;i<checked.length;i++){
        		  if(i==0){
        			  cameraIds+=checked[i].cameraId;
        		  }else{
        			  cameraIds+=","+checked[i].cameraId;
        		  }
        	  }
        	  $.messager.progress(); 
        	  $.ajax({
                  type: "POST",
                  url:"/admin/update/deleteCameraVersionCheckInfo.do",
                  data: {cameraVersionId:$("#cameraVersionId").val(), cameraIds:cameraIds},
                  dataType: "json",
                  success: function(data){
                	  
                	  if(data.success){
	                	  $.messager.progress('close'); 
	                      $.messager.show("delete success");
	                      $("#cameraVersionCheckInfoList").datagrid("reload");
                	  }
                	  
                  }
              });


 

中间后台:

String[] cameraId = cameraIds.split(",");


 

 

 

 

 

 

 

 

你可能感兴趣的:(mybatis删除关键字数组对应项)