package com.goafanti.common.dao;

import com.goafanti.common.model.TOrderBillNew;
import com.goafanti.common.model.TOrderNew;
import com.goafanti.order.bo.*;
import com.goafanti.order.bo.outStatistics.OutOrderSalesSourceAmount;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

public interface TOrderNewMapper {
    int deleteByPrimaryKey(String orderNo);

    int insert(TOrderNew record);

    int insertSelective(TOrderNew record);

    TOrderNew selectByPrimaryKey(String orderNo);

    int updateByPrimaryKeySelective(TOrderNew record);

    int updateByPrimaryKey(TOrderNew record);

    TOrderNewBo getOrderNewDetail(String orderNo);
    int getCountByIdAndStatus(TOrderNew orderNew);

    /**
     * 获取订单信息
     * @param ono
     * @return orderNo ,  salesmanId,salesmanName, contractNo,email , userName, orderDep,
     *          departmentName financeId（此财务编号为订单部门财务负责人）
     */
    TOrderNewBo getSaleIdByOno(String ono);

    TOrderNewBo agreeEmailData(Integer fid);

    OrderRefundDetailBo orderRefundDetail(String id);

    int updateFinance(@Param("aid")String aid, @Param("orderNos") List<String> orderNos, @Param("newFinance")String newFinance);
    int checkContractNo(String sno);
    Map<String, Object> countTotalAndActually(@Param("o") OrderListBo o, @Param("fids") List<String> fids, @Param("deps")List<String> listDep);
    TOrderBillNew getLastPayment(String orderNo);
    int updateSalesmanId(@Param("aid")String aid, @Param("transferId")String transferId);
    List<TOrderNewBo> selectUsedOrderByOrder(String orderNo);
    void updaterefund(TOrderNew o);

    List<BigDecimal> selectByUidAndNewUser(@Param("uid")String uid,@Param("aid")String aid, @Param("newUser")Integer newUser, @Param("date") Date date, @Param("now")Date now);

    List<OutStatisticsList> statisticsList(InputStatistics in);

    List<OutProvinceStatisticsList> provinceStatisticsList(InputStatistics in);

    List<Map<String, Object>> selectOrderByuid(String uid);

    List<OutOrderSalesSource> orderSalesSource(InputOrderSalesSource in);

    List<OutOrderSalesSourceAmount> orderSalesSourceAmount(InputOrderSalesSource in);

    TOrderNew  checkOrderProcessStatus(Integer tid);

    List<TOrderNew> selectgetAll();

    /**
     * 获取订单审核人列表
     * @param orderNo
     * @return
     */
    OrderProcessName getProcessName(String orderNo);


    void updateExamineById(@Param("id") String id,@Param("type")Integer type);




    List<TOrderNewBo> selectByuidandAid(@Param("uid")String uid,@Param("aid") String aid);

    List<StatisOrderList>  statisticsOrderList(InputStatistics in);
}
