package com.hfkj.dao;

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

import java.util.List;

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

    @DeleteProvider(type=SecPermissionSqlProvider.class, method="deleteByExample")
    int deleteByExample(SecPermissionExample example);

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

    @Insert({
        "insert into sec_permission (permission_name, permission_code, ",
        "permission_desc, sort, ",
        "menu_id)",
        "values (#{permissionName,jdbcType=VARCHAR}, #{permissionCode,jdbcType=VARCHAR}, ",
        "#{permissionDesc,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, ",
        "#{menuId,jdbcType=BIGINT})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(SecPermission record);

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

    @SelectProvider(type=SecPermissionSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="permission_name", property="permissionName", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_code", property="permissionCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_desc", property="permissionDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_id", property="menuId", jdbcType=JdbcType.BIGINT)
    })
    List<SecPermission> selectByExample(SecPermissionExample example);

    @Select({
        "select",
        "id, permission_name, permission_code, permission_desc, sort, menu_id",
        "from sec_permission",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="permission_name", property="permissionName", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_code", property="permissionCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="permission_desc", property="permissionDesc", jdbcType=JdbcType.VARCHAR),
        @Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER),
        @Result(column="menu_id", property="menuId", jdbcType=JdbcType.BIGINT)
    })
    SecPermission selectByPrimaryKey(Long id);

    @UpdateProvider(type=SecPermissionSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SecPermission record, @Param("example") SecPermissionExample example);

    @UpdateProvider(type=SecPermissionSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SecPermission record, @Param("example") SecPermissionExample example);

    @UpdateProvider(type=SecPermissionSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SecPermission record);

    @Update({
        "update sec_permission",
        "set permission_name = #{permissionName,jdbcType=VARCHAR},",
          "permission_code = #{permissionCode,jdbcType=VARCHAR},",
          "permission_desc = #{permissionDesc,jdbcType=VARCHAR},",
          "sort = #{sort,jdbcType=INTEGER},",
          "menu_id = #{menuId,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SecPermission record);
}
