package com.hfkj.dao;

import com.hfkj.entity.SecRegion;
import com.hfkj.entity.SecRegionExample;
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.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 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_id, region_name, ",
        "parent_id, `status`, ",
        "lakala, saas_code, ",
        "saas_bank_code, ext_1, ",
        "ext_2, ext_3)",
        "values (#{regionId,jdbcType=BIGINT}, #{regionName,jdbcType=VARCHAR}, ",
        "#{parentId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER}, ",
        "#{lakala,jdbcType=BIGINT}, #{saasCode,jdbcType=VARCHAR}, ",
        "#{saasBankCode,jdbcType=VARCHAR}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    int insert(SecRegion record);

    @InsertProvider(type=SecRegionSqlProvider.class, method="insertSelective")
    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),
        @Result(column="lakala", property="lakala", jdbcType=JdbcType.BIGINT),
        @Result(column="saas_code", property="saasCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="saas_bank_code", property="saasBankCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    List<SecRegion> selectByExample(SecRegionExample example);

    @Select({
        "select",
        "region_id, region_name, parent_id, `status`, lakala, saas_code, saas_bank_code, ",
        "ext_1, ext_2, ext_3",
        "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),
        @Result(column="lakala", property="lakala", jdbcType=JdbcType.BIGINT),
        @Result(column="saas_code", property="saasCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="saas_bank_code", property="saasBankCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
        @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR)
    })
    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},",
          "lakala = #{lakala,jdbcType=BIGINT},",
          "saas_code = #{saasCode,jdbcType=VARCHAR},",
          "saas_bank_code = #{saasBankCode,jdbcType=VARCHAR},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where region_id = #{regionId,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SecRegion record);
}