package com.hfkj.dao;

import com.hfkj.entity.BsMerchant;
import com.hfkj.entity.BsMerchantExample;
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 BsMerchantMapper extends BsMerchantMapperExt {
    @SelectProvider(type=BsMerchantSqlProvider.class, method="countByExample")
    long countByExample(BsMerchantExample example);

    @DeleteProvider(type=BsMerchantSqlProvider.class, method="deleteByExample")
    int deleteByExample(BsMerchantExample example);

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

    @Insert({
        "insert into bs_merchant (source_type, province_code, ",
        "province_name, city_code, ",
        "city_name, area_code, ",
        "area_name, oil_price_zone_id, ",
        "oil_price_zone_name, chain_brand_id, ",
        "chain_brand_name, chain_brand_settle_type, ",
        "mer_no, mer_logo, ",
        "mer_name, contacts_name, ",
        "contacts_tel, customer_service_tel, ",
        "address, longitude, ",
        "latitude, mer_label, ",
        "list_show, `status`, create_time, ",
        "update_time, ext_1, ",
        "ext_2, ext_3)",
        "values (#{sourceType,jdbcType=INTEGER}, #{provinceCode,jdbcType=BIGINT}, ",
        "#{provinceName,jdbcType=VARCHAR}, #{cityCode,jdbcType=BIGINT}, ",
        "#{cityName,jdbcType=VARCHAR}, #{areaCode,jdbcType=BIGINT}, ",
        "#{areaName,jdbcType=VARCHAR}, #{oilPriceZoneId,jdbcType=INTEGER}, ",
        "#{oilPriceZoneName,jdbcType=VARCHAR}, #{chainBrandId,jdbcType=BIGINT}, ",
        "#{chainBrandName,jdbcType=VARCHAR}, #{chainBrandSettleType,jdbcType=INTEGER}, ",
        "#{merNo,jdbcType=VARCHAR}, #{merLogo,jdbcType=VARCHAR}, ",
        "#{merName,jdbcType=VARCHAR}, #{contactsName,jdbcType=VARCHAR}, ",
        "#{contactsTel,jdbcType=VARCHAR}, #{customerServiceTel,jdbcType=VARCHAR}, ",
        "#{address,jdbcType=VARCHAR}, #{longitude,jdbcType=VARCHAR}, ",
        "#{latitude,jdbcType=VARCHAR}, #{merLabel,jdbcType=VARCHAR}, ",
        "#{listShow,jdbcType=BIT}, #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(BsMerchant record);

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

    @SelectProvider(type=BsMerchantSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="source_type", property="sourceType", jdbcType=JdbcType.INTEGER),
        @Result(column="province_code", property="provinceCode", jdbcType=JdbcType.BIGINT),
        @Result(column="province_name", property="provinceName", jdbcType=JdbcType.VARCHAR),
        @Result(column="city_code", property="cityCode", jdbcType=JdbcType.BIGINT),
        @Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR),
        @Result(column="area_code", property="areaCode", jdbcType=JdbcType.BIGINT),
        @Result(column="area_name", property="areaName", jdbcType=JdbcType.VARCHAR),
        @Result(column="oil_price_zone_id", property="oilPriceZoneId", jdbcType=JdbcType.INTEGER),
        @Result(column="oil_price_zone_name", property="oilPriceZoneName", jdbcType=JdbcType.VARCHAR),
        @Result(column="chain_brand_id", property="chainBrandId", jdbcType=JdbcType.BIGINT),
        @Result(column="chain_brand_name", property="chainBrandName", jdbcType=JdbcType.VARCHAR),
        @Result(column="chain_brand_settle_type", property="chainBrandSettleType", jdbcType=JdbcType.INTEGER),
        @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="mer_logo", property="merLogo", jdbcType=JdbcType.VARCHAR),
        @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
        @Result(column="contacts_name", property="contactsName", jdbcType=JdbcType.VARCHAR),
        @Result(column="contacts_tel", property="contactsTel", jdbcType=JdbcType.VARCHAR),
        @Result(column="customer_service_tel", property="customerServiceTel", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="longitude", property="longitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="mer_label", property="merLabel", jdbcType=JdbcType.VARCHAR),
        @Result(column="list_show", property="listShow", jdbcType=JdbcType.BIT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @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<BsMerchant> selectByExample(BsMerchantExample example);

    @Select({
        "select",
        "id, source_type, province_code, province_name, city_code, city_name, area_code, ",
        "area_name, oil_price_zone_id, oil_price_zone_name, chain_brand_id, chain_brand_name, ",
        "chain_brand_settle_type, mer_no, mer_logo, mer_name, contacts_name, contacts_tel, ",
        "customer_service_tel, address, longitude, latitude, mer_label, list_show, `status`, ",
        "create_time, update_time, ext_1, ext_2, ext_3",
        "from bs_merchant",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="source_type", property="sourceType", jdbcType=JdbcType.INTEGER),
        @Result(column="province_code", property="provinceCode", jdbcType=JdbcType.BIGINT),
        @Result(column="province_name", property="provinceName", jdbcType=JdbcType.VARCHAR),
        @Result(column="city_code", property="cityCode", jdbcType=JdbcType.BIGINT),
        @Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR),
        @Result(column="area_code", property="areaCode", jdbcType=JdbcType.BIGINT),
        @Result(column="area_name", property="areaName", jdbcType=JdbcType.VARCHAR),
        @Result(column="oil_price_zone_id", property="oilPriceZoneId", jdbcType=JdbcType.INTEGER),
        @Result(column="oil_price_zone_name", property="oilPriceZoneName", jdbcType=JdbcType.VARCHAR),
        @Result(column="chain_brand_id", property="chainBrandId", jdbcType=JdbcType.BIGINT),
        @Result(column="chain_brand_name", property="chainBrandName", jdbcType=JdbcType.VARCHAR),
        @Result(column="chain_brand_settle_type", property="chainBrandSettleType", jdbcType=JdbcType.INTEGER),
        @Result(column="mer_no", property="merNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="mer_logo", property="merLogo", jdbcType=JdbcType.VARCHAR),
        @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
        @Result(column="contacts_name", property="contactsName", jdbcType=JdbcType.VARCHAR),
        @Result(column="contacts_tel", property="contactsTel", jdbcType=JdbcType.VARCHAR),
        @Result(column="customer_service_tel", property="customerServiceTel", jdbcType=JdbcType.VARCHAR),
        @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR),
        @Result(column="longitude", property="longitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="latitude", property="latitude", jdbcType=JdbcType.VARCHAR),
        @Result(column="mer_label", property="merLabel", jdbcType=JdbcType.VARCHAR),
        @Result(column="list_show", property="listShow", jdbcType=JdbcType.BIT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @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)
    })
    BsMerchant selectByPrimaryKey(Long id);

    @UpdateProvider(type=BsMerchantSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsMerchant record, @Param("example") BsMerchantExample example);

    @UpdateProvider(type=BsMerchantSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsMerchant record, @Param("example") BsMerchantExample example);

    @UpdateProvider(type=BsMerchantSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsMerchant record);

    @Update({
        "update bs_merchant",
        "set source_type = #{sourceType,jdbcType=INTEGER},",
          "province_code = #{provinceCode,jdbcType=BIGINT},",
          "province_name = #{provinceName,jdbcType=VARCHAR},",
          "city_code = #{cityCode,jdbcType=BIGINT},",
          "city_name = #{cityName,jdbcType=VARCHAR},",
          "area_code = #{areaCode,jdbcType=BIGINT},",
          "area_name = #{areaName,jdbcType=VARCHAR},",
          "oil_price_zone_id = #{oilPriceZoneId,jdbcType=INTEGER},",
          "oil_price_zone_name = #{oilPriceZoneName,jdbcType=VARCHAR},",
          "chain_brand_id = #{chainBrandId,jdbcType=BIGINT},",
          "chain_brand_name = #{chainBrandName,jdbcType=VARCHAR},",
          "chain_brand_settle_type = #{chainBrandSettleType,jdbcType=INTEGER},",
          "mer_no = #{merNo,jdbcType=VARCHAR},",
          "mer_logo = #{merLogo,jdbcType=VARCHAR},",
          "mer_name = #{merName,jdbcType=VARCHAR},",
          "contacts_name = #{contactsName,jdbcType=VARCHAR},",
          "contacts_tel = #{contactsTel,jdbcType=VARCHAR},",
          "customer_service_tel = #{customerServiceTel,jdbcType=VARCHAR},",
          "address = #{address,jdbcType=VARCHAR},",
          "longitude = #{longitude,jdbcType=VARCHAR},",
          "latitude = #{latitude,jdbcType=VARCHAR},",
          "mer_label = #{merLabel,jdbcType=VARCHAR},",
          "list_show = #{listShow,jdbcType=BIT},",
          "`status` = #{status,jdbcType=INTEGER},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(BsMerchant record);
}