package com.izouma.awesomeadmin.datasource;

import com.izouma.awesomeadmin.constant.AppConstant;
import com.izouma.awesomeadmin.dao.DataMapper;
import com.izouma.awesomeadmin.dto.Page;
import com.izouma.awesomeadmin.model.SqlServerTest;
import com.izouma.awesomeadmin.model.SuperUser;
import com.izouma.awesomeadmin.model.Zouma;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
// 默认DataServiceImpl下的所有方法均访问数据源1

public class DataServiceImpl implements DataService {

    @Autowired
    private DataMapper dataMapper;

    @Override
    public List<SuperUser> getSuperUserList() {

        return dataMapper.queryAllUsers();
    }

    @Override
    public List<Zouma> getZoumaList() {
        return dataMapper.queryZouma();
    }

    @Override

    public List<SqlServerTest> getSqlServerTestByPage(Page page) {
        Map<String, Object> parameter = new HashMap<String, Object>();
        parameter.put(AppConstant.PAGE, page);

        return dataMapper.getSqlServerTestByPage(parameter);
    }

}
