package com.hfkj.dao;

import com.hfkj.entity.BsCity;
import com.hfkj.entity.BsCityExample;
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 BsCityMapper extends BsCityMapperExt {
    @SelectProvider(type=BsCitySqlProvider.class, method="countByExample")
    long countByExample(BsCityExample example);

    @DeleteProvider(type=BsCitySqlProvider.class, method="deleteByExample")
    int deleteByExample(BsCityExample example);

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

    @Insert({
        "insert into bs_city (region_id, region_name, ",
        "parent_id, `status`)",
        "values (#{regionId,jdbcType=BIGINT}, #{regionName,jdbcType=VARCHAR}, ",
        "#{parentId,jdbcType=BIGINT}, #{status,jdbcType=INTEGER})"
    })
    int insert(BsCity record);

    @InsertProvider(type=BsCitySqlProvider.class, method="insertSelective")
    int insertSelective(BsCity record);

    @SelectProvider(type=BsCitySqlProvider.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<BsCity> selectByExample(BsCityExample example);

    @Select({
        "select",
        "region_id, region_name, parent_id, `status`",
        "from bs_city",
        "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)
    })
    BsCity selectByPrimaryKey(Long regionId);

    @UpdateProvider(type=BsCitySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsCity record, @Param("example") BsCityExample example);

    @UpdateProvider(type=BsCitySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsCity record, @Param("example") BsCityExample example);

    @UpdateProvider(type=BsCitySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsCity record);

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