package cn.iocoder.yudao.module.configure.service.inspectionitem;

import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;

import java.util.*;
import cn.iocoder.yudao.module.configure.controller.admin.inspectionitem.vo.*;
import cn.iocoder.yudao.module.configure.dal.dataobject.inspectionitem.InspectionItemDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;

import cn.iocoder.yudao.module.configure.convert.inspectionitem.InspectionItemConvert;
import cn.iocoder.yudao.module.configure.dal.mysql.inspectionitem.InspectionItemMapper;

import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.configure.enums.ErrorCodeConstants.*;

/**
 * 检测报告模板检测项目 Service 实现类
 *
 * @author 芋道源码
 */
@Service
@Validated
public class InspectionItemServiceImpl implements InspectionItemService {

    @Resource
    private InspectionItemMapper inspectionItemMapper;

    private void validateInspectionItemExists(Long id) {
        if (inspectionItemMapper.selectById(id) == null) {
            throw exception(INSPECTION_ITEM_NOT_EXISTS);
        }
    }

    @Override
    public InspectionItemDO getInspectionItem(Long id) {
        return inspectionItemMapper.selectById(id);
    }

    @Override
    public PageResult<InspectionItemDO> getInspectionItemPage(InspectionItemPageReqVO pageReqVO) {
        return inspectionItemMapper.selectPage(pageReqVO);
    }

}
