[improvement](chat) support query/search filter by web domainId and mapping add frequency/detectWord in mapping and metric dimensions orders filter duplicates

This commit is contained in:
lexluo
2023-06-15 18:15:44 +08:00
parent 1fd08be2cd
commit b6f0df40a9
57 changed files with 1040 additions and 332 deletions

View File

@@ -93,6 +93,7 @@ public class DatabaseServiceImpl implements DatabaseService {
private QueryResultWithSchemaResp queryWithColumns(String sql, DatabaseResp databaseResp) {
QueryResultWithSchemaResp queryResultWithColumns = new QueryResultWithSchemaResp();
SqlUtils sqlUtils = this.sqlUtils.init(databaseResp);
log.info("query SQL: {}" , sql);
sqlUtils.queryInternal(sql, queryResultWithColumns);
return queryResultWithColumns;
}

View File

@@ -15,7 +15,7 @@ public interface DatasourceRepository {
List<DatasourceDO> getDatasourceList();
List<DatasourceDO> getDatasourceList(Long classId);
List<DatasourceDO> getDatasourceList(Long domainId);
DatasourceDO getDatasourceById(Long id);

View File

@@ -15,7 +15,7 @@ public interface MetricRepository {
void updateMetric(MetricDO metricDO);
List<MetricDO> getMetricList(Long classId);
List<MetricDO> getMetricList(Long domainId);
List<MetricDO> getMetricListByIds(List<Long> ids);

View File

@@ -43,9 +43,9 @@ public class DatasourceRepositoryImpl implements DatasourceRepository {
}
@Override
public List<DatasourceDO> getDatasourceList(Long classId) {
public List<DatasourceDO> getDatasourceList(Long domainId) {
DatasourceDOExample datasourceExample = new DatasourceDOExample();
datasourceExample.createCriteria().andDomainIdEqualTo(classId);
datasourceExample.createCriteria().andDomainIdEqualTo(domainId);
return datasourceMapper.selectByExampleWithBLOBs(datasourceExample);
}

View File

@@ -13,9 +13,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import javax.annotation.PreDestroy;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
@@ -25,29 +23,12 @@ import org.springframework.util.CollectionUtils;
@Repository
public class DateInfoRepositoryImpl implements DateInfoRepository {
// @Autowired
// private SqlSessionTemplate sqlSessionTemplate;
private SqlSession sqlSession;
private ObjectMapper mapper = new ObjectMapper();
@Autowired
private DateInfoMapper dateInfoMapper;
// @PostConstruct
// public void init() {
// if (Objects.isNull(sqlSession)) {
// sqlSession = sqlSessionTemplate.getSqlSessionFactory().openSession(ExecutorType.BATCH, false);
// }
// }
@PreDestroy
public void preDestroy() {
if (Objects.nonNull(sqlSession)) {
sqlSession.close();
}
}
@Override
public Integer upsertDateInfo(List<DateInfoReq> dateInfoCommends) {
@@ -86,12 +67,6 @@ public class DateInfoRepositoryImpl implements DateInfoRepository {
for (DateInfoDO dateInfoDO : dateInfoDOList) {
dateInfoMapper.upsertDateInfo(dateInfoDO);
}
try {
sqlSession.commit();
return dateInfoDOList.size();
} catch (Exception e) {
log.warn("e:", e);
}
log.info("before final, elapsed time:{}", stopwatch.elapsed(TimeUnit.MILLISECONDS));
return 0;
}