package com.hai.dao;

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

import java.util.List;

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

    @DeleteProvider(type= CmsContentSqlProvider.class, method="deleteByExample")
    int deleteByExample(CmsContentExample example);

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

    @Insert({
        "insert into cms_content (category_id, category_code, ",
        "title, description, ",
        "create_time, `status`, ",
        "has_patch, visit_count, ",
        "tag, img_data, jump_name, ",
        "jump_url, sort_id, ",
        "update_time, recommend, ",
        "company_id, company_name, ",
        "user_name, op_id, ext_1, ",
        "ext_2, ext_3, content)",
        "values (#{categoryId,jdbcType=BIGINT}, #{categoryCode,jdbcType=VARCHAR}, ",
        "#{title,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
        "#{hasPatch,jdbcType=INTEGER}, #{visitCount,jdbcType=INTEGER}, ",
        "#{tag,jdbcType=VARCHAR}, #{imgData,jdbcType=VARCHAR}, #{jumpName,jdbcType=VARCHAR}, ",
        "#{jumpUrl,jdbcType=VARCHAR}, #{sortId,jdbcType=INTEGER}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{recommend,jdbcType=BIT}, ",
        "#{companyId,jdbcType=BIGINT}, #{companyName,jdbcType=VARCHAR}, ",
        "#{userName,jdbcType=VARCHAR}, #{opId,jdbcType=BIGINT}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(CmsContent record);

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

    @SelectProvider(type= CmsContentSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
        @Result(column="category_id", property="categoryId", jdbcType= JdbcType.BIGINT),
        @Result(column="category_code", property="categoryCode", jdbcType= JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType= JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType= JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType= JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType= JdbcType.INTEGER),
        @Result(column="has_patch", property="hasPatch", jdbcType= JdbcType.INTEGER),
        @Result(column="visit_count", property="visitCount", jdbcType= JdbcType.INTEGER),
        @Result(column="tag", property="tag", jdbcType= JdbcType.VARCHAR),
        @Result(column="img_data", property="imgData", jdbcType= JdbcType.VARCHAR),
        @Result(column="jump_name", property="jumpName", jdbcType= JdbcType.VARCHAR),
        @Result(column="jump_url", property="jumpUrl", jdbcType= JdbcType.VARCHAR),
        @Result(column="sort_id", property="sortId", jdbcType= JdbcType.INTEGER),
        @Result(column="update_time", property="updateTime", jdbcType= JdbcType.TIMESTAMP),
        @Result(column="recommend", property="recommend", jdbcType= JdbcType.BIT),
        @Result(column="company_id", property="companyId", jdbcType= JdbcType.BIGINT),
        @Result(column="company_name", property="companyName", jdbcType= JdbcType.VARCHAR),
        @Result(column="user_name", property="userName", jdbcType= JdbcType.VARCHAR),
        @Result(column="op_id", property="opId", jdbcType= JdbcType.BIGINT),
        @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),
        @Result(column="content", property="content", jdbcType= JdbcType.LONGVARCHAR)
    })
    List<CmsContent> selectByExampleWithBLOBs(CmsContentExample example);

    @SelectProvider(type= CmsContentSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
        @Result(column="category_id", property="categoryId", jdbcType= JdbcType.BIGINT),
        @Result(column="category_code", property="categoryCode", jdbcType= JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType= JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType= JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType= JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType= JdbcType.INTEGER),
        @Result(column="has_patch", property="hasPatch", jdbcType= JdbcType.INTEGER),
        @Result(column="visit_count", property="visitCount", jdbcType= JdbcType.INTEGER),
        @Result(column="tag", property="tag", jdbcType= JdbcType.VARCHAR),
        @Result(column="img_data", property="imgData", jdbcType= JdbcType.VARCHAR),
        @Result(column="jump_name", property="jumpName", jdbcType= JdbcType.VARCHAR),
        @Result(column="jump_url", property="jumpUrl", jdbcType= JdbcType.VARCHAR),
        @Result(column="sort_id", property="sortId", jdbcType= JdbcType.INTEGER),
        @Result(column="update_time", property="updateTime", jdbcType= JdbcType.TIMESTAMP),
        @Result(column="recommend", property="recommend", jdbcType= JdbcType.BIT),
        @Result(column="company_id", property="companyId", jdbcType= JdbcType.BIGINT),
        @Result(column="company_name", property="companyName", jdbcType= JdbcType.VARCHAR),
        @Result(column="user_name", property="userName", jdbcType= JdbcType.VARCHAR),
        @Result(column="op_id", property="opId", jdbcType= JdbcType.BIGINT),
        @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<CmsContent> selectByExample(CmsContentExample example);

    @Select({
        "select",
        "id, category_id, category_code, title, description, create_time, `status`, has_patch, ",
        "visit_count, tag, img_data, jump_name, jump_url, sort_id, update_time, recommend, ",
        "company_id, company_name, user_name, op_id, ext_1, ext_2, ext_3, content",
        "from cms_content",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType= JdbcType.BIGINT, id=true),
        @Result(column="category_id", property="categoryId", jdbcType= JdbcType.BIGINT),
        @Result(column="category_code", property="categoryCode", jdbcType= JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType= JdbcType.VARCHAR),
        @Result(column="description", property="description", jdbcType= JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType= JdbcType.TIMESTAMP),
        @Result(column="status", property="status", jdbcType= JdbcType.INTEGER),
        @Result(column="has_patch", property="hasPatch", jdbcType= JdbcType.INTEGER),
        @Result(column="visit_count", property="visitCount", jdbcType= JdbcType.INTEGER),
        @Result(column="tag", property="tag", jdbcType= JdbcType.VARCHAR),
        @Result(column="img_data", property="imgData", jdbcType= JdbcType.VARCHAR),
        @Result(column="jump_name", property="jumpName", jdbcType= JdbcType.VARCHAR),
        @Result(column="jump_url", property="jumpUrl", jdbcType= JdbcType.VARCHAR),
        @Result(column="sort_id", property="sortId", jdbcType= JdbcType.INTEGER),
        @Result(column="update_time", property="updateTime", jdbcType= JdbcType.TIMESTAMP),
        @Result(column="recommend", property="recommend", jdbcType= JdbcType.BIT),
        @Result(column="company_id", property="companyId", jdbcType= JdbcType.BIGINT),
        @Result(column="company_name", property="companyName", jdbcType= JdbcType.VARCHAR),
        @Result(column="user_name", property="userName", jdbcType= JdbcType.VARCHAR),
        @Result(column="op_id", property="opId", jdbcType= JdbcType.BIGINT),
        @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),
        @Result(column="content", property="content", jdbcType= JdbcType.LONGVARCHAR)
    })
    CmsContent selectByPrimaryKey(Long id);

    @UpdateProvider(type= CmsContentSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CmsContent record, @Param("example") CmsContentExample example);

    @UpdateProvider(type= CmsContentSqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") CmsContent record, @Param("example") CmsContentExample example);

    @UpdateProvider(type= CmsContentSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CmsContent record, @Param("example") CmsContentExample example);

    @UpdateProvider(type= CmsContentSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CmsContent record);

    @Update({
        "update cms_content",
        "set category_id = #{categoryId,jdbcType=BIGINT},",
          "category_code = #{categoryCode,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "`status` = #{status,jdbcType=INTEGER},",
          "has_patch = #{hasPatch,jdbcType=INTEGER},",
          "visit_count = #{visitCount,jdbcType=INTEGER},",
          "tag = #{tag,jdbcType=VARCHAR},",
          "img_data = #{imgData,jdbcType=VARCHAR},",
          "jump_name = #{jumpName,jdbcType=VARCHAR},",
          "jump_url = #{jumpUrl,jdbcType=VARCHAR},",
          "sort_id = #{sortId,jdbcType=INTEGER},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "recommend = #{recommend,jdbcType=BIT},",
          "company_id = #{companyId,jdbcType=BIGINT},",
          "company_name = #{companyName,jdbcType=VARCHAR},",
          "user_name = #{userName,jdbcType=VARCHAR},",
          "op_id = #{opId,jdbcType=BIGINT},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=LONGVARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKeyWithBLOBs(CmsContent record);

    @Update({
        "update cms_content",
        "set category_id = #{categoryId,jdbcType=BIGINT},",
          "category_code = #{categoryCode,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "description = #{description,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "`status` = #{status,jdbcType=INTEGER},",
          "has_patch = #{hasPatch,jdbcType=INTEGER},",
          "visit_count = #{visitCount,jdbcType=INTEGER},",
          "tag = #{tag,jdbcType=VARCHAR},",
          "img_data = #{imgData,jdbcType=VARCHAR},",
          "jump_name = #{jumpName,jdbcType=VARCHAR},",
          "jump_url = #{jumpUrl,jdbcType=VARCHAR},",
          "sort_id = #{sortId,jdbcType=INTEGER},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "recommend = #{recommend,jdbcType=BIT},",
          "company_id = #{companyId,jdbcType=BIGINT},",
          "company_name = #{companyName,jdbcType=VARCHAR},",
          "user_name = #{userName,jdbcType=VARCHAR},",
          "op_id = #{opId,jdbcType=BIGINT},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(CmsContent record);
}