package com.zm.order.tool.server.dao;

import com.zm.order.tool.server.model.OrderExtends;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * @author zhuxiaofeng
 */
@Repository
public interface OrderExtendsDao {

    /**
     * 插入
     *
     * @param record
     * @return
     */
    int insert(OrderExtends record);

    int insertList(List<OrderExtends> list);

    OrderExtends selectOne(@Param("id") Long id, @Param("userId") Long userId);

    /**
     * 根据订单号查询
     *
     * @param orderNo
     * @param userId
     * @return
     */
    OrderExtends selectByOrderNo(@Param("orderNo") String orderNo,
                                 @Param("userId") Long userId);

    /**
     * 删除数据
     *
     * @param id
     * @param userId
     * @param deleteType
     * @return
     */
    int delete(@Param("id") Long id,
               @Param("userId") Long userId,
               @Param("deleteType") Integer deleteType);

    int updateUpdatedAt(@Param("id") Long id, @Param("userId") Long userId);

    int updateSellerUser(
            @Param("oldUserId") Long oldUserId,
            @Param("newUserId") Long newUserId,
            @Param("orderNo") String orderNo);

    int deleteByOrderNo(@Param("orderNo") String orderNo, @Param("userId") Long userId);

}