package com.diagbot.facade;

import com.diagbot.dto.TranFieldInfoDTO;
import com.diagbot.exception.CommonErrorCode;
import com.diagbot.exception.CommonException;
import com.diagbot.service.impl.TranFieldInfoServiceImpl;
import com.diagbot.util.ListUtil;
import com.diagbot.vo.TranFieldInfoVO;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Description:
 * @author: wangyu
 * @time: 2018/11/21 14:13
 */
@Component
public class TranFieldInfoFacade extends TranFieldInfoServiceImpl {


    /**
     * 根据uuid获取相关信息
     *
     * @param info
     * @return
     */
    public List<TranFieldInfoDTO> getInfoByUuid(TranFieldInfoVO info) {
        List<TranFieldInfoDTO> tranFieldInfoDTOList = this.getInfosByUuid(info);
        if (ListUtil.isEmpty(tranFieldInfoDTOList)) {
            throw new CommonException(CommonErrorCode.NOT_EXISTS,
                    "获取信息失败");
        }
        return tranFieldInfoDTOList;
    }
}
