package com.hai.dao;

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

import java.util.List;

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

    @DeleteProvider(type=SecRolePermissionRelSqlProvider.class, method="deleteByExample")
    int deleteByExample(SecRolePermissionRelExample example);

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

    @Insert({
        "insert into sec_role_permission_rel (permission_id, role_id)",
        "values (#{permissionId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(SecRolePermissionRel record);

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

    @SelectProvider(type=SecRolePermissionRelSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="permission_id", property="permissionId", jdbcType=JdbcType.BIGINT),
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.BIGINT)
    })
    List<SecRolePermissionRel> selectByExample(SecRolePermissionRelExample example);

    @Select({
        "select",
        "id, permission_id, role_id",
        "from sec_role_permission_rel",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="permission_id", property="permissionId", jdbcType=JdbcType.BIGINT),
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.BIGINT)
    })
    SecRolePermissionRel selectByPrimaryKey(Long id);

    @UpdateProvider(type=SecRolePermissionRelSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SecRolePermissionRel record, @Param("example") SecRolePermissionRelExample example);

    @UpdateProvider(type=SecRolePermissionRelSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SecRolePermissionRel record, @Param("example") SecRolePermissionRelExample example);

    @UpdateProvider(type=SecRolePermissionRelSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SecRolePermissionRel record);

    @Update({
        "update sec_role_permission_rel",
        "set permission_id = #{permissionId,jdbcType=BIGINT},",
          "role_id = #{roleId,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SecRolePermissionRel record);
}
