package com.admin.major.service.impl;

import java.util.List;

import com.admin.common.core.service.BaseService;
import com.admin.common.utils.DateUtils;
import com.admin.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.admin.common.utils.SecurityUtils;
import com.admin.major.mapper.SpecialCourseApplyMapper;
import com.admin.major.domain.SpecialCourseApply;
import com.admin.major.service.ISpecialCourseApplyService;

/**
 * 专业课申请Service业务层处理
 * 
 * @author ljx
 * @date 2022-05-12
 */
@Service
public class SpecialCourseApplyServiceImpl extends BaseService<SpecialCourseApply> implements ISpecialCourseApplyService
{
    @Autowired
    private SpecialCourseApplyMapper specialCourseApplyMapper;

    /**
     * 查询专业课申请
     * 
     * @param specialCourseApplyId 专业课申请主键
     * @return 专业课申请
     */
    @Override
    public SpecialCourseApply selectSpecialCourseApplyBySpecialCourseApplyId(Long specialCourseApplyId)
    {
        return specialCourseApplyMapper.selectSpecialCourseApplyBySpecialCourseApplyId(specialCourseApplyId);
    }

    /**
     * 查询专业课申请列表
     * 
     * @param specialCourseApply 专业课申请
     * @return 专业课申请
     */
    @Override
    public List<SpecialCourseApply> selectSpecialCourseApplyList(SpecialCourseApply specialCourseApply)
    {
        return specialCourseApplyMapper.selectSpecialCourseApplyList(specialCourseApply);
    }


    /**
     * 新增专业课申请
     *
     * @param specialCourseApply 专业课申请
     * @return 结果
     */

    @Override
    public int insertSpecialCourseApply(SpecialCourseApply specialCourseApply)
    {
        specialCourseApply.setCreateTime(DateUtils.getNowDate());
        specialCourseApply.setCreateUserId(SecurityUtils.getUserId());
        specialCourseApply.setUpdateUserId(SecurityUtils.getUserId());
        return specialCourseApplyMapper.insertSpecialCourseApply(specialCourseApply);
    }

    /**
     * 修改专业课申请
     * 
     * @param specialCourseApply 专业课申请
     * @return 结果
     */
    @Override
    public int updateSpecialCourseApply(SpecialCourseApply specialCourseApply)
    {
        specialCourseApply.setUpdateTime(DateUtils.getNowDate());
        specialCourseApply.setUpdateUserId(SecurityUtils.getUserId());
        return specialCourseApplyMapper.updateSpecialCourseApply(specialCourseApply);
    }

    /**
     * 批量删除专业课申请
     * 
     * @param specialCourseApplyIds 需要删除的专业课申请主键
     * @return 结果
     */
    @Override
    public int deleteSpecialCourseApplyBySpecialCourseApplyIds(Long[] specialCourseApplyIds)
    {
        return specialCourseApplyMapper.deleteSpecialCourseApplyBySpecialCourseApplyIds(specialCourseApplyIds);
    }

    /**
     * 删除专业课申请信息
     * 
     * @param specialCourseApplyId 专业课申请主键
     * @return 结果
     */
    @Override
    public int deleteSpecialCourseApplyBySpecialCourseApplyId(Long specialCourseApplyId)
    {
        return specialCourseApplyMapper.deleteSpecialCourseApplyBySpecialCourseApplyId(specialCourseApplyId);
    }


    @Override
    public boolean saveBatch(List<SpecialCourseApply> userList) {
        return super.executeBatch(userList, user->{
            specialCourseApplyMapper.insertSpecialCourseApply(user);
        });
    }
}
