package cn.wisenergy.service.impl;

import cn.wisenergy.common.utils.exception.BASE_RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.BaseCustomException;
import cn.wisenergy.mapper.WorkSubmitAdoptMapper;
import cn.wisenergy.model.app.WorkSubmitAdopt;
import cn.wisenergy.service.WorkSubmitAdoptService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author chenqi
 * @since 2021-01-19
 */
@Service
@Slf4j
public class WorkSubmitAdoptServiceImpl implements WorkSubmitAdoptService {

    @Autowired
    private WorkSubmitAdoptMapper workSubmitAdoptMapper;
    /**
     * 功能： 获取自动审批和默认填报限制
     *
     * @param id id
     * @return WorkSubmitAdopt
     */
    @Override
    public WorkSubmitAdopt getById(Integer id) {
        log.info("WorkSubmitAdoptServiceImpl[]getById[]input.param.id:" + id);
        if (null == id) {
            throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
        }
        WorkSubmitAdopt workSubmitAdopt = workSubmitAdoptMapper.selectById(id);
        if (null == workSubmitAdopt) {
            throw new BaseCustomException(BASE_RESP_CODE_ENUM.RESOURCE_NOT_FOUND);
        }
        return workSubmitAdopt;
    }
}
