package com.hai.dao;

import com.hai.entity.GoodsOrder;
import com.hai.entity.GoodsOrderExample;
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 GoodsOrderMapper extends GoodsOrderMapperExt {
    @SelectProvider(type=GoodsOrderSqlProvider.class, method="countByExample")
    long countByExample(GoodsOrderExample example);

    @DeleteProvider(type=GoodsOrderSqlProvider.class, method="deleteByExample")
    int deleteByExample(GoodsOrderExample example);

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

    @Insert({
        "insert into goods_order (logistics_no, order_no, ",
        "freight_price, delivery_address_id, ",
        "delivery_address, create_time, ",
        "update_time, op_id, ",
        "op_name, `status`, ",
        "ext_1, ext_2, ext_3)",
        "values (#{logisticsNo,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, ",
        "#{freightPrice,jdbcType=DECIMAL}, #{deliveryAddressId,jdbcType=BIGINT}, ",
        "#{deliveryAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{opId,jdbcType=BIGINT}, ",
        "#{opName,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, ",
        "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})"
    })
    @Options(useGeneratedKeys=true,keyProperty="id")
    int insert(GoodsOrder record);

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

    @SelectProvider(type=GoodsOrderSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="logistics_no", property="logisticsNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="freight_price", property="freightPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="delivery_address_id", property="deliveryAddressId", jdbcType=JdbcType.BIGINT),
        @Result(column="delivery_address", property="deliveryAddress", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
        @Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.VARCHAR),
        @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<GoodsOrder> selectByExample(GoodsOrderExample example);

    @Select({
        "select",
        "id, logistics_no, order_no, freight_price, delivery_address_id, delivery_address, ",
        "create_time, update_time, op_id, op_name, `status`, ext_1, ext_2, ext_3",
        "from goods_order",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="logistics_no", property="logisticsNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="order_no", property="orderNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="freight_price", property="freightPrice", jdbcType=JdbcType.DECIMAL),
        @Result(column="delivery_address_id", property="deliveryAddressId", jdbcType=JdbcType.BIGINT),
        @Result(column="delivery_address", property="deliveryAddress", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT),
        @Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.VARCHAR),
        @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)
    })
    GoodsOrder selectByPrimaryKey(Long id);

    @UpdateProvider(type=GoodsOrderSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") GoodsOrder record, @Param("example") GoodsOrderExample example);

    @UpdateProvider(type=GoodsOrderSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") GoodsOrder record, @Param("example") GoodsOrderExample example);

    @UpdateProvider(type=GoodsOrderSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(GoodsOrder record);

    @Update({
        "update goods_order",
        "set logistics_no = #{logisticsNo,jdbcType=VARCHAR},",
          "order_no = #{orderNo,jdbcType=VARCHAR},",
          "freight_price = #{freightPrice,jdbcType=DECIMAL},",
          "delivery_address_id = #{deliveryAddressId,jdbcType=BIGINT},",
          "delivery_address = #{deliveryAddress,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "op_id = #{opId,jdbcType=BIGINT},",
          "op_name = #{opName,jdbcType=VARCHAR},",
          "`status` = #{status,jdbcType=VARCHAR},",
          "ext_1 = #{ext1,jdbcType=VARCHAR},",
          "ext_2 = #{ext2,jdbcType=VARCHAR},",
          "ext_3 = #{ext3,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(GoodsOrder record);
}