mybatis实现多行新增

阅读 60

2022-02-22

sqlMap层

<insert id="insertList">
     INSERT INTO sys_organizations_path(
     	ancestor_id, descendant_id, distance)
     VALUES
     	<foreach collection="dtoList" item="dto" separator=",">
            (#{dto.ancestorId,jdbcType=BIGINT}, #{dto.descendantId,jdbcType=BIGINT}, #{dto.distance,jdbcType=INTEGER})
        </foreach>
 </insert>

dao层

int insertList(@Param("dtoList") List<Map<String,Object>> dtoList);

精彩评论(0)

0 0 举报