09061026:对这个资产展示使用线程池的方法去做,第六次优化代码
parent
7cea57439c
commit
c431f36d19
|
@ -373,7 +373,26 @@ public class DataValueServiceImpl extends ServiceImpl<DataValueMapper, DataValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getTableValueTotal(DataValueModel dataValueModel) {
|
||||||
|
MysqlQuery mysqlQuery = new MysqlQuery();
|
||||||
|
mysqlQuery.setDataSourceId(String.valueOf(dataValueModel.getBasicId()));
|
||||||
|
DataSource dataSource = dataSourceService.getById(dataValueModel.getBasicId());
|
||||||
|
MysqlPool mysqlPool = new MysqlPool(dataSource);
|
||||||
|
mysqlPool.init();
|
||||||
|
Connection conn = mysqlPool.getConn();
|
||||||
|
try (Statement statement = conn.createStatement();
|
||||||
|
ResultSet resultSet = statement.executeQuery(dataValueModel.getSql())) {
|
||||||
|
if (resultSet.next()) {
|
||||||
|
return resultSet.getInt(1);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue