mybatis批量插入需要注意的细节

1.value的后面不应该再加小括号(),在foreach里面加小括号,不然会发生语法错误;

<insert id="addGoodsList" parameterType="list">
        insert into wms_goods(GOOD_NAME,GOOD_TYPE,GOOD_SIZE,GOOD_VALUE)values
          <foreach collection="list" item="s" separator=",">
              (
              #{s.goodName},
              #{s.goodType},
              #{s.goodSize},
              #{s.goodValue}
              )
          </foreach>
    </insert>

相关推荐