package com.hfkj.dao;

import com.hfkj.entity.BsStoreDiscountActivityPartakeUser;
import com.hfkj.entity.BsStoreDiscountActivityPartakeUserExample;
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 BsStoreDiscountActivityPartakeUserMapper extends BsStoreDiscountActivityPartakeUserMapperExt {
    @SelectProvider(type=BsStoreDiscountActivityPartakeUserSqlProvider.class, method="countByExample")
    long countByExample(BsStoreDiscountActivityPartakeUserExample example);

    @DeleteProvider(type=BsStoreDiscountActivityPartakeUserSqlProvider.class, method="deleteByExample")
    int deleteByExample(BsStoreDiscountActivityPartakeUserExample example);

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

    @Insert({
        "insert into bs_store_discount_activity_partake_user (discount_activity_id, discount_activity_name, ",
        "discount_type, discount_condition, ",
        "discount_price, start_time, ",
        "end_time, user_phone, ",
        "partake_total_num, partake_surplus_num, ",
        "partake_use_num, `status`, ",
        "create_time, update_time, ",
        "ext_1, ext_2, ext_3)",
        "values (#{discountActivityId,jdbcType=BIGINT}, #{discountActivityName,jdbcType=VARCHAR}, ",
        "#{discountType,jdbcType=INTEGER}, #{discountCondition,jdbcType=DECIMAL}, ",
        "#{discountPrice,jdbcType=DECIMAL}, #{startTime,jdbcType=TIMESTAMP}, ",
        "#{endTime,jdbcType=TIMESTAMP}, #{userPhone,jdbcType=VARCHAR}, ",
        "#{partakeTotalNum,jdbcType=INTEGER}, #{partakeSurplusNum,jdbcType=INTEGER}, ",
        "#{partakeUseNum,jdbcType=INTEGER}, #{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(BsStoreDiscountActivityPartakeUser record);

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

    @SelectProvider(type=BsStoreDiscountActivityPartakeUserSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="discount_activity_id", property="discountActivityId", jdbcType=JdbcType.BIGINT),
        @Result(column="discount_activity_name", property="discountActivityName", 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="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="partake_total_num", property="partakeTotalNum", jdbcType=JdbcType.INTEGER),
        @Result(column="partake_surplus_num", property="partakeSurplusNum", jdbcType=JdbcType.INTEGER),
        @Result(column="partake_use_num", property="partakeUseNum", jdbcType=JdbcType.INTEGER),
        @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<BsStoreDiscountActivityPartakeUser> selectByExample(BsStoreDiscountActivityPartakeUserExample example);

    @Select({
        "select",
        "id, discount_activity_id, discount_activity_name, discount_type, discount_condition, ",
        "discount_price, start_time, end_time, user_phone, partake_total_num, partake_surplus_num, ",
        "partake_use_num, `status`, create_time, update_time, ext_1, ext_2, ext_3",
        "from bs_store_discount_activity_partake_user",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="discount_activity_id", property="discountActivityId", jdbcType=JdbcType.BIGINT),
        @Result(column="discount_activity_name", property="discountActivityName", 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="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="user_phone", property="userPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="partake_total_num", property="partakeTotalNum", jdbcType=JdbcType.INTEGER),
        @Result(column="partake_surplus_num", property="partakeSurplusNum", jdbcType=JdbcType.INTEGER),
        @Result(column="partake_use_num", property="partakeUseNum", jdbcType=JdbcType.INTEGER),
        @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)
    })
    BsStoreDiscountActivityPartakeUser selectByPrimaryKey(Long id);

    @UpdateProvider(type=BsStoreDiscountActivityPartakeUserSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsStoreDiscountActivityPartakeUser record, @Param("example") BsStoreDiscountActivityPartakeUserExample example);

    @UpdateProvider(type=BsStoreDiscountActivityPartakeUserSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsStoreDiscountActivityPartakeUser record, @Param("example") BsStoreDiscountActivityPartakeUserExample example);

    @UpdateProvider(type=BsStoreDiscountActivityPartakeUserSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsStoreDiscountActivityPartakeUser record);

    @Update({
        "update bs_store_discount_activity_partake_user",
        "set discount_activity_id = #{discountActivityId,jdbcType=BIGINT},",
          "discount_activity_name = #{discountActivityName,jdbcType=VARCHAR},",
          "discount_type = #{discountType,jdbcType=INTEGER},",
          "discount_condition = #{discountCondition,jdbcType=DECIMAL},",
          "discount_price = #{discountPrice,jdbcType=DECIMAL},",
          "start_time = #{startTime,jdbcType=TIMESTAMP},",
          "end_time = #{endTime,jdbcType=TIMESTAMP},",
          "user_phone = #{userPhone,jdbcType=VARCHAR},",
          "partake_total_num = #{partakeTotalNum,jdbcType=INTEGER},",
          "partake_surplus_num = #{partakeSurplusNum,jdbcType=INTEGER},",
          "partake_use_num = #{partakeUseNum,jdbcType=INTEGER},",
          "`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(BsStoreDiscountActivityPartakeUser record);
}