package com.hai.dao;

import com.hai.entity.ApiOrder;
import com.hai.entity.ApiOrderExample;
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 ApiOrderMapper extends ApiOrderMapperExt {
    @SelectProvider(type=ApiOrderSqlProvider.class, method="countByExample")
    long countByExample(ApiOrderExample example);

    @DeleteProvider(type=ApiOrderSqlProvider.class, method="deleteByExample")
    int deleteByExample(ApiOrderExample example);

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

    @Insert({
        "insert into api_order (title, product_type, ",
        "order_no, mch_order_no, ",
        "mch_name, mch_id, ",
        "cost_price, face_price, ",
        "order_price, create_time, ",
        "update_time, notify_url, ",
        "content, remark, ",
        "`status`, whether_exception, ",
        "ext_1, ext_2, ext_3)",
        "values (#{title,jdbcType=VARCHAR}, #{productType,jdbcType=INTEGER}, ",
        "#{orderNo,jdbcType=VARCHAR}, #{mchOrderNo,jdbcType=VARCHAR}, ",
        "#{mchName,jdbcType=VARCHAR}, #{mchId,jdbcType=VARCHAR}, ",
        "#{costPrice,jdbcType=DECIMAL}, #{facePrice,jdbcType=DECIMAL}, ",
        "#{orderPrice,jdbcType=DECIMAL}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{notifyUrl,jdbcType=VARCHAR}, ",
        "#{content,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=INTEGER}, #{whetherException,jdbcType=BIT}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(ApiOrder record);

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

    @SelectProvider(type=ApiOrderSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_type", property="productType", jdbcType=JdbcType.INTEGER),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="mch_order_no", property="mchOrderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="mch_name", property="mchName", jdbcType=JdbcType.VARCHAR),
        @Result(column="mch_id", property="mchId", jdbcType=JdbcType.VARCHAR),
        @Result(column="cost_price", property="costPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="face_price", property="facePrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="order_price", property="orderPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="notify_url", property="notifyUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="whether_exception", property="whetherException", jdbcType=JdbcType.BIT),
        @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<ApiOrder> selectByExample(ApiOrderExample example);

    @Select({
        "select",
        "id, title, product_type, order_no, mch_order_no, mch_name, mch_id, cost_price, ",
        "face_price, order_price, create_time, update_time, notify_url, content, remark, ",
        "`status`, whether_exception, ext_1, ext_2, ext_3",
        "from api_order",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="product_type", property="productType", jdbcType=JdbcType.INTEGER),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="mch_order_no", property="mchOrderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="mch_name", property="mchName", jdbcType=JdbcType.VARCHAR),
        @Result(column="mch_id", property="mchId", jdbcType=JdbcType.VARCHAR),
        @Result(column="cost_price", property="costPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="face_price", property="facePrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="order_price", property="orderPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="notify_url", property="notifyUrl", jdbcType=JdbcType.VARCHAR),
        @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="whether_exception", property="whetherException", jdbcType=JdbcType.BIT),
        @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)
    })
    ApiOrder selectByPrimaryKey(Long id);

    @UpdateProvider(type=ApiOrderSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") ApiOrder record, @Param("example") ApiOrderExample example);

    @UpdateProvider(type=ApiOrderSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") ApiOrder record, @Param("example") ApiOrderExample example);

    @UpdateProvider(type=ApiOrderSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(ApiOrder record);

    @Update({
        "update api_order",
        "set title = #{title,jdbcType=VARCHAR},",
          "product_type = #{productType,jdbcType=INTEGER},",
          "order_no = #{orderNo,jdbcType=VARCHAR},",
          "mch_order_no = #{mchOrderNo,jdbcType=VARCHAR},",
          "mch_name = #{mchName,jdbcType=VARCHAR},",
          "mch_id = #{mchId,jdbcType=VARCHAR},",
          "cost_price = #{costPrice,jdbcType=DECIMAL},",
          "face_price = #{facePrice,jdbcType=DECIMAL},",
          "order_price = #{orderPrice,jdbcType=DECIMAL},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "notify_url = #{notifyUrl,jdbcType=VARCHAR},",
          "content = #{content,jdbcType=VARCHAR},",
          "remark = #{remark,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=INTEGER},",
          "whether_exception = #{whetherException,jdbcType=BIT},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(ApiOrder record);
}