package com.hfkj.dao;

import com.hfkj.entity.BsStoreDiscountActivity;
import com.hfkj.entity.BsStoreDiscountActivityExample;
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 BsStoreDiscountActivityMapper extends BsStoreDiscountActivityMapperExt {
    @SelectProvider(type=BsStoreDiscountActivitySqlProvider.class, method="countByExample")
    long countByExample(BsStoreDiscountActivityExample example);

    @DeleteProvider(type=BsStoreDiscountActivitySqlProvider.class, method="deleteByExample")
    int deleteByExample(BsStoreDiscountActivityExample example);

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

    @Insert({
        "insert into bs_store_discount_activity (partake_way, company_id, ",
        "company_name, agent_id, ",
        "agent_name, salesman_id, ",
        "salesman_name, mer_id, ",
        "mer_name, store_id, ",
        "store_no, store_name, ",
        "store_tel, `name`, ",
        "discount_type, discount_condition, ",
        "discount_price, final_cost_price, ",
        "start_time, end_time, ",
        "restrict_type, restrict_partake_num, ",
        "`status`, operator_id, ",
        "operator_name, create_time, ",
        "update_time, ext_1, ",
        "ext_2, ext_3)",
        "values (#{partakeWay,jdbcType=INTEGER}, #{companyId,jdbcType=BIGINT}, ",
        "#{companyName,jdbcType=VARCHAR}, #{agentId,jdbcType=BIGINT}, ",
        "#{agentName,jdbcType=VARCHAR}, #{salesmanId,jdbcType=BIGINT}, ",
        "#{salesmanName,jdbcType=VARCHAR}, #{merId,jdbcType=BIGINT}, ",
        "#{merName,jdbcType=VARCHAR}, #{storeId,jdbcType=BIGINT}, ",
        "#{storeNo,jdbcType=BIGINT}, #{storeName,jdbcType=VARCHAR}, ",
        "#{storeTel,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
        "#{discountType,jdbcType=INTEGER}, #{discountCondition,jdbcType=DECIMAL}, ",
        "#{discountPrice,jdbcType=DECIMAL}, #{finalCostPrice,jdbcType=DECIMAL}, ",
        "#{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, ",
        "#{restrictType,jdbcType=INTEGER}, #{restrictPartakeNum,jdbcType=INTEGER}, ",
        "#{status,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ",
        "#{operatorName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(BsStoreDiscountActivity record);

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

    @SelectProvider(type=BsStoreDiscountActivitySqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="partake_way", property="partakeWay", jdbcType=JdbcType.INTEGER),
        @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
        @Result(column="company_name", property="companyName", jdbcType=JdbcType.VARCHAR),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
        @Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="salesman_id", property="salesmanId", jdbcType=JdbcType.BIGINT),
        @Result(column="salesman_name", property="salesmanName", jdbcType=JdbcType.VARCHAR),
        @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
        @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
        @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_no", property="storeNo", jdbcType=JdbcType.BIGINT),
        @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="store_tel", property="storeTel", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
        @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="final_cost_price", property="finalCostPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="restrict_type", property="restrictType", jdbcType=JdbcType.INTEGER),
        @Result(column="restrict_partake_num", property="restrictPartakeNum", jdbcType=JdbcType.INTEGER),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
        @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<BsStoreDiscountActivity> selectByExample(BsStoreDiscountActivityExample example);

    @Select({
        "select",
        "id, partake_way, company_id, company_name, agent_id, agent_name, salesman_id, ",
        "salesman_name, mer_id, mer_name, store_id, store_no, store_name, store_tel, ",
        "`name`, discount_type, discount_condition, discount_price, final_cost_price, ",
        "start_time, end_time, restrict_type, restrict_partake_num, `status`, operator_id, ",
        "operator_name, create_time, update_time, ext_1, ext_2, ext_3",
        "from bs_store_discount_activity",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="partake_way", property="partakeWay", jdbcType=JdbcType.INTEGER),
        @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT),
        @Result(column="company_name", property="companyName", jdbcType=JdbcType.VARCHAR),
        @Result(column="agent_id", property="agentId", jdbcType=JdbcType.BIGINT),
        @Result(column="agent_name", property="agentName", jdbcType=JdbcType.VARCHAR),
        @Result(column="salesman_id", property="salesmanId", jdbcType=JdbcType.BIGINT),
        @Result(column="salesman_name", property="salesmanName", jdbcType=JdbcType.VARCHAR),
        @Result(column="mer_id", property="merId", jdbcType=JdbcType.BIGINT),
        @Result(column="mer_name", property="merName", jdbcType=JdbcType.VARCHAR),
        @Result(column="store_id", property="storeId", jdbcType=JdbcType.BIGINT),
        @Result(column="store_no", property="storeNo", jdbcType=JdbcType.BIGINT),
        @Result(column="store_name", property="storeName", jdbcType=JdbcType.VARCHAR),
        @Result(column="store_tel", property="storeTel", jdbcType=JdbcType.VARCHAR),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="discount_type", property="discountType", jdbcType=JdbcType.INTEGER),
        @Result(column="discount_condition", property="discountCondition", jdbcType=JdbcType.DECIMAL),
        @Result(column="discount_price", property="discountPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="final_cost_price", property="finalCostPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="restrict_type", property="restrictType", jdbcType=JdbcType.INTEGER),
        @Result(column="restrict_partake_num", property="restrictPartakeNum", jdbcType=JdbcType.INTEGER),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="operator_id", property="operatorId", jdbcType=JdbcType.BIGINT),
        @Result(column="operator_name", property="operatorName", jdbcType=JdbcType.VARCHAR),
        @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)
    })
    BsStoreDiscountActivity selectByPrimaryKey(Long id);

    @UpdateProvider(type=BsStoreDiscountActivitySqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsStoreDiscountActivity record, @Param("example") BsStoreDiscountActivityExample example);

    @UpdateProvider(type=BsStoreDiscountActivitySqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsStoreDiscountActivity record, @Param("example") BsStoreDiscountActivityExample example);

    @UpdateProvider(type=BsStoreDiscountActivitySqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsStoreDiscountActivity record);

    @Update({
        "update bs_store_discount_activity",
        "set partake_way = #{partakeWay,jdbcType=INTEGER},",
          "company_id = #{companyId,jdbcType=BIGINT},",
          "company_name = #{companyName,jdbcType=VARCHAR},",
          "agent_id = #{agentId,jdbcType=BIGINT},",
          "agent_name = #{agentName,jdbcType=VARCHAR},",
          "salesman_id = #{salesmanId,jdbcType=BIGINT},",
          "salesman_name = #{salesmanName,jdbcType=VARCHAR},",
          "mer_id = #{merId,jdbcType=BIGINT},",
          "mer_name = #{merName,jdbcType=VARCHAR},",
          "store_id = #{storeId,jdbcType=BIGINT},",
          "store_no = #{storeNo,jdbcType=BIGINT},",
          "store_name = #{storeName,jdbcType=VARCHAR},",
          "store_tel = #{storeTel,jdbcType=VARCHAR},",
          "`name` = #{name,jdbcType=VARCHAR},",
          "discount_type = #{discountType,jdbcType=INTEGER},",
          "discount_condition = #{discountCondition,jdbcType=DECIMAL},",
          "discount_price = #{discountPrice,jdbcType=DECIMAL},",
          "final_cost_price = #{finalCostPrice,jdbcType=DECIMAL},",
          "start_time = #{startTime,jdbcType=TIMESTAMP},",
          "end_time = #{endTime,jdbcType=TIMESTAMP},",
          "restrict_type = #{restrictType,jdbcType=INTEGER},",
          "restrict_partake_num = #{restrictPartakeNum,jdbcType=INTEGER},",
          "`status` = #{status,jdbcType=INTEGER},",
          "operator_id = #{operatorId,jdbcType=BIGINT},",
          "operator_name = #{operatorName,jdbcType=VARCHAR},",
          "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(BsStoreDiscountActivity record);
}