首页 > 开发 > 综合 > 正文

mybatis批量插入数据

2024-07-21 02:51:41
字体:
来源:转载
供稿:网友

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="com.yjp.mapper.CitiesMapper"><resultMap type="com.yjp.model.Cities" id="CitiesMap"><id column="cities_Id" PRoperty="citiesId"></id><result column="province" property="province"></result><result column="city" property="city"></result><result column="area" property="area"></result></resultMap><insert id="createCities" parameterType="java.util.List">insert into cities(province,city,area)values<foreach collection="list" item="item" index="index" separator=",">(#{item.province},#{item.city},#{item.area})</foreach></insert></mapper>


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表