/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.sg.managementcenter.project.service;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.sg.managementcenter.project.entity.CapitalPlan;
import com.jeeplus.modules.sg.managementcenter.project.entity.PickingRequisition;
import com.jeeplus.modules.sg.managementcenter.project.entity.Project;
import com.jeeplus.modules.sg.managementcenter.project.entity.Project1;
import com.jeeplus.modules.sg.managementcenter.project.mapper.CapitalPlanMapper;
import com.jeeplus.modules.sg.managementcenter.project.mapper.PickingRequisitionMapper;
import com.jeeplus.modules.sg.managementcenter.project.mapper.ProjectMapper;
import com.jeeplus.modules.sg.picking.activiti.entity.Acquisition;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 资金计划管理
 */
@Service
@Transactional(readOnly = true)
public class CapitalPlanService extends CrudService<CapitalPlanMapper, CapitalPlan> {
    @Autowired
    private CapitalPlanMapper capitalPlanMapper;

    @Autowired
    private ProjectMapper projectMapper;

    public List<String> allProjectId() {
        return projectMapper.allProjectId();
    }

    public List<String> findPlanProjectId() {
        return capitalPlanMapper.findPlanProjectId();
    }

    @Transactional(readOnly = false)
    public void insertList(List<CapitalPlan> capitalPlanList) {
        for (CapitalPlan p : capitalPlanList) {
            p.preInsert();
        }
        capitalPlanMapper.insertList(capitalPlanList);
    }

    @Transactional(readOnly = false)
    public void updateList(List<CapitalPlan> capitalPlanList) {
        capitalPlanMapper.updateList(capitalPlanList);
    }

    @Transactional(readOnly = false)
    public void saveEdit(CapitalPlan capitalPlan) {
        capitalPlanMapper.saveEdit(capitalPlan);
    }
}