package com.unis.base.server.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.unis.base.common.vo.*;
import com.unis.base.server.domain.PersonMeetingDomain;
import com.unis.base.server.service.PersonMeetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

@Service
public class PersonMeetingServiceImpl implements PersonMeetingService {
    @Autowired
    private PersonMeetingDomain personMeetingDomain;

    /* @Override
     public void saveMeeting(PersonMeetingVO personMeetingVO) {
         personMeetingDomain.saveMeeting(personMeetingVO);
     }
 */
    @Override
    public PageInfo<TrainVO> pageMeeting(Integer pageNum, Integer pageSize, String trainName, String status, String trainPersonDeptCode) {
        return personMeetingDomain.pageMeeting(pageNum, pageSize, trainName, status, trainPersonDeptCode);
    }

   /* @Override
    public List<PersonMeetingVO> selectMeeting(String meetingName) {
        return  personMeetingDomain.selectMeeting(meetingName);
    }*/

    @Override
    public List<MeetingRecordVO> meetingRecodrd(PageRecordSVO recordVO) {
        return personMeetingDomain.meetingRecodrd(recordVO);
    }

    @Override
    public PageInfo<ResultRecodrdVO> meetingResultRecodrd(PageResultRecodrdVO resultRecodrdVO) {
        return personMeetingDomain.meetingResultRecodrd(resultRecodrdVO);
    }

    @Override
    public PageInfo<InsertRecordVO> PersonmeetingRecodrd(MeetingRecodrdVO meetingRecodrdVO) {
        return personMeetingDomain.PersonmeetingRecodrd(meetingRecodrdVO);
    }

    @Override
    public void SavePersonmeetingRecodrd(InRecordVO inRecordVO) {
        personMeetingDomain.SavePersonmeetingRecodrd(inRecordVO);
    }

    @Override
    public PageInfo CountPersonmeetingRecodrd(CountPersonmeetingVO countPersonmeetingVO) {
        return personMeetingDomain.selectCountPerson(countPersonmeetingVO);
    }

    @Override
    public List<MeetingRecordVO> meetingDetialRecodrd(TrainDetialVO trainDetialVO) {
        return personMeetingDomain.meetingDetialRecodrd(trainDetialVO);
    }

    @Override
    public void inmeetingDetialRecodrd(SaveRecordVO saveRecordVO) {
        personMeetingDomain.inmeetingDetialRecodrd(saveRecordVO);
    }

    @Override
    public List<MeetingRecordVO> sentPersonmeetingRecodrd(String fid) {
        return personMeetingDomain.sentPersonmeetingRecodrd(fid);
    }

    @Override
    public void delPersonmeetingRecodrd(InsertRecordVO insertRecordVO) {
        personMeetingDomain.delPersonmeetingRecodrd(insertRecordVO);
    }

    @Override
    public List<MainRecordVO> commeetingDetialRecodrd(String fid) {
        return personMeetingDomain.commeetingDetialRecodrd(fid);
    }

    @Override
    public void deletmeetingDetialRecodrd(DelGetRecordVO getRecordVO) {
        personMeetingDomain.deletmeetingDetialRecodrd(getRecordVO);
    }

    @Override
    public PageInfo<TrainMainVo> pageInfoForPx(TrainMainQueryVo viewObj, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<TrainMainVo> list = personMeetingDomain.pageInfoForPx(viewObj);
        if (list!=null && list.size()>0){
            for (TrainMainVo trainMainVo : list) {
                int count = personMeetingDomain.countContent(trainMainVo.getFid());
                trainMainVo.setPersons(String.valueOf(count));
            }
        }
        PageInfo<TrainMainVo> pageInfoVO = new PageInfo<>(list);
        return pageInfoVO;
    }
}
