提交 79467e07 authored 作者: inroi's avatar inroi

微调

上级 7fca0686
......@@ -20,11 +20,10 @@ public interface TableRelationMapper extends BaseMapper<TableRelation> {
/**
* 表关系列表
*
* @param page 分页
* @param inVo 条件
* @return 列表
*/
List<TableRelationListOutVoRecords> tableRelationList(@Param("page") Page<TableRelationListOutVoRecords> page, @Param("inVo") TableRelationListInVo inVo);
List<TableRelationListOutVoRecords> tableRelationList(TableRelationListInVo inVo);
/**
* 表关系录入
......
......@@ -6,7 +6,7 @@
<select id="tableRelationList" parameterType="com.nzwz.transfer.tablerelation.TableRelationListInVo" resultType="com.nzwz.transfer.tablerelation.TableRelationListOutVoRecords">
SELECT id, table_header, table_date, sub_table_header, foreign_key, create_time FROM tb_table_relation
SELECT id, `table_name`, table_header, table_date, sub_table_header, primary_key, foreign_key, create_time FROM tb_table_relation
</select>
......
......@@ -30,7 +30,7 @@ public class KingDeeLoginScheduler {
InitConnectParm initConnectParm = kingDeeApi.getInitConnectParm();
KingDeeK3CloudApi kingDeeK3CloudApi = new KingDeeK3CloudApi(initConnectParm.getK3CloudUrl());
Boolean flag = null;
Boolean flag;
try {
flag = kingDeeK3CloudApi.login(initConnectParm.getDbid(), initConnectParm.getUid(), initConnectParm.getPwd(), initConnectParm.getLang());
} catch (Exception e) {
......
package com.nzwz.serivce.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nzwz.common.constants.Constants;
import com.nzwz.transfer.tablerelation.*;
import com.nzwz.dao.TableRelationMapper;
import com.nzwz.serivce.ITableRelationService;
......@@ -8,7 +9,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author Inori
......@@ -22,15 +25,29 @@ public class TableRelationServiceImpl implements ITableRelationService {
@Override
public TableRelationListOutVo tableRelationList(TableRelationListInVo inVo) {
Page<TableRelationListOutVoRecords> page = new Page<>(inVo.getPageNo(), inVo.getPageSize());
List<TableRelationListOutVoRecords> recordsList = tableRelationMapper.tableRelationList(page, inVo);
List<TableRelationListOutVoRecords> recordsList = tableRelationMapper.tableRelationList(inVo);
List<TableRelationListOutVoRecords> tempList = getTableRelationTree(Constants.ROOT_MENU_CODE, recordsList);
List<TableRelationListOutVoRecords> result = tempList.stream()
.sorted(Comparator.comparing(TableRelationListOutVoRecords::getCreateTime).reversed())
.collect(Collectors.toList())
.subList(inVo.getPageNo() * inVo.getPageSize() - 10, inVo.getPageNo() * inVo.getPageSize());
TableRelationListOutVo outVo = new TableRelationListOutVo();
outVo.setTotal((int) page.getTotal());
outVo.setRecords(recordsList);
outVo.setTotal(recordsList.size());
outVo.setRecords(result);
return outVo;
}
private List<TableRelationListOutVoRecords> getTableRelationTree(String tableHeader, List<TableRelationListOutVoRecords> recordsList) {
List<TableRelationListOutVoRecords> tempList = recordsList.stream().filter(m -> tableHeader.equals(m.getSubTableHeader())).collect(Collectors.toList());
for (TableRelationListOutVoRecords records : tempList) {
records.setChildren(this.getTableRelationTree(records.getTableHeader(), recordsList));
}
return tempList;
}
@Transactional(rollbackFor = Exception.class)
@Override
public void tableRelationCreate(TableRelationCreateInVo inVo) {
......
......@@ -2,6 +2,8 @@ package com.nzwz.transfer.tablerelation;
import lombok.Data;
import java.util.List;
/**
* @author Inori
*/
......@@ -56,4 +58,10 @@ public class TableRelationListOutVoRecords {
private String createTime;
/**
* 子资源
*/
private List<TableRelationListOutVoRecords> children;
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论