package com.hai.dao;

import com.hai.entity.CmsPatch;
import com.hai.entity.CmsPatchExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 
 * 代码由工具生成,请勿修改!!!
 * 如果需要扩展请在其父类进行扩展
 * 
 **/
@Repository
public interface CmsPatchMapper extends CmsPatchMapperExt {
    @SelectProvider(type= CmsPatchSqlProvider.class, method="countByExample")
    long countByExample(CmsPatchExample example);

    @DeleteProvider(type= CmsPatchSqlProvider.class, method="deleteByExample")
    int deleteByExample(CmsPatchExample example);

    @Delete({
        "delete from cms_patch",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "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 (#{contentId,jdbcType=BIGINT}, #{patchName,jdbcType=VARCHAR}, ",
        "#{patchDesc,jdbcType=VARCHAR}, #{patchType,jdbcType=INTEGER}, ",
        "#{patchPath,jdbcType=VARCHAR}, #{videoPath,jdbcType=VARCHAR}, ",
        "#{source,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER}, #{addTime,jdbcType=TIMESTAMP}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(CmsPatch record);

    @InsertProvider(type= CmsPatchSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insertSelective(CmsPatch record);

    @SelectProvider(type= CmsPatchSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
        @Result(column="content_id", property="contentId", jdbcType= JdbcType.BIGINT),
        @Result(column="patch_name", property="patchName", jdbcType= JdbcType.VARCHAR),
        @Result(column="patch_desc", property="patchDesc", jdbcType= JdbcType.VARCHAR),
        @Result(column="patch_type", property="patchType", jdbcType= JdbcType.INTEGER),
        @Result(column="patch_path", property="patchPath", jdbcType= JdbcType.VARCHAR),
        @Result(column="video_path", property="videoPath", jdbcType= JdbcType.VARCHAR),
        @Result(column="source", property="source", jdbcType= JdbcType.INTEGER),
        @Result(column="sort", property="sort", jdbcType= JdbcType.INTEGER),
        @Result(column="add_time", property="addTime", jdbcType= JdbcType.TIMESTAMP),
        @Result(column="ext_1", property="ext1", jdbcType= JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType= JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType= JdbcType.VARCHAR)
    })
    List<CmsPatch> selectByExample(CmsPatchExample example);

    @Select({
        "select",
        "id, content_id, patch_name, patch_desc, patch_type, patch_path, video_path, ",
        "`source`, sort, add_time, ext_1, ext_2, ext_3",
        "from cms_patch",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
        @Result(column="content_id", property="contentId", jdbcType= JdbcType.BIGINT),
        @Result(column="patch_name", property="patchName", jdbcType= JdbcType.VARCHAR),
        @Result(column="patch_desc", property="patchDesc", jdbcType= JdbcType.VARCHAR),
        @Result(column="patch_type", property="patchType", jdbcType= JdbcType.INTEGER),
        @Result(column="patch_path", property="patchPath", jdbcType= JdbcType.VARCHAR),
        @Result(column="video_path", property="videoPath", jdbcType= JdbcType.VARCHAR),
        @Result(column="source", property="source", jdbcType= JdbcType.INTEGER),
        @Result(column="sort", property="sort", jdbcType= JdbcType.INTEGER),
        @Result(column="add_time", property="addTime", jdbcType= JdbcType.TIMESTAMP),
        @Result(column="ext_1", property="ext1", jdbcType= JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType= JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType= JdbcType.VARCHAR)
    })
    CmsPatch selectByPrimaryKey(Long id);

    @UpdateProvider(type= CmsPatchSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CmsPatch record, @Param("example") CmsPatchExample example);

    @UpdateProvider(type= CmsPatchSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CmsPatch record, @Param("example") CmsPatchExample example);

    @UpdateProvider(type= CmsPatchSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CmsPatch record);

    @Update({
        "update cms_patch",
        "set content_id = #{contentId,jdbcType=BIGINT},",
          "patch_name = #{patchName,jdbcType=VARCHAR},",
          "patch_desc = #{patchDesc,jdbcType=VARCHAR},",
          "patch_type = #{patchType,jdbcType=INTEGER},",
          "patch_path = #{patchPath,jdbcType=VARCHAR},",
          "video_path = #{videoPath,jdbcType=VARCHAR},",
          "`source` = #{source,jdbcType=INTEGER},",
          "sort = #{sort,jdbcType=INTEGER},",
          "add_time = #{addTime,jdbcType=TIMESTAMP},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(CmsPatch record);
}
