package com.admin.major.service.impl;

import java.util.List;
import com.admin.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.admin.common.utils.SecurityUtils;
import com.admin.common.utils.uuid.IdUtils;
import com.admin.major.mapper.MajorApplyMapper;
import com.admin.major.domain.MajorApply;
import com.admin.major.service.IMajorApplyService;

/**
 * 专业分流申请Service业务层处理
 *
 * @author zewei
 * @date 2022-03-28
 */
@Service
public class MajorApplyServiceImpl implements IMajorApplyService
{
    @Autowired
    private MajorApplyMapper majorApplyMapper;

    /**
     * 查询专业分流申请
     *
     * @param majorApplyId 专业分流申请主键
     * @return 专业分流申请
     */
    @Override
    public MajorApply selectMajorApplyByMajorApplyId(String majorApplyId)
    {
        return majorApplyMapper.selectMajorApplyByMajorApplyId(majorApplyId);
    }

    /**
     * 查询专业分流申请列表
     *
     * @param majorApply 专业分流申请
     * @return 专业分流申请
     */
    @Override
    public List<MajorApply> selectMajorApplyList(MajorApply majorApply)
    {
        return majorApplyMapper.selectMajorApplyList(majorApply);
    }



    /**
     * 查询专业分流申请
     *
     * @param majorApply 专业分流申请
     * @return 专业分流申请
     */
    @Override
    public MajorApply selectOneMajorApply(MajorApply majorApply)
    {
        return majorApplyMapper.selectMajorApplyList(majorApply)
                .stream()
                .findFirst()
                .orElse(null);
    }

    /**
     * 新增专业分流申请
     *
     * @param majorApply 专业分流申请
     * @return 结果
     */

    @Override
    public int insertMajorApply(MajorApply majorApply)
    {
        majorApply.setCreateTime(DateUtils.getNowDate());
        return majorApplyMapper.insertMajorApply(majorApply);
    }

    /**
     * 修改专业分流申请
     *
     * @param majorApply 专业分流申请
     * @return 结果
     */
    @Override
    public int updateMajorApply(MajorApply majorApply)
    {
        majorApply.setUpdateTime(DateUtils.getNowDate());
        return majorApplyMapper.updateMajorApply(majorApply);
    }

    /**
     * 批量删除专业分流申请
     *
     * @param majorApplyIds 需要删除的专业分流申请主键
     * @return 结果
     */
    @Override
    public int deleteMajorApplyByMajorApplyIds(String[] majorApplyIds)
    {
        return majorApplyMapper.deleteMajorApplyByMajorApplyIds(majorApplyIds);
    }

    /**
     * 删除专业分流申请信息
     *
     * @param majorApplyId 专业分流申请主键
     * @return 结果
     */
    @Override
    public int deleteMajorApplyByMajorApplyId(String majorApplyId)
    {
        return majorApplyMapper.deleteMajorApplyByMajorApplyId(majorApplyId);
    }

    @Override
    public void updateMajorApplyStatus(String year, Long collegeId) {
        majorApplyMapper.updateMajorApplyStatus(year, collegeId);
    }
}
