package com.ruoyi.sim.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.sim.mapper.MajorMapper;
import com.ruoyi.sim.domain.Major;

/**
 * 专业Service业务层处理
 *
 * @author tom
 * @date 2024-12-11
 */
@Service
public class MajorService {
    @Autowired
    private MajorMapper majorMapper;

    /**
     * 查询专业
     *
     * @param majorId 专业主键
     * @return 专业
     */
    public Major selectMajorByMajorId(Long majorId) {
        return majorMapper.selectMajorByMajorId(majorId);
    }

    /**
     * 查询专业列表
     *
     * @param major 专业
     * @return 专业
     */
    public List<Major> selectMajorList(Major major) {
        return majorMapper.selectMajorList(major);
    }

    /**
     * 新增专业
     *
     * @param major 专业
     * @return 结果
     */
    public int insertMajor(Major major) {
        major.setCreateTime(DateUtils.getNowDate());
        return majorMapper.insertMajor(major);
    }

    /**
     * 修改专业
     *
     * @param major 专业
     * @return 结果
     */
    public int updateMajor(Major major) {
        major.setUpdateTime(DateUtils.getNowDate());
        return majorMapper.updateMajor(major);
    }

    /**
     * 批量删除专业
     *
     * @param majorIds 需要删除的专业主键
     * @return 结果
     */
    public int deleteMajorByMajorIds(Long[] majorIds) {
        return majorMapper.deleteMajorByMajorIds(majorIds);
    }

    /**
     * 删除专业信息
     *
     * @param majorId 专业主键
     * @return 结果
     */
    public int deleteMajorByMajorId(Long majorId) {
        return majorMapper.deleteMajorByMajorId(majorId);
    }
}
