package com.hai.dao;

import com.hai.entity.ApiMemberProduct;
import com.hai.entity.ApiMemberProductExample;
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 ApiMemberProductMapper extends ApiMemberProductMapperExt {
    @SelectProvider(type=ApiMemberProductSqlProvider.class, method="countByExample")
    long countByExample(ApiMemberProductExample example);

    @DeleteProvider(type=ApiMemberProductSqlProvider.class, method="deleteByExample")
    int deleteByExample(ApiMemberProductExample example);

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

    @Insert({
        "insert into api_member_product (`name`, type_id, ",
        "brand_id, price, ",
        "cost_price, product_id, ",
        "sort, operator_id, ",
        "operator_name, create_time, ",
        "update_time, `status`, ",
        "ext_1, ext_2, ext_3)",
        "values (#{name,jdbcType=VARCHAR}, #{typeId,jdbcType=INTEGER}, ",
        "#{brandId,jdbcType=INTEGER}, #{price,jdbcType=DECIMAL}, ",
        "#{costPrice,jdbcType=DECIMAL}, #{productId,jdbcType=VARCHAR}, ",
        "#{sort,jdbcType=INTEGER}, #{operatorId,jdbcType=BIGINT}, ",
        "#{operatorName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(ApiMemberProduct record);

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

    @SelectProvider(type=ApiMemberProductSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="type_id", property="typeId", jdbcType=JdbcType.INTEGER),
        @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER),
        @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL),
        @Result(column="cost_price", property="costPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.VARCHAR),
        @Result(column="sort", property="sort", 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="status", property="status", jdbcType=JdbcType.INTEGER),
        @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<ApiMemberProduct> selectByExample(ApiMemberProductExample example);

    @Select({
        "select",
        "id, `name`, type_id, brand_id, price, cost_price, product_id, sort, operator_id, ",
        "operator_name, create_time, update_time, `status`, ext_1, ext_2, ext_3",
        "from api_member_product",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
        @Result(column="type_id", property="typeId", jdbcType=JdbcType.INTEGER),
        @Result(column="brand_id", property="brandId", jdbcType=JdbcType.INTEGER),
        @Result(column="price", property="price", jdbcType=JdbcType.DECIMAL),
        @Result(column="cost_price", property="costPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="product_id", property="productId", jdbcType=JdbcType.VARCHAR),
        @Result(column="sort", property="sort", 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="status", property="status", jdbcType=JdbcType.INTEGER),
        @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)
    })
    ApiMemberProduct selectByPrimaryKey(Long id);

    @UpdateProvider(type=ApiMemberProductSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ApiMemberProduct record, @Param("example") ApiMemberProductExample example);

    @UpdateProvider(type=ApiMemberProductSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ApiMemberProduct record, @Param("example") ApiMemberProductExample example);

    @UpdateProvider(type=ApiMemberProductSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ApiMemberProduct record);

    @Update({
        "update api_member_product",
        "set `name` = #{name,jdbcType=VARCHAR},",
          "type_id = #{typeId,jdbcType=INTEGER},",
          "brand_id = #{brandId,jdbcType=INTEGER},",
          "price = #{price,jdbcType=DECIMAL},",
          "cost_price = #{costPrice,jdbcType=DECIMAL},",
          "product_id = #{productId,jdbcType=VARCHAR},",
          "sort = #{sort,jdbcType=INTEGER},",
          "operator_id = #{operatorId,jdbcType=BIGINT},",
          "operator_name = #{operatorName,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "`status` = #{status,jdbcType=INTEGER},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(ApiMemberProduct record);
}