package com.hai.dao;

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

import java.util.List;

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

    @DeleteProvider(type= CmsCategoryModuleSqlProvider.class, method="deleteByExample")
    int deleteByExample(CmsCategoryModuleExample example);

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

    @Insert({
        "insert into cms_category_module (category_id, code, ",
        "module_name, module_desc, ",
        "module_path, `status`, ",
        "create_time, op_id, ",
        "ext_1, ext_2, ext_3)",
        "values (#{categoryId,jdbcType=BIGINT}, #{code,jdbcType=VARCHAR}, ",
        "#{moduleName,jdbcType=VARCHAR}, #{moduleDesc,jdbcType=VARCHAR}, ",
        "#{modulePath,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{opId,jdbcType=BIGINT}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(CmsCategoryModule record);

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

    @SelectProvider(type= CmsCategoryModuleSqlProvider.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="code", property="code", jdbcType= JdbcType.VARCHAR),
        @Result(column="module_name", property="moduleName", jdbcType= JdbcType.VARCHAR),
        @Result(column="module_desc", property="moduleDesc", jdbcType= JdbcType.VARCHAR),
        @Result(column="module_path", property="modulePath", jdbcType= JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType= JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType= JdbcType.TIMESTAMP),
        @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<CmsCategoryModule> selectByExample(CmsCategoryModuleExample example);

    @Select({
        "select",
        "id, category_id, code, module_name, module_desc, module_path, `status`, create_time, ",
        "op_id, ext_1, ext_2, ext_3",
        "from cms_category_module",
        "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="code", property="code", jdbcType= JdbcType.VARCHAR),
        @Result(column="module_name", property="moduleName", jdbcType= JdbcType.VARCHAR),
        @Result(column="module_desc", property="moduleDesc", jdbcType= JdbcType.VARCHAR),
        @Result(column="module_path", property="modulePath", jdbcType= JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType= JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType= JdbcType.TIMESTAMP),
        @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)
    })
    CmsCategoryModule selectByPrimaryKey(Long id);

    @UpdateProvider(type= CmsCategoryModuleSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CmsCategoryModule record, @Param("example") CmsCategoryModuleExample example);

    @UpdateProvider(type= CmsCategoryModuleSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CmsCategoryModule record, @Param("example") CmsCategoryModuleExample example);

    @UpdateProvider(type= CmsCategoryModuleSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CmsCategoryModule record);

    @Update({
        "update cms_category_module",
        "set category_id = #{categoryId,jdbcType=BIGINT},",
          "code = #{code,jdbcType=VARCHAR},",
          "module_name = #{moduleName,jdbcType=VARCHAR},",
          "module_desc = #{moduleDesc,jdbcType=VARCHAR},",
          "module_path = #{modulePath,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "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(CmsCategoryModule record);
}
