package com.hfkj.dao;

import com.hfkj.entity.CmsCategoryRole;
import com.hfkj.entity.CmsCategoryRoleExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

import java.util.List;

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

    @DeleteProvider(type=CmsCategoryRoleSqlProvider.class, method="deleteByExample")
    int deleteByExample(CmsCategoryRoleExample example);

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

    @Insert({
        "insert into cms_category_role (category_id, role_type)",
        "values (#{categoryId,jdbcType=BIGINT}, #{roleType,jdbcType=INTEGER})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(CmsCategoryRole record);

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

    @SelectProvider(type=CmsCategoryRoleSqlProvider.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="role_type", property="roleType", jdbcType= JdbcType.INTEGER)
    })
    List<CmsCategoryRole> selectByExample(CmsCategoryRoleExample example);

    @Select({
        "select",
        "id, category_id, role_type",
        "from cms_category_role",
        "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="role_type", property="roleType", jdbcType= JdbcType.INTEGER)
    })
    CmsCategoryRole selectByPrimaryKey(Long id);

    @UpdateProvider(type=CmsCategoryRoleSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") CmsCategoryRole record, @Param("example") CmsCategoryRoleExample example);

    @UpdateProvider(type=CmsCategoryRoleSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") CmsCategoryRole record, @Param("example") CmsCategoryRoleExample example);

    @UpdateProvider(type=CmsCategoryRoleSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(CmsCategoryRole record);

    @Update({
        "update cms_category_role",
        "set category_id = #{categoryId,jdbcType=BIGINT},",
          "role_type = #{roleType,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(CmsCategoryRole record);
}
