package com.sundot.airport.system.service.impl;

import java.util.List;

import com.sundot.airport.common.utils.DateUtils;
import com.sundot.airport.system.domain.vo.CheckProjectItemVo;
import com.sundot.airport.system.utils.CodeGeneratorUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sundot.airport.system.mapper.BaseProjectMapper;
import com.sundot.airport.system.domain.BaseProject;
import com.sundot.airport.system.service.IBaseProjectService;

/**
 * 检查项目Service业务层处理
 *
 * @author ruoyi
 * @date 2025-07-11
 */
@Service
public class BaseProjectServiceImpl implements IBaseProjectService {
    @Autowired
    private CodeGeneratorUtil codeGeneratorUtil;
    @Autowired
    private BaseProjectMapper baseProjectMapper;

    /**
     * 查询检查项目
     *
     * @param id 检查项目主键
     * @return 检查项目
     */
    @Override
    public BaseProject selectBaseProjectById(Long id) {
        return baseProjectMapper.selectBaseProjectById(id);
    }

    /**
     * 查询检查项目列表
     *
     * @param baseProject 检查项目
     * @return 检查项目
     */
    @Override
    public List<BaseProject> selectBaseProjectList(BaseProject baseProject) {
        return baseProjectMapper.selectBaseProjectList(baseProject);
    }

    /**
     * 新增检查项目
     *
     * @param baseProject 检查项目
     * @return 结果
     */
    @Override
    public int insertBaseProject(BaseProject baseProject) {
        baseProject.setCode(codeGeneratorUtil.getNextCodeGenerator());
        baseProject.setCreateTime(DateUtils.getNowDate());
        return baseProjectMapper.insertBaseProject(baseProject);
    }

    /**
     * 修改检查项目
     *
     * @param baseProject 检查项目
     * @return 结果
     */
    @Override
    public int updateBaseProject(BaseProject baseProject) {
        baseProject.setUpdateTime(DateUtils.getNowDate());
        return baseProjectMapper.updateBaseProject(baseProject);
    }

    /**
     * 批量删除检查项目
     *
     * @param ids 需要删除的检查项目主键
     * @return 结果
     */
    @Override
    public int deleteBaseProjectByIds(Long[] ids) {
        return baseProjectMapper.deleteBaseProjectByIds(ids);
    }

    /**
     * 删除检查项目信息
     *
     * @param id 检查项目主键
     * @return 结果
     */
    @Override
    public int deleteBaseProjectById(Long id) {
        return baseProjectMapper.deleteBaseProjectById(id);
    }

    /**
     * 查询检查项目列表
     *
     * @param categoryCode 分类编码
     * @return 检查项目列表
     */
    @Override
    public List<BaseProject> selectProjectListByCategoryCode(String categoryCode) {
        BaseProject baseProject = new BaseProject();
        baseProject.setCategoryCode(categoryCode);
        return selectBaseProjectList(baseProject);
    }

    /**
     * 查询检查项目列表
     *
     * @param checkLevel 检查级别
     * @return 检查项目列表
     */
    @Override
    public List<CheckProjectItemVo> listByCheckLevel(String checkLevel) {
        return baseProjectMapper.listByCheckLevel(checkLevel);
    }
}
