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

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

import java.util.List;


/**
 * @author nianchang
 * @ClassName OrderCommentDao
 * @date 2021/03/30 3:06 下午
 */
@Repository
public interface OrderCommentDao {

    /**
     * 新增一条记录
     * @param record record
     * @return
     * Date: 2021/5/11 2:16 下午
     */
    int insert(OrderComment record);

    int insertList(List<OrderComment> list);

    void replaceList(List<OrderComment> list);

    OrderComment selectById(@Param("sellerId") Long sellerId, @Param("id") Long id);

    /**
     * 修改
     * @param record record
     * @return
     * Date: 2021/5/11 2:16 下午
     */
    int update(OrderComment record);

    int delete(@Param("list") List<Long> list, @Param("sellerId") Long sellerId);

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

    int updateByOrderNo(@Param("commentScore") Integer commentScore, @Param("orderNo") String orderNo, @Param("sellerId") Long sellerId);

    /**
     * 查询列表
     * @param query query
     * @return
     * Date: 2021/3/30 4:45 下午
     */
    List<OrderComment> selectList(OrderCommentQuery query);

    List<OrderComment> scanList(OrderCommentQuery query);

    /**
     * 查询列表
     * 返回指定字段
     * @param query query
     * @return
     * Date: 2021/3/30 4:45 下午
     */
    List<OrderComment> selectIdList(OrderCommentQuery query);

    /**
     * 查询单条信息
     * @param orderNo 订单号
     * @param sellerId 商家ID
     * @return
     * Date: 2021/4/7 10:54 上午
     */
    OrderComment selectOne(@Param("orderNo") String orderNo, @Param("sellerId") Long sellerId);

    /**
     * 查询单条信息
     * @param orderNo 订单号
     * @param sellerId 商家ID
     * @return
     * Date: 2021/4/7 10:54 上午
     */
    List<OrderComment> selectByOrderNo(@Param("orderNo") String orderNo, @Param("sellerId") Long sellerId);

    int updateStoreId(@Param("storeId") Long storeId, @Param("sellerId") Long sellerId, @Param("orderNo") String orderNo);

    List<OrderComment> selectByOrderNoList(@Param("orderNoList") List<String> orderNoList, @Param("sellerId") Long sellerId);

    int updateBatchToBaking(List<OrderComment> list, Long sellerId);

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