package com.hfkj.dao;

import com.hfkj.entity.BsDevicePrice;
import com.hfkj.entity.BsDevicePriceExample;
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 BsDevicePriceMapper extends BsDevicePriceMapperExt {
    @SelectProvider(type=BsDevicePriceSqlProvider.class, method="countByExample")
    long countByExample(BsDevicePriceExample example);

    @DeleteProvider(type=BsDevicePriceSqlProvider.class, method="deleteByExample")
    int deleteByExample(BsDevicePriceExample example);

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

    @Insert({
        "insert into bs_device_price (device_type, price_type, ",
        "price, ext_1, ext_2, ",
        "ext_3)",
        "values (#{deviceType,jdbcType=INTEGER}, #{priceType,jdbcType=INTEGER}, ",
        "#{price,jdbcType=DECIMAL}, #{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, ",
        "#{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(BsDevicePrice record);

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

    @SelectProvider(type=BsDevicePriceSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="device_type", property="deviceType", jdbcType=JdbcType.INTEGER),
        @Result(column="price_type", property="priceType", jdbcType=JdbcType.INTEGER),
        @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL),
        @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<BsDevicePrice> selectByExample(BsDevicePriceExample example);

    @Select({
        "select",
        "id, device_type, price_type, price, ext_1, ext_2, ext_3",
        "from bs_device_price",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="device_type", property="deviceType", jdbcType=JdbcType.INTEGER),
        @Result(column="price_type", property="priceType", jdbcType=JdbcType.INTEGER),
        @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL),
        @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)
    })
    BsDevicePrice selectByPrimaryKey(Long id);

    @UpdateProvider(type=BsDevicePriceSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsDevicePrice record, @Param("example") BsDevicePriceExample example);

    @UpdateProvider(type=BsDevicePriceSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsDevicePrice record, @Param("example") BsDevicePriceExample example);

    @UpdateProvider(type=BsDevicePriceSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsDevicePrice record);

    @Update({
        "update bs_device_price",
        "set device_type = #{deviceType,jdbcType=INTEGER},",
          "price_type = #{priceType,jdbcType=INTEGER},",
          "price = #{price,jdbcType=DECIMAL},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(BsDevicePrice record);
}