mybatis 批量操作

void batchSave(@Param("relationList") List<ReqDocRelations> relationList);
    
void batchDelete(@Param("id")List<Long> ids); 
 <!-- 根据id 批量删除 -->
  <delete id="batchDelete" parameterType="java.lang.Long">
    delete from doc_relation
    where id in
      <foreach collection="id" index="index" item="list" open="("
        separator="," close=")">
        #{list,jdbcType=BIGINT} 
      </foreach>
   </delete>

 <!-- 根据id 批量删除 -->
<insert id="batchSave" parameterType="web.request.ReqDocRelations">
     insert into doc_relation (id, hospital_id, tablea_id, 
      tablea_col_id, tablea_col_index, tableb_id, 
      tableb_col_id, tableb_col_index)
    values 
   <foreach collection="relationList" item="list" index="index" separator="," >
    (#{list.id,jdbcType=BIGINT}, #{list.hospitalId,jdbcType=BIGINT}, #{list.tableaId,jdbcType=BIGINT}, 
      #{list.tableaColId,jdbcType=BIGINT}, #{list.tableaColIndex,jdbcType=VARCHAR}, #{list.tablebId,jdbcType=BIGINT}, 
      #{list.tablebColId,jdbcType=BIGINT}, #{list.tablebColIndex,jdbcType=VARCHAR})
    </foreach>
  </insert>
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容