package com.ankaibei.workFlow.webadmin.ankaibei.api;

import com.ankaibei.workFlow.webadmin.ankaibei.entity.ManHourInfoEntity;
import com.ankaibei.workFlow.webadmin.ankaibei.entity.ManHourJobInfo;
import com.ankaibei.workFlow.webadmin.ankaibei.service.ManHourService;
import com.ankaibei.workFlow.webadmin.ankaibei.vo.ManHourInfoVo;
import com.ankaibei.workFlow.webadmin.ankaibei.vo.ResMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lwq
 * @version 1.0
 * @description:
 * @date 2022/9/21 15:31
 */
@Service
public class ManHourServiceApi implements ManHourInfoApi {

    @Autowired
    private ManHourService manHourService;

    @Override
    public ResMsg findManHourAll(ManHourInfoVo manHourInfoVo) {
        ManHourInfoEntity manHourInfoEntity = this.copyProperties(manHourInfoVo, ManHourInfoEntity.class);
        return manHourService.findManHourAll(manHourInfoVo.getPageIndex(), manHourInfoVo.getPageSize(), manHourInfoEntity);
    }

    @Override
    public ResMsg addManHour(ManHourInfoVo manHourInfoVo) {
        ManHourInfoEntity manHourInfoEntity = this.copyProperties(manHourInfoVo, ManHourInfoEntity.class);
        List<ManHourJobInfo> manHours = manHourInfoVo.getManHours();
        return manHourService.addManHour(manHourInfoVo.getProjectId(), manHourInfoEntity, manHours);
    }

    @Override
    public ResMsg deleteManHour(List<ManHourInfoVo> manHourInfoVos) {
        return manHourService.deleteManHour(manHourInfoVos);
    }


}
