package com.hai.dao;

import com.hai.entity.CmsPatch;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * mapper扩展类
 */
public interface CmsPatchMapperExt {

    @Insert(value = {
            "<script>",
            "INSERT",
            "INTO cms_patch(content_id, patch_name, patch_desc, patch_type, " +
                    "patch_path, video_path, source, sort, add_time, ext_1, ext_2, ext_3)",
            "VALUES",
            "<foreach collection=\"patchList\" item=\"item\" index=\"idx\" open=\"(\" separator=\"),(\" close=\")\">",
            "    #{contentId, jdbcType=BIGINT}, #{item.patchName}, #{item.patchDesc}, #{item.patchType}" +
                    ", #{item.patchPath}, #{item.videoPath}, #{item.source}, #{item.sort}, #{item.addTime}" +
                    ", #{item.ext1}, #{item.ext2}, #{item.ext3}",
            "</foreach>",
            "</script>"
    })
    int addListPatch(@Param(value = "patchList") List<CmsPatch> patchList,
                     @Param(value = "contentId") Long contentId) throws Exception;
}
