top交互实现
This commit is contained in:
parent
aed22239ec
commit
97814f5764
|
|
@ -0,0 +1,31 @@
|
||||||
|
/**
|
||||||
|
* @author: Clay
|
||||||
|
* @date: 2021/7/23 21:40
|
||||||
|
* @description:top
|
||||||
|
* @email: clay@hchyun.com
|
||||||
|
*/
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询万能查询详细
|
||||||
|
export function getQuery(id) {
|
||||||
|
return request({
|
||||||
|
url: '/top/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询万能查询详细
|
||||||
|
export function getTables() {
|
||||||
|
return request({
|
||||||
|
url: '/top/',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 查询万能查询详细
|
||||||
|
export function updateQuery(data) {
|
||||||
|
return request({
|
||||||
|
url: '/top',
|
||||||
|
method: 'put',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -132,6 +132,24 @@ export const constantRoutes = [
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/top/edit/:topId(\\d+)',
|
||||||
|
component: (resolve) => require(['@/views/tool/top/topology'], resolve),
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// path: '/top',
|
||||||
|
// component: Layout,
|
||||||
|
// hidden: true,
|
||||||
|
// children: [
|
||||||
|
// {
|
||||||
|
// path: 'edit/:topId(\\d+)',
|
||||||
|
// component: (resolve) => require(['@/views/tool/top/topology'], resolve),
|
||||||
|
// name: 'top',
|
||||||
|
// meta: { title: 'top查询配置' }
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// },
|
||||||
{
|
{
|
||||||
path: '/job',
|
path: '/job',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,7 @@ export default {
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
uqName: null,
|
uqName: null,
|
||||||
uqDescribe: null,
|
uqDescribe: null,
|
||||||
|
type:1
|
||||||
},
|
},
|
||||||
// 表单参数
|
// 表单参数
|
||||||
form: {},
|
form: {},
|
||||||
|
|
@ -270,6 +271,7 @@ export default {
|
||||||
/** 提交按钮 */
|
/** 提交按钮 */
|
||||||
submitForm() {
|
submitForm() {
|
||||||
this.$refs["form"].validate(valid => {
|
this.$refs["form"].validate(valid => {
|
||||||
|
this.form.type = 1
|
||||||
if (valid) {
|
if (valid) {
|
||||||
if (this.form.id != null) {
|
if (this.form.id != null) {
|
||||||
updateQuery(this.form).then(response => {
|
updateQuery(this.form).then(response => {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,318 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="名称" prop="uqName">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.uqName"
|
||||||
|
placeholder="请输入名称"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="uqDescribe">
|
||||||
|
<el-input
|
||||||
|
v-model="queryParams.uqDescribe"
|
||||||
|
placeholder="请输入描述"
|
||||||
|
clearable
|
||||||
|
size="small"
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="创建时间">
|
||||||
|
<el-date-picker
|
||||||
|
v-model="daterangeCreateTime"
|
||||||
|
size="small"
|
||||||
|
style="width: 240px"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
type="daterange"
|
||||||
|
range-separator="-"
|
||||||
|
start-placeholder="开始日期"
|
||||||
|
end-placeholder="结束日期"
|
||||||
|
></el-date-picker>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['tool:query:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['tool:query:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['tool:query:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['tool:query:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="queryList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column type="index" width="50"></el-table-column>
|
||||||
|
<el-table-column label="名称" align="center" prop="uqName" />
|
||||||
|
<el-table-column label="描述" align="center" prop="uqDescribe" />
|
||||||
|
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="更新时间" align="center" prop="updateTime">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['tool:query:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
type="text"
|
||||||
|
size="small"
|
||||||
|
icon="el-icon-edit-outline"
|
||||||
|
@click="handleEditTable(scope.row)"
|
||||||
|
v-hasPermi="['tool:query:update']"
|
||||||
|
>编辑</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['tool:query:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改万能查询对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="名称" prop="uqName">
|
||||||
|
<el-input v-model="form.uqName" placeholder="请输入名称" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="描述" prop="uqDescribe">
|
||||||
|
<el-input v-model="form.uqDescribe" placeholder="请输入描述" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listQuery, getQuery, delQuery, addQuery, updateQuery, exportQuery } from "@/api/tool/query";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Query",
|
||||||
|
components: {
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 万能查询表格数据
|
||||||
|
queryList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 创建时间时间范围
|
||||||
|
daterangeCreateTime: [],
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
uqName: null,
|
||||||
|
uqDescribe: null,
|
||||||
|
type:2
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
uqName: [
|
||||||
|
{ required: true, message: "名称不能为空}", trigger: "blur" },
|
||||||
|
],
|
||||||
|
uqDescribe: [
|
||||||
|
{ required: true, message: "描述不能为空}", trigger: "blur" },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
/** 查询万能查询列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listQuery(this.addCreateDateRange(this.queryParams,this.daterangeCreateTime)).then(response =>{
|
||||||
|
this.queryList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
uqName: null,
|
||||||
|
uqSql: null,
|
||||||
|
uqDescribe: null,
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
handleEditTable(row){
|
||||||
|
this.$router.push("/top/edit/" + row.id);
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.daterangeCreateTime = [];
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加万能查询";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getQuery(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改万能查询";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
this.form.type = 2
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateQuery(this.form).then(response => {
|
||||||
|
this.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addQuery(this.form).then(response => {
|
||||||
|
this.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$confirm('是否确认删除万能查询编号为"' + ids + '"的数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return delQuery(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
const queryParams = this.queryParams;
|
||||||
|
this.$confirm('是否确认导出所有万能查询数据项?', "警告", {
|
||||||
|
confirmButtonText: "确定",
|
||||||
|
cancelButtonText: "取消",
|
||||||
|
type: "warning"
|
||||||
|
}).then(function() {
|
||||||
|
return exportQuery(queryParams);
|
||||||
|
}).then(response => {
|
||||||
|
this.download(response.msg);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
@ -183,6 +183,7 @@ export default {
|
||||||
});
|
});
|
||||||
vm.selectedEdgeParams = {
|
vm.selectedEdgeParams = {
|
||||||
label: clickEdgeModel.label || "",
|
label: clickEdgeModel.label || "",
|
||||||
|
relationalItem: clickEdgeModel.relationalItem,
|
||||||
sourceAttrs:clickEdgeModel.sourceAttrs,
|
sourceAttrs:clickEdgeModel.sourceAttrs,
|
||||||
targetAttrs:clickEdgeModel.targetAttrs,
|
targetAttrs:clickEdgeModel.targetAttrs,
|
||||||
appConfig: { ...edgeAppConfig, ...clickEdgeModel.appConfig }
|
appConfig: { ...edgeAppConfig, ...clickEdgeModel.appConfig }
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ export default {
|
||||||
self.evtInfo = {
|
self.evtInfo = {
|
||||||
action: null,
|
action: null,
|
||||||
node: event.item,
|
node: event.item,
|
||||||
target: event.target
|
target: event.target,
|
||||||
};
|
};
|
||||||
if (self.evtInfo.target && self.evtInfo.target.attrs.name) {
|
if (self.evtInfo.target && self.evtInfo.target.attrs.name) {
|
||||||
// todo...未来可能针对锚点增加其它功能(例如拖拽调整大小)
|
// todo...未来可能针对锚点增加其它功能(例如拖拽调整大小)
|
||||||
|
|
@ -79,7 +79,6 @@ export default {
|
||||||
|
|
||||||
let sourceAnchor = self.evtInfo.node.getAnchorPoints();
|
let sourceAnchor = self.evtInfo.node.getAnchorPoints();
|
||||||
let sourceNodeModel = self.evtInfo.node.getModel();
|
let sourceNodeModel = self.evtInfo.node.getModel();
|
||||||
console.log("sourceNodeModel",sourceNodeModel)
|
|
||||||
// 锚点数据
|
// 锚点数据
|
||||||
let anchorPoints = self.evtInfo.node.getAnchorPoints();
|
let anchorPoints = self.evtInfo.node.getAnchorPoints();
|
||||||
// 处理线条目标点
|
// 处理线条目标点
|
||||||
|
|
@ -90,6 +89,11 @@ export default {
|
||||||
y: event.y
|
y: event.y
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
let relational = vm.relationalMap.map(item => {
|
||||||
|
if (item.mainId === sourceNodeModel.tableId) {
|
||||||
|
return item
|
||||||
|
}
|
||||||
|
})
|
||||||
self.drawEdge.currentLine = self.graph.addItem("edge", {
|
self.drawEdge.currentLine = self.graph.addItem("edge", {
|
||||||
// id: G6.Util.uniqueId(), // 这种生成id的方式有bug,会重复
|
// id: G6.Util.uniqueId(), // 这种生成id的方式有bug,会重复
|
||||||
id: utils.generateUUID(),
|
id: utils.generateUUID(),
|
||||||
|
|
@ -98,6 +102,7 @@ export default {
|
||||||
sourceAttrs:sourceNodeModel.attrs,
|
sourceAttrs:sourceNodeModel.attrs,
|
||||||
sourceAnchor: sourceAnchor ? sourceAnchor.anchorIndex : "",
|
sourceAnchor: sourceAnchor ? sourceAnchor.anchorIndex : "",
|
||||||
// 终止节点/位置
|
// 终止节点/位置
|
||||||
|
relational: relational,
|
||||||
target: {
|
target: {
|
||||||
x: event.x,
|
x: event.x,
|
||||||
y: event.y
|
y: event.y
|
||||||
|
|
@ -132,41 +137,58 @@ export default {
|
||||||
// 锚点数据
|
// 锚点数据
|
||||||
let anchorPoints = targetNode.getAnchorPoints();
|
let anchorPoints = targetNode.getAnchorPoints();
|
||||||
// 处理线条目标点
|
// 处理线条目标点
|
||||||
if (anchorPoints && anchorPoints.length) {
|
let relational = self.drawEdge.currentLine.getModel().relational
|
||||||
// 获取距离指定坐标最近的一个锚点
|
let starts = false;
|
||||||
targetAnchor = targetNode.getLinkPoint({
|
let relationalItem = null;
|
||||||
x: event.x,
|
relational.map(item => {
|
||||||
y: event.y
|
if (item){
|
||||||
});
|
if (item.childId === targetNodeModel.tableId) {
|
||||||
}
|
starts = true
|
||||||
self.graph.updateItem(self.drawEdge.currentLine, {
|
relationalItem = item
|
||||||
target: targetNodeModel.id,
|
|
||||||
targetAnchor: targetAnchor ? targetAnchor.anchorIndex : "",
|
|
||||||
targetAttrs:targetNodeModel.attrs,
|
|
||||||
});
|
|
||||||
|
|
||||||
// ************** 记录historyData的逻辑 start **************
|
|
||||||
if (this.historyData) {
|
|
||||||
let graph = this.graph;
|
|
||||||
// 如果当前点过【撤销】了,拖拽节点后没有【重做】功能
|
|
||||||
// 重置undoCount,拖拽后的数据给(当前所在historyIndex + 1),且清空这个时间点之后的记录
|
|
||||||
if (vm.undoCount > 0) {
|
|
||||||
vm.historyIndex = vm.historyIndex - vm.undoCount; // 此时的historyIndex应当更新为【撤销】后所在的索引位置
|
|
||||||
for (let i = 1; i <= vm.undoCount; i++) {
|
|
||||||
let key = `graph_history_${vm.historyIndex + i}`;
|
|
||||||
vm.removeHistoryData(key);
|
|
||||||
}
|
}
|
||||||
vm.undoCount = 0;
|
|
||||||
} else {
|
|
||||||
// 正常顺序执行的情况,记录拖拽前的数据状态
|
|
||||||
let key = `graph_history_${vm.historyIndex}`;
|
|
||||||
vm.addHistoryData(key, this.historyData);
|
|
||||||
}
|
}
|
||||||
// 记录拖拽后的数据状态
|
})
|
||||||
vm.historyIndex += 1;
|
if (starts) {
|
||||||
let key = `graph_history_${vm.historyIndex}`;
|
if (anchorPoints && anchorPoints.length) {
|
||||||
let currentData = JSON.stringify(graph.save());
|
// 获取距离指定坐标最近的一个锚点
|
||||||
vm.addHistoryData(key, currentData);
|
targetAnchor = targetNode.getLinkPoint({
|
||||||
|
x: event.x,
|
||||||
|
y: event.y
|
||||||
|
});
|
||||||
|
}
|
||||||
|
self.graph.updateItem(self.drawEdge.currentLine, {
|
||||||
|
target: targetNodeModel.id,
|
||||||
|
relationalItem:relationalItem,
|
||||||
|
targetAnchor: targetAnchor ? targetAnchor.anchorIndex : "",
|
||||||
|
targetAttrs: targetNodeModel.attrs,
|
||||||
|
});
|
||||||
|
|
||||||
|
// ************** 记录historyData的逻辑 start **************
|
||||||
|
if (this.historyData) {
|
||||||
|
let graph = this.graph;
|
||||||
|
// 如果当前点过【撤销】了,拖拽节点后没有【重做】功能
|
||||||
|
// 重置undoCount,拖拽后的数据给(当前所在historyIndex + 1),且清空这个时间点之后的记录
|
||||||
|
if (vm.undoCount > 0) {
|
||||||
|
vm.historyIndex = vm.historyIndex - vm.undoCount; // 此时的historyIndex应当更新为【撤销】后所在的索引位置
|
||||||
|
for (let i = 1; i <= vm.undoCount; i++) {
|
||||||
|
let key = `graph_history_${vm.historyIndex + i}`;
|
||||||
|
vm.removeHistoryData(key);
|
||||||
|
}
|
||||||
|
vm.undoCount = 0;
|
||||||
|
} else {
|
||||||
|
// 正常顺序执行的情况,记录拖拽前的数据状态
|
||||||
|
let key = `graph_history_${vm.historyIndex}`;
|
||||||
|
vm.addHistoryData(key, this.historyData);
|
||||||
|
}
|
||||||
|
// 记录拖拽后的数据状态
|
||||||
|
vm.historyIndex += 1;
|
||||||
|
let key = `graph_history_${vm.historyIndex}`;
|
||||||
|
let currentData = JSON.stringify(graph.save());
|
||||||
|
vm.addHistoryData(key, currentData);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
self.graph.removeItem(self.drawEdge.currentLine);
|
||||||
|
vm.msgError("两表之间无关联关系")
|
||||||
}
|
}
|
||||||
// ************** 记录historyData的逻辑 end **************
|
// ************** 记录historyData的逻辑 end **************
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export default {
|
||||||
},
|
},
|
||||||
name: 'edge-shape'
|
name: 'edge-shape'
|
||||||
})
|
})
|
||||||
console.log(keyShape.attrs.endArrow = true)
|
keyShape.attrs.endArrow = true
|
||||||
return keyShape
|
return keyShape
|
||||||
},
|
},
|
||||||
setState(name, value, item) {
|
setState(name, value, item) {
|
||||||
|
|
|
||||||
|
|
@ -189,12 +189,15 @@ export default {
|
||||||
const isSelected =
|
const isSelected =
|
||||||
Math.floor(startIndex) + i === Number(selectedIndex);
|
Math.floor(startIndex) + i === Number(selectedIndex);
|
||||||
let {
|
let {
|
||||||
key = "", type
|
columnName = "", columnType,columnComment
|
||||||
} = e;
|
} = e;
|
||||||
if (type) {
|
if (columnComment){
|
||||||
key += " - " + type;
|
columnName+= " : " + columnComment
|
||||||
}
|
}
|
||||||
const label = key.length > 26 ? key.slice(0, 24) + "..." : key;
|
if (columnType) {
|
||||||
|
columnName += " - " + columnType;
|
||||||
|
}
|
||||||
|
const label = columnName.length > 26 ? columnName.slice(0, 24) + "..." : columnName;
|
||||||
|
|
||||||
listContainer.addShape("rect", {
|
listContainer.addShape("rect", {
|
||||||
attrs: {
|
attrs: {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -5,6 +5,8 @@
|
||||||
:graph-data="graphData"
|
:graph-data="graphData"
|
||||||
:node-app-config="nodeAppConfig"
|
:node-app-config="nodeAppConfig"
|
||||||
:edge-app-config="edgeAppConfig"
|
:edge-app-config="edgeAppConfig"
|
||||||
|
:node-type-list="nodeTypeList"
|
||||||
|
:relational-map="relationalMap"
|
||||||
@doAutoRefresh="doAutoRefresh"
|
@doAutoRefresh="doAutoRefresh"
|
||||||
@doManualRefresh="doManualRefresh"
|
@doManualRefresh="doManualRefresh"
|
||||||
@doChangeMode="doChangeMode"
|
@doChangeMode="doChangeMode"
|
||||||
|
|
@ -18,6 +20,7 @@
|
||||||
/* 局部注册 */
|
/* 局部注册 */
|
||||||
import Topology from './packages/topology/src/topology'
|
import Topology from './packages/topology/src/topology'
|
||||||
import { deepClone } from './utils/index'
|
import { deepClone } from './utils/index'
|
||||||
|
import {getQuery,getTables,updateQuery} from '@/api/tool/top'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DemoTopology',
|
name: 'DemoTopology',
|
||||||
|
|
@ -26,12 +29,15 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
graphData: {"nodes":[{"id":"305bfbdd-31cc-4028-b2b1-2f504968356d","x":304.8223042174235,"y":131.0267312661499,"label":"客户端","table":"test_table","type":"dice-er-box","attrs":[{"key":"id","type":"number(6)","comment":"主键id","isUse":0},{"key":"key","type":"varchar(255)","comment":"关键字","isUse":1},{"key":"gender","type":"enum(M, F)","comment":"gender","isUse":1},{"key":"birthday","type":"date","comment":"生日","isUse":0},{"key":"hometown","type":"varchar(255)","comment":"家乡","isUse":0},{"key":"country","type":"varchar(255)","comment":"国家","isUse":1},{"key":"nation","type":"varchar(255)","comment":"nation","isUse":1},{"key":"jobId","type":"number(3)","comment":"工作id","isUse":1},{"key":"phone","type":"varchar(255)","comment":"电话","isUse":1}],"size":[55,55],"width":250,"height":316,"anchorPoints":[[0.5,0],[1,0.5],[0.5,1],[0,0.5]],"appState":{"alert":false},"labelCfg":{"position":"bottom"},"style":{"default":{"stroke":"#CED4D9","fill":"transparent","shadowBlur":10,"shadowColor":"rgba(13, 26, 38, 0.08)","lineWidth":1,"radius":4,"strokeOpacity":0.7},"selected":{"shadowColor":"#ff240b","shadowBlur":2},"unselected":{"shadowColor":""}},"selectedIndex":null,"appConfig":{},"depth":0},{"id":"be9b52e5-9c2f-4e5c-990a-afbf19dcfeed","x":-94.51187075489108,"y":127.35469287559994,"label":"防火墙","table":"test_table","type":"dice-er-box","attrs":[{"key":"id","type":"number(6)","comment":"主键id","isUse":0},{"key":"key","type":"varchar(255)","comment":"关键字","isUse":1},{"key":"gender","type":"enum(M, F)","comment":"gender","isUse":0},{"key":"birthday","type":"date","comment":"生日","isUse":1},{"key":"hometown","type":"varchar(255)","comment":"家乡","isUse":1},{"key":"country","type":"varchar(255)","comment":"国家","isUse":0},{"key":"nation","type":"varchar(255)","comment":"nation","isUse":1},{"key":"jobId","type":"number(3)","comment":"工作id","isUse":1},{"key":"phone","type":"varchar(255)","comment":"电话","isUse":1}],"size":[55,55],"width":250,"height":316,"anchorPoints":[[0.5,0],[1,0.5],[0.5,1],[0,0.5]],"appState":{"alert":false},"labelCfg":{"position":"bottom"},"style":{"default":{"stroke":"#CED4D9","fill":"transparent","shadowBlur":10,"shadowColor":"rgba(13, 26, 38, 0.08)","lineWidth":1,"radius":4,"strokeOpacity":0.7},"selected":{"shadowColor":"#ff240b","shadowBlur":2},"unselected":{"shadowColor":""}},"selectedIndex":null,"appConfig":{},"startIndex":0,"startX":0,"depth":0}],"edges":[{"id":"8bc0249e-ee5d-4dd7-84e0-e4e32c217f2a","source":"be9b52e5-9c2f-4e5c-990a-afbf19dcfeed","sourceAttrs":[{"key":"id","type":"number(6)","comment":"主键id","isUse":1},{"key":"key","type":"varchar(255)","comment":"关键字","isUse":1},{"key":"gender","type":"enum(M, F)","comment":"gender","isUse":1},{"key":"birthday","type":"date","comment":"生日","isUse":1},{"key":"hometown","type":"varchar(255)","comment":"家乡","isUse":1},{"key":"country","type":"varchar(255)","comment":"国家","isUse":1},{"key":"nation","type":"varchar(255)","comment":"nation","isUse":1},{"key":"jobId","type":"number(3)","comment":"工作id","isUse":1},{"key":"phone","type":"varchar(255)","comment":"电话","isUse":1}],"sourceAnchor":1,"target":"305bfbdd-31cc-4028-b2b1-2f504968356d","type":"top-cubic","style":{"active":{"stroke":"rgb(95, 149, 255)","lineWidth":1},"selected":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"shadowColor":"rgb(95, 149, 255)","shadowBlur":10,"text-shape":{"fontWeight":500}},"highlight":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"text-shape":{"fontWeight":500}},"inactive":{"stroke":"rgb(234, 234, 234)","lineWidth":1},"disable":{"stroke":"rgb(245, 245, 245)","lineWidth":1},"edgeStyle":{"default":{"stroke":"#e2e2e2","lineWidth":3,"lineAppendWidth":10},"selected":{"shadowColor":"#626262","shadowBlur":3}},"stroke":"#A3B1BF","lineWidth":2,"strokeOpacity":0.92,"lineAppendWidth":10},"labelCfg":{"position":"center","autoRotate":false},"startPoint":{"x":155.98812924510892,"y":285.35469287559994,"anchorIndex":1},"endPoint":{"x":304.3223042174235,"y":289.0267312661499,"anchorIndex":3},"curveOffset":[-20,20],"curvePosition":[0.5,0.5],"targetAnchor":3,"targetAttrs":[{"key":"id","type":"number(6)","comment":"主键id","isUse":1},{"key":"key","type":"varchar(255)","comment":"关键字","isUse":1},{"key":"gender","type":"enum(M, F)","comment":"gender","isUse":1},{"key":"birthday","type":"date","comment":"生日","isUse":1},{"key":"hometown","type":"varchar(255)","comment":"家乡","isUse":1},{"key":"country","type":"varchar(255)","comment":"国家","isUse":1},{"key":"nation","type":"varchar(255)","comment":"nation","isUse":1},{"key":"jobId","type":"number(3)","comment":"工作id","isUse":1},{"key":"phone","type":"varchar(255)","comment":"电话","isUse":1}],"depth":0}],"combos":[]},
|
graphData: {
|
||||||
|
// "nodes":[{"id":"305bfbdd-31cc-4028-b2b1-2f504968356d","x":304.8223042174235,"y":131.0267312661499,"label":"客户端","table":"test_table","type":"dice-er-box","attrs":[{"key":"id","type":"number(6)","comment":"主键id","isUse":0},{"key":"key","type":"varchar(255)","comment":"关键字","isUse":1},{"key":"gender","type":"enum(M, F)","comment":"gender","isUse":1},{"key":"birthday","type":"date","comment":"生日","isUse":0},{"key":"hometown","type":"varchar(255)","comment":"家乡","isUse":0},{"key":"country","type":"varchar(255)","comment":"国家","isUse":1},{"key":"nation","type":"varchar(255)","comment":"nation","isUse":1},{"key":"jobId","type":"number(3)","comment":"工作id","isUse":1},{"key":"phone","type":"varchar(255)","comment":"电话","isUse":1}],"size":[55,55],"width":250,"height":316,"anchorPoints":[[0.5,0],[1,0.5],[0.5,1],[0,0.5]],"appState":{"alert":false},"labelCfg":{"position":"bottom"},"style":{"default":{"stroke":"#CED4D9","fill":"transparent","shadowBlur":10,"shadowColor":"rgba(13, 26, 38, 0.08)","lineWidth":1,"radius":4,"strokeOpacity":0.7},"selected":{"shadowColor":"#ff240b","shadowBlur":2},"unselected":{"shadowColor":""}},"selectedIndex":null,"appConfig":{},"depth":0},{"id":"be9b52e5-9c2f-4e5c-990a-afbf19dcfeed","x":-94.51187075489108,"y":127.35469287559994,"label":"防火墙","table":"test_table","type":"dice-er-box","attrs":[{"key":"id","type":"number(6)","comment":"主键id","isUse":0},{"key":"key","type":"varchar(255)","comment":"关键字","isUse":1},{"key":"gender","type":"enum(M, F)","comment":"gender","isUse":0},{"key":"birthday","type":"date","comment":"生日","isUse":1},{"key":"hometown","type":"varchar(255)","comment":"家乡","isUse":1},{"key":"country","type":"varchar(255)","comment":"国家","isUse":0},{"key":"nation","type":"varchar(255)","comment":"nation","isUse":1},{"key":"jobId","type":"number(3)","comment":"工作id","isUse":1},{"key":"phone","type":"varchar(255)","comment":"电话","isUse":1}],"size":[55,55],"width":250,"height":316,"anchorPoints":[[0.5,0],[1,0.5],[0.5,1],[0,0.5]],"appState":{"alert":false},"labelCfg":{"position":"bottom"},"style":{"default":{"stroke":"#CED4D9","fill":"transparent","shadowBlur":10,"shadowColor":"rgba(13, 26, 38, 0.08)","lineWidth":1,"radius":4,"strokeOpacity":0.7},"selected":{"shadowColor":"#ff240b","shadowBlur":2},"unselected":{"shadowColor":""}},"selectedIndex":null,"appConfig":{},"startIndex":0,"startX":0,"depth":0}],"edges":[{"id":"8bc0249e-ee5d-4dd7-84e0-e4e32c217f2a","source":"be9b52e5-9c2f-4e5c-990a-afbf19dcfeed","sourceAttrs":[{"key":"id","type":"number(6)","comment":"主键id","isUse":1},{"key":"key","type":"varchar(255)","comment":"关键字","isUse":1},{"key":"gender","type":"enum(M, F)","comment":"gender","isUse":1},{"key":"birthday","type":"date","comment":"生日","isUse":1},{"key":"hometown","type":"varchar(255)","comment":"家乡","isUse":1},{"key":"country","type":"varchar(255)","comment":"国家","isUse":1},{"key":"nation","type":"varchar(255)","comment":"nation","isUse":1},{"key":"jobId","type":"number(3)","comment":"工作id","isUse":1},{"key":"phone","type":"varchar(255)","comment":"电话","isUse":1}],"sourceAnchor":1,"target":"305bfbdd-31cc-4028-b2b1-2f504968356d","type":"top-cubic","style":{"active":{"stroke":"rgb(95, 149, 255)","lineWidth":1},"selected":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"shadowColor":"rgb(95, 149, 255)","shadowBlur":10,"text-shape":{"fontWeight":500}},"highlight":{"stroke":"rgb(95, 149, 255)","lineWidth":2,"text-shape":{"fontWeight":500}},"inactive":{"stroke":"rgb(234, 234, 234)","lineWidth":1},"disable":{"stroke":"rgb(245, 245, 245)","lineWidth":1},"edgeStyle":{"default":{"stroke":"#e2e2e2","lineWidth":3,"lineAppendWidth":10},"selected":{"shadowColor":"#626262","shadowBlur":3}},"stroke":"#A3B1BF","lineWidth":2,"strokeOpacity":0.92,"lineAppendWidth":10},"labelCfg":{"position":"center","autoRotate":false},"startPoint":{"x":155.98812924510892,"y":285.35469287559994,"anchorIndex":1},"endPoint":{"x":304.3223042174235,"y":289.0267312661499,"anchorIndex":3},"curveOffset":[-20,20],"curvePosition":[0.5,0.5],"targetAnchor":3,"targetAttrs":[{"key":"id","type":"number(6)","comment":"主键id","isUse":1},{"key":"key","type":"varchar(255)","comment":"关键字","isUse":1},{"key":"gender","type":"enum(M, F)","comment":"gender","isUse":1},{"key":"birthday","type":"date","comment":"生日","isUse":1},{"key":"hometown","type":"varchar(255)","comment":"家乡","isUse":1},{"key":"country","type":"varchar(255)","comment":"国家","isUse":1},{"key":"nation","type":"varchar(255)","comment":"nation","isUse":1},{"key":"jobId","type":"number(3)","comment":"工作id","isUse":1},{"key":"phone","type":"varchar(255)","comment":"电话","isUse":1}],"depth":0}],"combos":[]},
|
||||||
|
},
|
||||||
nodeTypeList: [
|
nodeTypeList: [
|
||||||
// { guid: "blue", label: "蓝色", imgSrc: require("../../assets/images/blue.svg") },
|
// { guid: "blue", label: "蓝色", imgSrc: require("../../assets/images/blue.svg") },
|
||||||
// { guid: "green", label: "绿色", imgSrc: require("@/assets/images/green.svg") },
|
// { guid: "green", label: "绿色", imgSrc: require("@/assets/images/green.svg") },
|
||||||
// { guid: "purple", label: "紫色", imgSrc: require("@/assets/images/purple.svg") }
|
// { guid: "purple", label: "紫色", imgSrc: require("@/assets/images/purple.svg") }
|
||||||
],
|
],
|
||||||
|
relationalMap: [],
|
||||||
// 节点配置
|
// 节点配置
|
||||||
nodeAppConfig: {
|
nodeAppConfig: {
|
||||||
// ip: '节点IP',
|
// ip: '节点IP',
|
||||||
|
|
@ -47,9 +53,19 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let graphData = deepClone(this.graphData)
|
this.topId = this.$route.params && this.$route.params.topId;
|
||||||
this.$refs.topology.initTopo(graphData)
|
getQuery(this.topId).then(res =>{
|
||||||
this.randomChange()
|
console.log(res)
|
||||||
|
this.graphData = JSON.parse(res.data.topJson)
|
||||||
|
let graphData = deepClone(this.graphData)
|
||||||
|
this.$refs.topology.initTopo(graphData)
|
||||||
|
this.randomChange()
|
||||||
|
})
|
||||||
|
getTables().then(res =>{
|
||||||
|
console.log(res)
|
||||||
|
this.nodeTypeList = res.data.tables
|
||||||
|
this.relationalMap = res.data.relationalMap
|
||||||
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
doAutoRefresh(interval) {
|
doAutoRefresh(interval) {
|
||||||
|
|
@ -74,7 +90,15 @@ export default {
|
||||||
this.randomChange()
|
this.randomChange()
|
||||||
},
|
},
|
||||||
doSaveData(graphData) {
|
doSaveData(graphData) {
|
||||||
console.log(JSON.stringify(graphData))
|
let data = {
|
||||||
|
id : this.topId,
|
||||||
|
topJson:JSON.stringify(graphData)
|
||||||
|
}
|
||||||
|
//todo 入库完成
|
||||||
|
updateQuery(data).then(res =>{
|
||||||
|
console.log(res)
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
randomChange() {
|
randomChange() {
|
||||||
let graphData = deepClone(this.$refs.topology.getGraphData())
|
let graphData = deepClone(this.$refs.topology.getGraphData())
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,8 @@ spring:
|
||||||
# url: jdbc:mysql://114.215.82.135:3306/hcybase?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://114.215.82.135:3306/hcybase?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# username: hcybase
|
# username: hcybase
|
||||||
# password: hcybase@2020
|
# password: hcybase@2020
|
||||||
url: jdbc:mysql://13.75.92.40:3306/gen?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://13.75.92.40:3306/gen?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
# url: jdbc:mysql://10.0.0.4:3306/gen?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://127.0.0.1:3306/gen?useUnicode=true&characterEncoding=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: gen
|
username: gen
|
||||||
password: zcsbKxPseM8LhFdT
|
password: zcsbKxPseM8LhFdT
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
|
|
|
||||||
|
|
@ -87,8 +87,8 @@ spring:
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
# host: 114.215.82.135
|
# host: 114.215.82.135
|
||||||
# host: 127.0.0.1
|
host: 127.0.0.1
|
||||||
host: 13.70.28.14
|
# host: 13.70.28.14
|
||||||
# 端口,默认为6379
|
# 端口,默认为6379
|
||||||
port: 6379
|
port: 6379
|
||||||
# 密码
|
# 密码
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,88 @@
|
||||||
|
package com.ebts.generator.controller;
|
||||||
|
|
||||||
|
import com.ebts.common.annotation.Log;
|
||||||
|
import com.ebts.common.core.entity.AjaxResult;
|
||||||
|
import com.ebts.common.enums.BusinessType;
|
||||||
|
import com.ebts.common.utils.ServerResult;
|
||||||
|
import com.ebts.common.utils.StringUtils;
|
||||||
|
import com.ebts.generator.entity.UniQuery;
|
||||||
|
import com.ebts.generator.service.TopQueryService;
|
||||||
|
import com.ebts.generator.service.TopSearchTableService;
|
||||||
|
import com.ebts.generator.service.UniQueryService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: Clay
|
||||||
|
* @date: 2021/7/23 21:36
|
||||||
|
* @description:TopQueryController
|
||||||
|
* @email: clay@hchyun.com
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/top")
|
||||||
|
public class TopQueryController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TopSearchTableService topSearchTableService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UniQueryService uniQueryService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TopQueryService topQueryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取基本信息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ebts.hasPermi('top:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
|
ServerResult<UniQuery> ServerResult = uniQueryService.selectUniQueryById(id);
|
||||||
|
if (ServerResult.isStart()) {
|
||||||
|
return AjaxResult.success(ServerResult.getData());
|
||||||
|
} else {
|
||||||
|
return AjaxResult.info(ServerResult.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取基本信息
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ebts.hasPermi('top:table')")
|
||||||
|
@GetMapping
|
||||||
|
public AjaxResult table() {
|
||||||
|
|
||||||
|
return AjaxResult.success(topQueryService.selectTopSearchTables());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 简单修改万能能查询
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ebts.hasPermi('top:edit')")
|
||||||
|
@Log(title = "万能查询", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody UniQuery uniQuery) {
|
||||||
|
if (uniQuery.getId()<0){
|
||||||
|
return AjaxResult.error("缺少关键字段");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNull(uniQuery.getTopJson())){
|
||||||
|
return AjaxResult.error("缺少关键字段");
|
||||||
|
}
|
||||||
|
ServerResult<Integer> ServerResult = uniQueryService.updateUniQuery(uniQuery);
|
||||||
|
if (ServerResult.isStart()) {
|
||||||
|
return AjaxResult.success();
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error(ServerResult.getMsg());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -27,6 +27,8 @@ public interface TopSearchTableDao {
|
||||||
*/
|
*/
|
||||||
List<TopSearchTable> selectTopSearchTableList(TopSearchTable topSearchTable);
|
List<TopSearchTable> selectTopSearchTableList(TopSearchTable topSearchTable);
|
||||||
|
|
||||||
|
List<TopSearchTable> selectTopSearchTables();
|
||||||
|
|
||||||
|
|
||||||
List<TopSearchColumn> selectTableColumns(Long id);
|
List<TopSearchColumn> selectTableColumns(Long id);
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,11 @@ public class UniQuery extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String uqDescribe;
|
private String uqDescribe;
|
||||||
|
|
||||||
|
private String topJson;
|
||||||
|
|
||||||
|
|
||||||
|
private int type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否发布(0:否,1:发布)
|
* 是否发布(0:否,1:发布)
|
||||||
*/
|
*/
|
||||||
|
|
@ -46,7 +51,21 @@ public class UniQuery extends BaseEntity {
|
||||||
|
|
||||||
private Integer pageSize;
|
private Integer pageSize;
|
||||||
|
|
||||||
|
public String getTopJson() {
|
||||||
|
return topJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTopJson(String topJson) {
|
||||||
|
this.topJson = topJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getIsRelease() {
|
public Integer getIsRelease() {
|
||||||
return isRelease;
|
return isRelease;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.ebts.generator.service;
|
||||||
|
|
||||||
|
import com.ebts.generator.entity.TopSearchTable;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: Clay
|
||||||
|
* @date: 2021/7/23 21:51
|
||||||
|
* @description:TopQueryService
|
||||||
|
* @email: clay@hchyun.com
|
||||||
|
*/
|
||||||
|
public interface TopQueryService {
|
||||||
|
|
||||||
|
Map<String, Object> selectTopSearchTables();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.ebts.generator.service.impl;
|
||||||
|
|
||||||
|
import com.ebts.generator.dao.RelationalMapDao;
|
||||||
|
import com.ebts.generator.dao.TopSearchTableDao;
|
||||||
|
import com.ebts.generator.entity.RelationalMap;
|
||||||
|
import com.ebts.generator.service.TopQueryService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: Clay
|
||||||
|
* @date: 2021/7/23 21:51
|
||||||
|
* @description:TopQueryServiceImpl
|
||||||
|
* @email: clay@hchyun.com
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class TopQueryServiceImpl implements TopQueryService {
|
||||||
|
@Autowired
|
||||||
|
private TopSearchTableDao topSearchTableDao;
|
||||||
|
@Autowired
|
||||||
|
private RelationalMapDao relationalMapDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> selectTopSearchTables() {
|
||||||
|
Map<String,Object> modeMap = new HashMap<>();
|
||||||
|
modeMap.put("tables",topSearchTableDao.selectTopSearchTables());
|
||||||
|
modeMap.put("relationalMap",relationalMapDao.selectRelationalMapList(new RelationalMap()));
|
||||||
|
return modeMap;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -78,6 +78,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where gtst.id = #{id}
|
where gtst.id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectTopSearchTables" resultMap="TopSearchTableTopSearchColumnResult">
|
||||||
|
select gtst.id, gtst.table_name, gtst.table_comment, gtst.remark, gtst.create_by, gtst.create_time, gtst.update_by, gtst.update_time,
|
||||||
|
gtsc.id as column_id, gtsc.search_table_id, gtsc.column_name, gtsc.column_comment, gtsc.column_type, gtsc.is_use, gtsc.create_by, gtsc.create_time, gtsc.update_by, gtsc.update_time,
|
||||||
|
grm.main_id, grm.child_id, grm.main_key, grm.child_key, grm.type
|
||||||
|
from gen_top_search_table gtst
|
||||||
|
left join gen_top_search_column gtsc on gtsc.search_table_id = gtst.id
|
||||||
|
left join gen_relational_mapping grm on grm.main_id = gtst.id
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectDbTableListByNames" resultMap="TopSearchTableResult">
|
<select id="selectDbTableListByNames" resultMap="TopSearchTableResult">
|
||||||
select table_name, table_comment, create_time, update_time from information_schema.tables
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
where table_name NOT LIKE 'qrtz_%' and table_name NOT LIKE 'gen_%' and table_schema = (select database())
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@
|
||||||
<result property="uqSql" column="uq_sql" />
|
<result property="uqSql" column="uq_sql" />
|
||||||
<result property="uqDescribe" column="uq_describe" />
|
<result property="uqDescribe" column="uq_describe" />
|
||||||
<result property="isRelease" column="is_release" />
|
<result property="isRelease" column="is_release" />
|
||||||
|
<result property="topJson" column="top_json" />
|
||||||
|
<result property="type" column="type" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
|
|
@ -18,7 +20,7 @@
|
||||||
|
|
||||||
|
|
||||||
<sql id="selectUniQueryVo">
|
<sql id="selectUniQueryVo">
|
||||||
select id, uq_name, uq_sql, uq_describe, is_release, create_by, create_time, update_by, update_time from gen_uni_query
|
select id, uq_name, uq_sql, uq_describe, type, is_release, create_by, create_time, update_by, update_time from gen_uni_query
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectUniQueryList" parameterType="UniQuery" resultMap="UniQueryResult">
|
<select id="selectUniQueryList" parameterType="UniQuery" resultMap="UniQueryResult">
|
||||||
|
|
@ -26,13 +28,13 @@
|
||||||
<where>
|
<where>
|
||||||
<if test="uqName != null and uqName != ''"> and uq_name like concat('%', #{uqName}, '%')</if>
|
<if test="uqName != null and uqName != ''"> and uq_name like concat('%', #{uqName}, '%')</if>
|
||||||
<if test="uqDescribe != null and uqDescribe != ''"> and uq_describe like concat('%', #{uqDescribe}, '%')</if>
|
<if test="uqDescribe != null and uqDescribe != ''"> and uq_describe like concat('%', #{uqDescribe}, '%')</if>
|
||||||
|
<if test="type != null and type != ''"> and type = #{type} </if>
|
||||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectUniQueryById" parameterType="Long" resultMap="UniQueryResult">
|
<select id="selectUniQueryById" parameterType="Long" resultMap="UniQueryResult">
|
||||||
<include refid="selectUniQueryVo"/>
|
select * from gen_uni_query where id = #{id}
|
||||||
where id = #{id}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertUniQuery" parameterType="UniQuery" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertUniQuery" parameterType="UniQuery" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
|
@ -41,6 +43,8 @@
|
||||||
<if test="uqName != null and uqName != ''">uq_name,</if>
|
<if test="uqName != null and uqName != ''">uq_name,</if>
|
||||||
<if test="uqSql != null">uq_sql,</if>
|
<if test="uqSql != null">uq_sql,</if>
|
||||||
<if test="uqDescribe != null and uqDescribe != ''">uq_describe,</if>
|
<if test="uqDescribe != null and uqDescribe != ''">uq_describe,</if>
|
||||||
|
<if test="type != null and type != ''">type,</if>
|
||||||
|
<if test="topJson != null and topJson != ''">top_json,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="updateBy != null">update_by,</if>
|
<if test="updateBy != null">update_by,</if>
|
||||||
</trim>
|
</trim>
|
||||||
|
|
@ -48,6 +52,8 @@
|
||||||
<if test="uqName != null and uqName != ''">#{uqName},</if>
|
<if test="uqName != null and uqName != ''">#{uqName},</if>
|
||||||
<if test="uqSql != null">#{uqSql},</if>
|
<if test="uqSql != null">#{uqSql},</if>
|
||||||
<if test="uqDescribe != null and uqDescribe != ''">#{uqDescribe},</if>
|
<if test="uqDescribe != null and uqDescribe != ''">#{uqDescribe},</if>
|
||||||
|
<if test="type != null and type != ''">#{type},</if>
|
||||||
|
<if test="topJson != null and topJson != ''">#{topJson},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="updateBy != null">#{updateBy},</if>
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
</trim>
|
</trim>
|
||||||
|
|
@ -59,6 +65,8 @@
|
||||||
<if test="uqName != null and uqName != ''">uq_name = #{uqName},</if>
|
<if test="uqName != null and uqName != ''">uq_name = #{uqName},</if>
|
||||||
<if test="uqSql != null">uq_sql = #{uqSql},</if>
|
<if test="uqSql != null">uq_sql = #{uqSql},</if>
|
||||||
<if test="uqDescribe != null and uqDescribe != ''">uq_describe = #{uqDescribe},</if>
|
<if test="uqDescribe != null and uqDescribe != ''">uq_describe = #{uqDescribe},</if>
|
||||||
|
<if test="type != null and type != ''">type = #{type},</if>
|
||||||
|
<if test="topJson != null and topJson != ''">top_json = #{topJson},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
</trim>
|
</trim>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue