@Repository
public interface StepMapper extends BaseMapper<Step> {
@Insert({"<script>",
"INSERT INTO step(id, recipe_id, description, img_url)",
"VALUES",
"<foreach collection =\"stepList\" item=\"step\" separator =\",\">",
"(#{step.id}, #{step.recipeId}, #{step.description}, #{step.imgUrl})",
"</foreach >",
"</script>"})
public int insertStepList(@Param("stepList") List<Step> stepList);
}
@insert <foreach>批量插入数据
最新推荐文章于 2024-06-10 09:16:04 发布