mybatis 批量新增
xml代码
<insert id="batchInsert" parameterType="com.hysoft.kwgstr.domain.Concept" > insert into KWG_STR_CONCEPT (CPT_ID, IDF_CODE, CPT_CODE, CPT_NAME,MODEL_ID,ONTOLOGY_SHOW,ONTOLOGY_IDT,CATEGORY) <foreach collection="list" item="item" index="index" separator="union all"> select #{item.cptId,jdbcType=CHAR}, #{item.idfCode,jdbcType=VARCHAR}, #{item.cptCode,jdbcType=VARCHAR},#{item.cptName,jdbcType=CLOB}, #{item.modelId,jdbcType=VARCHAR},#{item.ontologyShow,jdbcType=CLOB}, #{item.ontologyIdt,jdbcType=CLOB},#{item.category,jdbcType=VARCHAR} from dual </foreach> </insert>
dao层java代码
//批量保存 int batchInsert(@Param("list")List<Concept> plist);