package com.mortals.xhx.module.project.service.impl;
import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.module.project.model.ProjectEntity;
import com.mortals.xhx.module.project.service.ProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.project.dao.ProjectStudyDao;
import com.mortals.xhx.module.project.model.ProjectStudyEntity;
import com.mortals.xhx.module.project.service.ProjectStudyService;

import java.util.List;

/**
* ProjectStudyService
* 项目学习人员 service实现
*
* @author zxfei
* @date 2023-02-23
*/
@Service("projectStudyService")
public class ProjectStudyServiceImpl extends AbstractCRUDServiceImpl<ProjectStudyDao, ProjectStudyEntity, Long> implements ProjectStudyService {

    @Autowired
    private ProjectService projectService;

    @Override
    protected void findAfter(ProjectStudyEntity params, PageInfo pageInfo, Context context, List<ProjectStudyEntity> list) throws AppException {
        super.findAfter(params, pageInfo, context, list);
        list.stream().forEach(item->{
            ProjectEntity projectEntity = projectService.get(item.getProjectId());
            item.setProjectStartTime(projectEntity.getProjectStartTime());
            item.setProjectEndTime(projectEntity.getProjectEndTime());
        });

    }
}