Search in sources :

Example 1 with DsListBO

use of com.dtstack.taier.dao.domain.po.DsListBO in project Taier by DTStack.

the class DsInfoService method dsPage.

/**
 * 数据源列表分页
 *
 * @param dsListParam
 * @return
 */
public PageResult<List<DsListVO>> dsPage(DsListParam dsListParam) {
    DsListQuery listQuery = DsListTransfer.INSTANCE.toInfoQuery(dsListParam);
    listQuery.turn();
    Integer total = this.baseMapper.countDsPage(listQuery);
    if (total == 0) {
        return new PageResult<>(0, 0, 0, 0, new ArrayList<>());
    }
    List<DsListBO> dsListBOList = baseMapper.queryDsPage(listQuery);
    if (CollectionUtils.isEmpty(dsListBOList)) {
        return new PageResult<>(0, 0, 0, 0, new ArrayList<>());
    }
    List<DsListVO> dsListVOS = new ArrayList<>();
    for (DsListBO dsListBO : dsListBOList) {
        DsListVO dsListVO = DsListTransfer.INSTANCE.toInfoVO(dsListBO);
        String linkJson = dsListVO.getLinkJson();
        JSONObject linkData = DataSourceUtils.getDataSourceJson(linkJson);
        linkData.put("schemaName", dsListVO.getSchemaName());
        dsListVO.setLinkJson(DataSourceUtils.getEncodeDataSource(linkData, true));
        dsListVOS.add(dsListVO);
    }
    return new PageResult<>(dsListParam.getCurrentPage(), dsListParam.getPageSize(), total, dsListVOS);
}
Also used : DsListBO(com.dtstack.taier.dao.domain.po.DsListBO) JSONObject(com.alibaba.fastjson.JSONObject) ArrayList(java.util.ArrayList) DsListVO(com.dtstack.taier.develop.vo.datasource.DsListVO) PageResult(com.dtstack.taier.dao.pager.PageResult) DsListQuery(com.dtstack.taier.dao.domain.po.DsListQuery)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)1 DsListBO (com.dtstack.taier.dao.domain.po.DsListBO)1 DsListQuery (com.dtstack.taier.dao.domain.po.DsListQuery)1 PageResult (com.dtstack.taier.dao.pager.PageResult)1 DsListVO (com.dtstack.taier.develop.vo.datasource.DsListVO)1 ArrayList (java.util.ArrayList)1