Mybatis批处理(批量查询,更新,插入)

mybatis批量查询

 

mapper.java

 

List findMenuName(List valueList);

 

mapper.xml


 

批量插入

mapper.java

 

int addResource(List ResourceList);

mapper.xml

 

 

 

 


  	 insert into resource (object_id, res_id, res_detail_value, 
      res_detail_name)
      values
    	 
    		  (#{ResourceList.objectId,jdbcType=VARCHAR},
    		   #{ResourceList.resId,jdbcType=VARCHAR},
    		   #{ResourceList.resDetailValue,jdbcType=VARCHAR},
    		    #{ResourceList.resDetailName,jdbcType=VARCHAR}
    		   )
    	 
  

批量更新

mapper.java

int updateRoles(List roleList);

mapper.xml

 

 

 


  	update role
  	set enabled = '0'
  	where role_id in      
        #{roleIds} 
      
  

 

 

 

 

 

 

 

你可能感兴趣的:(Mybatis)