package net.mingsoft.cms.action.web;

import lombok.Data;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.factory.annotation.Autowired;

import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.List;

public class SqlSession {
    private SqlSessionFactory sessionFactory;
    @Autowired
    private DataSource dataSource;


    public SqlSessionFactory getSessionFactory() throws Exception {
        ResultData resultData = new ResultData();
        resultData.message = dataSource.getConnection().toString();
        resultData.status = dataSource.getLoginTimeout();
        return sessionFactory;
    }


    public void init() {
        List<String> list = new ArrayList<>();
        list.stream().map(clazz -> "t" + (this.getClass().getSimpleName()));
    }


}
