package com.hfkj.dao;

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

import java.util.List;

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

    @DeleteProvider(type= SecRegionSqlProvider.class, method="deleteByExample")
    int deleteByExample(SecRegionExample example);

    @Delete({
        "delete from sec_region",
        "where region_id = #{regionId,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long regionId);

    @Insert({
        "insert into sec_region (region_name, parent_id, ",
        "`status`)",
        "values (#{regionName,jdbcType=VARCHAR}, #{parentId,jdbcType=BIGINT}, ",
        "#{status,jdbcType=INTEGER})"
    })
    @Options(useGeneratedKeys=true,keyProperty="regionId")
    int insert(SecRegion record);

    @InsertProvider(type= SecRegionSqlProvider.class, method="insertSelective")
    @Options(useGeneratedKeys=true,keyProperty="regionId")
    int insertSelective(SecRegion record);

    @SelectProvider(type= SecRegionSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="region_id", property="regionId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR),
        @Result(column="parent_id", property="parentId", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    List<SecRegion> selectByExample(SecRegionExample example);

    @Select({
        "select",
        "region_id, region_name, parent_id, `status`",
        "from sec_region",
        "where region_id = #{regionId,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="region_id", property="regionId", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="region_name", property="regionName", jdbcType=JdbcType.VARCHAR),
        @Result(column="parent_id", property="parentId", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    SecRegion selectByPrimaryKey(Long regionId);

    @UpdateProvider(type= SecRegionSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SecRegion record, @Param("example") SecRegionExample example);

    @UpdateProvider(type= SecRegionSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") SecRegion record, @Param("example") SecRegionExample example);

    @UpdateProvider(type= SecRegionSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SecRegion record);

    @Update({
        "update sec_region",
        "set region_name = #{regionName,jdbcType=VARCHAR},",
          "parent_id = #{parentId,jdbcType=BIGINT},",
          "`status` = #{status,jdbcType=INTEGER}",
        "where region_id = #{regionId,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SecRegion record);
}
