package com.hfkj.dao;

import com.hfkj.entity.SecUserRoleRel;
import com.hfkj.entity.SecUserRoleRelExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;
import org.springframework.stereotype.Repository;

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

    @DeleteProvider(type=SecUserRoleRelSqlProvider.class, method="deleteByExample")
    int deleteByExample(SecUserRoleRelExample example);

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

    @Insert({
        "insert into sec_user_role_rel (user_id, role_id)",
        "values (#{userId,jdbcType=BIGINT}, #{roleId,jdbcType=BIGINT})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(SecUserRoleRel record);

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

    @SelectProvider(type=SecUserRoleRelSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.BIGINT)
    })
    List<SecUserRoleRel> selectByExample(SecUserRoleRelExample example);

    @Select({
        "select",
        "id, user_id, role_id",
        "from sec_user_role_rel",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.BIGINT),
        @Result(column="role_id", property="roleId", jdbcType=JdbcType.BIGINT)
    })
    SecUserRoleRel selectByPrimaryKey(Long id);

    @UpdateProvider(type=SecUserRoleRelSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SecUserRoleRel record, @Param("example") SecUserRoleRelExample example);

    @UpdateProvider(type=SecUserRoleRelSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SecUserRoleRel record, @Param("example") SecUserRoleRelExample example);

    @UpdateProvider(type=SecUserRoleRelSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SecUserRoleRel record);

    @Update({
        "update sec_user_role_rel",
        "set user_id = #{userId,jdbcType=BIGINT},",
          "role_id = #{roleId,jdbcType=BIGINT}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SecUserRoleRel record);
}