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.WorkDeptMapper;
import cn.wisenergy.model.app.WorkDept;
import cn.wisenergy.service.WorkDeptService;
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 WorkDeptServiceImpl implements WorkDeptService {

    @Autowired
    private WorkDeptMapper workDeptMapper;
    @Override
    public WorkDept getById(Integer id) {
        log.info("WorkDeptServiceImpl[]getById[]input.param.id" + id);
        if (null == id) {
            throw new BaseCustomException(BASE_RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
        }
        WorkDept workDept = workDeptMapper.selectById(id);
        if (null == workDept) {
            throw new BaseCustomException(BASE_RESP_CODE_ENUM.DEPT_IS_NULL);
        }
        return workDept;
    }
}
