|  | @@ -1,13 +1,16 @@
 | 
	
		
			
				|  |  |  package com.flow.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
	
		
			
				|  |  |  import com.flow.common.core.exception.BaseException;
 | 
	
		
			
				|  |  | +import com.flow.common.core.model.PageResult;
 | 
	
		
			
				|  |  |  import com.flow.common.mybatis.service.impl.BaseServiceImpl;
 | 
	
		
			
				|  |  |  import com.flow.dao.ReportDatasourceDao;
 | 
	
		
			
				|  |  |  import com.flow.entity.ReportDatasource;
 | 
	
		
			
				|  |  | +import com.flow.mapstruct.ReportDatasourceMapper;
 | 
	
		
			
				|  |  |  import com.flow.model.ExecSql;
 | 
	
		
			
				|  |  | +import com.flow.model.ReportDatasourceQuery;
 | 
	
		
			
				|  |  |  import com.flow.service.ReportDatasourceService;
 | 
	
		
			
				|  |  | -import com.google.common.collect.Lists;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.jdbc.core.JdbcTemplate;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
	
		
			
				|  | @@ -19,7 +22,19 @@ import java.util.*;
 | 
	
		
			
				|  |  |  public class ReportDatasourceServiceImpl extends BaseServiceImpl<ReportDatasourceDao, ReportDatasource> implements ReportDatasourceService {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ReportDatasourceDao reportDatasourceDao;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ReportDatasourceMapper reportDatasourceMapper;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public PageResult<ReportDatasource> getList(ReportDatasourceQuery reportDatasourceQuery) {
 | 
	
		
			
				|  |  | +        ReportDatasource reportDatasource = reportDatasourceMapper.toEntity(reportDatasourceQuery);
 | 
	
		
			
				|  |  | +        Page<ReportDatasource> page = reportDatasourceDao.lambdaQueryChain()
 | 
	
		
			
				|  |  | +                .setEntity(reportDatasource)
 | 
	
		
			
				|  |  | +                .page(
 | 
	
		
			
				|  |  | +                        new Page<>(reportDatasourceQuery.getPage(), reportDatasourceQuery.getLimit())
 | 
	
		
			
				|  |  | +                );
 | 
	
		
			
				|  |  | +        return new PageResult<>(page.getTotal(), page.getRecords());
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public ReportDatasource create(ReportDatasource reportDatasource) {
 | 
	
	
		
			
				|  | @@ -54,7 +69,7 @@ public class ReportDatasourceServiceImpl extends BaseServiceImpl<ReportDatasourc
 | 
	
		
			
				|  |  |              throw new BaseException("数据源不存在");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          ReportDatasource reportDatasource = optional.get();
 | 
	
		
			
				|  |  | -        DataSource dataSource = reportDatasource.getDataSource();
 | 
	
		
			
				|  |  | +        DataSource dataSource = reportDatasource.buildDataSource();
 | 
	
		
			
				|  |  |          JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
 | 
	
		
			
				|  |  |          return jdbcTemplate.queryForList(sql,execSql.getParams());
 | 
	
		
			
				|  |  |      }
 |