package com.tykj.workflowcore.model_layer.service.impl;

import com.tykj.workflowcore.base.result.ApiException;
import com.tykj.workflowcore.model_layer.dao.TableInfoExDao;
import com.tykj.workflowcore.model_layer.entity.TableInfoEx;
import com.tykj.workflowcore.model_layer.service.TableInfoExService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.rmi.runtime.NewThreadAction;

import java.util.List;
import java.util.Optional;

/**
 * @ClassName TableInfoExImpl
 * @Description TODO
 * @Author WWW
 * @Date 2021/4/6 9:58
 * @Version 1.0
 */
@Service
public class TableInfoExImpl implements TableInfoExService {

    @Autowired
    TableInfoExDao tableInfoExDao;

    @Override
    public List<TableInfoEx> findAll() {
        return tableInfoExDao.findAll() ;
    }


    @Override
    public String findXml(Integer id) {
        Optional<TableInfoEx> byId = tableInfoExDao.findById(id);
        if (byId.isPresent()){
            return  byId.get().getXml();
        }
           throw new ApiException("id错误！");
    }
}
