package com.ycwl.basic.service.pc.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ycwl.basic.mapper.BrokerRecordMapper;
import com.ycwl.basic.model.pc.broker.entity.BrokerRecord;
import com.ycwl.basic.model.pc.broker.req.BrokerRecordReqQuery;
import com.ycwl.basic.model.pc.broker.resp.BrokerRecordRespVO;
import com.ycwl.basic.model.pc.broker.resp.DailySummaryRespVO;
import com.ycwl.basic.service.pc.BrokerRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author：longbinbin
 * @Date：2024/12/12 10:00
 */
@Service
public class BrokerRecordServiceImpl implements BrokerRecordService {
    @Autowired
    private BrokerRecordMapper brokerRecordMapper;

    @Override
    public PageInfo<BrokerRecordRespVO> pageQuery(BrokerRecordReqQuery brokerRecordReqQuery) {
        PageHelper.startPage(brokerRecordReqQuery.getPageNum(), brokerRecordReqQuery.getPageSize());
        List<BrokerRecordRespVO> list = brokerRecordMapper.list(brokerRecordReqQuery);
        PageInfo<BrokerRecordRespVO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<BrokerRecordRespVO> list(BrokerRecordReqQuery brokerRecordReqQuery) {
        return brokerRecordMapper.list(brokerRecordReqQuery);
    }

    @Override
    public BrokerRecordRespVO getById(Long id) {
        return brokerRecordMapper.getById(id);
    }

    @Override
    public int add(BrokerRecord brokerRecord) {
        return brokerRecordMapper.add(brokerRecord);
    }

    @Override
    public int delete(Long id) {
        return brokerRecordMapper.deleteById(id);
    }

    @Override
    public int update(BrokerRecord brokerRecord) {
        return brokerRecordMapper.update(brokerRecord);
    }

    @Override
    public List<DailySummaryRespVO> getDailySummaryByBrokerId(Long brokerId, Date startTime, Date endTime) {
        return brokerRecordMapper.getDailySummaryByBrokerId(brokerId, startTime, endTime);
    }

}