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.WorkSbumitAdoptMapper;
import cn.wisenergy.model.app.WorkSbumitAdopt;
import cn.wisenergy.service.WorkSbumitAdoptService;
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 WorkSbumitAdoptServiceImpl implements WorkSbumitAdoptService {

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