package com.hfkj.dao;

import com.hfkj.entity.BsDiscountUserGiveRecord;
import com.hfkj.entity.BsDiscountUserGiveRecordExample;
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 BsDiscountUserGiveRecordMapper extends BsDiscountUserGiveRecordMapperExt {
    @SelectProvider(type=BsDiscountUserGiveRecordSqlProvider.class, method="countByExample")
    long countByExample(BsDiscountUserGiveRecordExample example);

    @DeleteProvider(type=BsDiscountUserGiveRecordSqlProvider.class, method="deleteByExample")
    int deleteByExample(BsDiscountUserGiveRecordExample example);

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

    @Insert({
        "insert into bs_discount_user_give_record (discount_user_id, discount_stock_code, ",
        "send_user_id, send_user_phone, ",
        "receive_user_id, receive_user_phone, ",
        "create_time, ext_1, ",
        "ext_2, ext_3)",
        "values (#{discountUserId,jdbcType=BIGINT}, #{discountStockCode,jdbcType=BIGINT}, ",
        "#{sendUserId,jdbcType=BIGINT}, #{sendUserPhone,jdbcType=VARCHAR}, ",
        "#{receiveUserId,jdbcType=BIGINT}, #{receiveUserPhone,jdbcType=VARCHAR}, ",
        "#{createTime,jdbcType=TIMESTAMP}, #{ext1,jdbcType=VARCHAR}, ",
        "#{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(BsDiscountUserGiveRecord record);

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

    @SelectProvider(type=BsDiscountUserGiveRecordSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="discount_user_id", property="discountUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="discount_stock_code", property="discountStockCode", jdbcType=JdbcType.BIGINT),
        @Result(column="send_user_id", property="sendUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="send_user_phone", property="sendUserPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="receive_user_id", property="receiveUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="receive_user_phone", property="receiveUserPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", 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<BsDiscountUserGiveRecord> selectByExample(BsDiscountUserGiveRecordExample example);

    @Select({
        "select",
        "id, discount_user_id, discount_stock_code, send_user_id, send_user_phone, receive_user_id, ",
        "receive_user_phone, create_time, ext_1, ext_2, ext_3",
        "from bs_discount_user_give_record",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="discount_user_id", property="discountUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="discount_stock_code", property="discountStockCode", jdbcType=JdbcType.BIGINT),
        @Result(column="send_user_id", property="sendUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="send_user_phone", property="sendUserPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="receive_user_id", property="receiveUserId", jdbcType=JdbcType.BIGINT),
        @Result(column="receive_user_phone", property="receiveUserPhone", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", 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)
    })
    BsDiscountUserGiveRecord selectByPrimaryKey(Long id);

    @UpdateProvider(type=BsDiscountUserGiveRecordSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") BsDiscountUserGiveRecord record, @Param("example") BsDiscountUserGiveRecordExample example);

    @UpdateProvider(type=BsDiscountUserGiveRecordSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") BsDiscountUserGiveRecord record, @Param("example") BsDiscountUserGiveRecordExample example);

    @UpdateProvider(type=BsDiscountUserGiveRecordSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(BsDiscountUserGiveRecord record);

    @Update({
        "update bs_discount_user_give_record",
        "set discount_user_id = #{discountUserId,jdbcType=BIGINT},",
          "discount_stock_code = #{discountStockCode,jdbcType=BIGINT},",
          "send_user_id = #{sendUserId,jdbcType=BIGINT},",
          "send_user_phone = #{sendUserPhone,jdbcType=VARCHAR},",
          "receive_user_id = #{receiveUserId,jdbcType=BIGINT},",
          "receive_user_phone = #{receiveUserPhone,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(BsDiscountUserGiveRecord record);
}