Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
45a93030f3
|
|
@ -95,6 +95,7 @@ export function addCreateDateRange(params, dateRange) {
|
||||||
|
|
||||||
// 回显数据字典
|
// 回显数据字典
|
||||||
export function selectDictLabel(datas, value) {
|
export function selectDictLabel(datas, value) {
|
||||||
|
console.log(datas)
|
||||||
let actions = [];
|
let actions = [];
|
||||||
Object.keys(datas).some((key) => {
|
Object.keys(datas).some((key) => {
|
||||||
if (datas[key].dictValue === ('' + value)) {
|
if (datas[key].dictValue === ('' + value)) {
|
||||||
|
|
|
||||||
|
|
@ -60,23 +60,38 @@
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table :data="realDate.data">
|
<el-table :data="realDate.data">
|
||||||
<span v-for="(item,index) in realDate.header">
|
<el-table-column v-for="(item,index) in realDate.header"
|
||||||
<el-table-column v-if="checkDateType(item.prop)"
|
:label="item.label"
|
||||||
:label="item.label"
|
align="center"
|
||||||
align="center"
|
:key="index"
|
||||||
:key="index"
|
:prop="item.prop">
|
||||||
:prop="item.prop">
|
<template slot-scope="scope">
|
||||||
<template slot-scope="scope">
|
<span v-if="checkDateType(item.prop)">
|
||||||
{{ parseDateOrTime(scope.row[item.prop]) }}
|
{{ parseDateOrTime(scope.row[item.prop]) }}
|
||||||
</template>
|
</span>
|
||||||
</el-table-column>
|
<span v-else-if="item.dictType!=null">
|
||||||
<el-table-column v-else
|
{{ dictFormat(item.dictType, scope.row[item.prop]) }}
|
||||||
:label="item.label"
|
</span>
|
||||||
align="center"
|
<span v-else>{{ scope.row[item.prop] }}</span>
|
||||||
:key="index"
|
</template>
|
||||||
:prop="item.prop"
|
</el-table-column>
|
||||||
/>
|
<!-- <span v-for="(item,index) in realDate.header">-->
|
||||||
</span>
|
<!-- <el-table-column v-if="checkDateType(item.prop)"-->
|
||||||
|
<!-- :label="item.label"-->
|
||||||
|
<!-- align="center"-->
|
||||||
|
<!-- :key="index"-->
|
||||||
|
<!-- :prop="item.prop">-->
|
||||||
|
<!-- <template slot-scope="scope">-->
|
||||||
|
<!-- {{ parseDateOrTime(scope.row[item.prop]) }}-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </el-table-column>-->
|
||||||
|
<!-- <el-table-column v-else-->
|
||||||
|
<!-- :label="item.label"-->
|
||||||
|
<!-- align="center"-->
|
||||||
|
<!-- :key="index"-->
|
||||||
|
<!-- :prop="item.prop"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </span>-->
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
|
|
@ -114,6 +129,7 @@ export default {
|
||||||
data: [],
|
data: [],
|
||||||
header: [],
|
header: [],
|
||||||
},
|
},
|
||||||
|
dictTypeDataList:{},
|
||||||
total: 0,
|
total: 0,
|
||||||
queryParams: {
|
queryParams: {
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
|
|
@ -127,10 +143,21 @@ export default {
|
||||||
let data = res.data
|
let data = res.data
|
||||||
this.uconList = listInit(data.uniCons)
|
this.uconList = listInit(data.uniCons)
|
||||||
this.realDate.header = data.infoList
|
this.realDate.header = data.infoList
|
||||||
|
this.dictTypeDataList = data.dictList
|
||||||
})
|
})
|
||||||
|
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 字典渲染
|
||||||
|
* @param dictType
|
||||||
|
* @param data
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
dictFormat(dictType, data) {
|
||||||
|
return this.selectDictLabel(this.dictTypeDataList[dictType], data)
|
||||||
|
},
|
||||||
outPlaceholder(item) {
|
outPlaceholder(item) {
|
||||||
return "请输入" + item.ucName
|
return "请输入" + item.ucName
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -130,23 +130,40 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="el-table">
|
<div class="el-table">
|
||||||
<el-table v-show="previewDate.open" :data="previewDate.data">
|
<el-table v-show="previewDate.open" :data="previewDate.data">
|
||||||
<span v-for="(item,index) in previewDate.header">
|
<el-table-column v-for="(item,index) in previewDate.header"
|
||||||
<el-table-column v-if="checkDateType(item.prop)"
|
:label="item.label"
|
||||||
:label="item.label"
|
align="center"
|
||||||
align="center"
|
:key="index"
|
||||||
:key="index"
|
:prop="item.prop">
|
||||||
:prop="item.prop">
|
<template slot-scope="scope">
|
||||||
<template slot-scope="scope">
|
<span v-if="checkDateType(item.prop)">
|
||||||
{{ parseDateOrTime(scope.row[item.prop]) }}
|
{{ parseDateOrTime(scope.row[item.prop]) }}
|
||||||
</template>
|
</span>
|
||||||
</el-table-column>
|
<span v-else-if="item.dictType!=null">
|
||||||
<el-table-column v-else
|
{{ dictFormat(item.dictType, scope.row[item.prop]) }}
|
||||||
:label="item.label"
|
</span>
|
||||||
align="center"
|
<span v-else>{{ scope.row[item.prop] }}</span>
|
||||||
:key="index"
|
</template>
|
||||||
:prop="item.prop"
|
</el-table-column>
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
|
<!-- <span v-for="(item,index) in previewDate.header">-->
|
||||||
|
<!-- <el-table-column v-if="checkDateType(item.prop)"-->
|
||||||
|
<!-- :label="item.label"-->
|
||||||
|
<!-- align="center"-->
|
||||||
|
<!-- :key="index"-->
|
||||||
|
<!-- :prop="item.prop">-->
|
||||||
|
<!-- <template slot-scope="scope">-->
|
||||||
|
<!-- {{ parseDateOrTime(scope.row[item.prop]) }}-->
|
||||||
|
<!-- </template>-->
|
||||||
|
<!-- </el-table-column>-->
|
||||||
|
<!-- <el-table-column v-else-->
|
||||||
|
<!-- :label="item.label"-->
|
||||||
|
<!-- align="center"-->
|
||||||
|
<!-- :key="index"-->
|
||||||
|
<!-- :prop="item.prop"-->
|
||||||
|
<!-- />-->
|
||||||
|
<!-- </span>-->
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
|
|
@ -161,7 +178,7 @@
|
||||||
:visible.sync="columnInfo.open"
|
:visible.sync="columnInfo.open"
|
||||||
width="40%"
|
width="40%"
|
||||||
>
|
>
|
||||||
<el-table ref="columnInfoTable" :data="columnInfo.list" row-key="column">
|
<el-table max-height="650px" ref="columnInfoTable" :data="columnInfo.list" row-key="column">
|
||||||
<el-table-column label="字段信息" min-width="10%">
|
<el-table-column label="字段信息" min-width="10%">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-model="scope.row.prop"></el-input>
|
<el-input v-model="scope.row.prop"></el-input>
|
||||||
|
|
@ -172,7 +189,7 @@
|
||||||
<el-input v-model="scope.row.label"></el-input>
|
<el-input v-model="scope.row.label"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="字典类型" min-width="10%">
|
<el-table-column label="显示字典类型" min-width="10%">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
|
<el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
|
||||||
<el-option
|
<el-option
|
||||||
|
|
@ -309,6 +326,7 @@ export default {
|
||||||
data: [],
|
data: [],
|
||||||
header: []
|
header: []
|
||||||
},
|
},
|
||||||
|
dictTypeDataList:{},
|
||||||
rules: {
|
rules: {
|
||||||
uqName: [{required: true, message: '请输入名称', trigger: 'blur'}],
|
uqName: [{required: true, message: '请输入名称', trigger: 'blur'}],
|
||||||
uqDescribe: [{required: true, message: '请输入描述', trigger: 'blur'}]
|
uqDescribe: [{required: true, message: '请输入描述', trigger: 'blur'}]
|
||||||
|
|
@ -337,9 +355,25 @@ export default {
|
||||||
mounted() {
|
mounted() {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 字典渲染
|
||||||
|
* @param dictType
|
||||||
|
* @param data
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
dictFormat(dictType, data) {
|
||||||
|
return this.selectDictLabel(this.dictTypeDataList[dictType], data)
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 字段信息列删除
|
||||||
|
* @param index
|
||||||
|
*/
|
||||||
columnInfoDelete(index) {
|
columnInfoDelete(index) {
|
||||||
this.columnInfo.list.splice(index, 1)
|
this.columnInfo.list.splice(index, 1)
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 重置字段信息
|
||||||
|
*/
|
||||||
resetFieldExtract() {
|
resetFieldExtract() {
|
||||||
this.columnInfo.list = []
|
this.columnInfo.list = []
|
||||||
this.previewDate.header = []
|
this.previewDate.header = []
|
||||||
|
|
@ -378,6 +412,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let columnList = []
|
let columnList = []
|
||||||
|
this.columnInfo.list = []
|
||||||
this.previewDate.header.forEach(item => {
|
this.previewDate.header.forEach(item => {
|
||||||
columnList.push({
|
columnList.push({
|
||||||
prop: item.key,
|
prop: item.key,
|
||||||
|
|
@ -475,15 +510,14 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
/** 预览 */
|
/** 预览 */
|
||||||
previewQuery() {
|
previewQuery(){
|
||||||
this.$refs['elForm'].validate(valid => {
|
this.$refs['elForm'].validate( valid=>{
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let list = JSONString(this.columns)
|
let list = JSONString(this.columns)
|
||||||
let data = {
|
let data = {
|
||||||
pageNum: this.queryParams.pageNum,
|
pageNum: this.queryParams.pageNum,
|
||||||
pageSize: this.queryParams.pageSize,
|
pageSize: this.queryParams.pageSize,
|
||||||
uqSql: this.info.uqSql
|
uqSql: this.info.uqSql
|
||||||
|
|
||||||
}
|
}
|
||||||
if (list.length > 0) {
|
if (list.length > 0) {
|
||||||
if (this.changUniCon(list)) {
|
if (this.changUniCon(list)) {
|
||||||
|
|
@ -492,6 +526,17 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for (let i = 0; i < this.columnInfo.list.length; i++) {
|
||||||
|
let info = this.columnInfo.list[i]
|
||||||
|
if (info.dictType!=null){
|
||||||
|
this.getDicts(info.dictType).then(res=>{
|
||||||
|
this.dictTypeDataList[info.dictType] = res.data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 预览数据请求
|
||||||
|
*/
|
||||||
previewQueryData(data).then(res => {
|
previewQueryData(data).then(res => {
|
||||||
this.previewDate.data = res.rows
|
this.previewDate.data = res.rows
|
||||||
this.total = res.total
|
this.total = res.total
|
||||||
|
|
@ -624,6 +669,7 @@ export default {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
data.infoList = that.columnInfo.list
|
||||||
return exportMock(data)
|
return exportMock(data)
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
that.columns = JSONParse(list)
|
that.columns = JSONParse(list)
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<el-dialog :title="selectedNodeParams.label" width="1200px"
|
<el-dialog :title="selectedNodeParams.label" width="1300px"
|
||||||
:visible.sync="tableColumnEditOpen"
|
:visible.sync="tableColumnEditOpen"
|
||||||
@close="closeEditColumns">
|
@close="closeEditColumns">
|
||||||
<el-table
|
<el-table
|
||||||
|
|
@ -203,7 +203,8 @@
|
||||||
<el-input v-model="scope.row.ucName" placeholder="请输入条件描述"/>
|
<el-input v-model="scope.row.ucName" placeholder="请输入条件描述"/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="条件">
|
<el-table-column label="条件"
|
||||||
|
width="150px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.ucCon" @change="ucTypeChang(scope.$index,scope.row)">
|
<el-select v-model="scope.row.ucCon" @change="ucTypeChang(scope.$index,scope.row)">
|
||||||
<el-option label="=" value="EQ"/>
|
<el-option label="=" value="EQ"/>
|
||||||
|
|
@ -217,7 +218,8 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="显示类型">
|
<el-table-column label="显示类型"
|
||||||
|
width="150px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-select v-model="scope.row.ucType" @change="ucTypeChang(scope.$index,scope.row)">
|
<el-select v-model="scope.row.ucType" @change="ucTypeChang(scope.$index,scope.row)">
|
||||||
<el-option label="文本框" value="input"/>
|
<el-option label="文本框" value="input"/>
|
||||||
|
|
@ -225,7 +227,8 @@
|
||||||
</el-select>
|
</el-select>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="模拟数据">
|
<el-table-column label="模拟数据"
|
||||||
|
width="260px">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-input v-if="scope.row.type == 1" placeholder="请输入模拟数据" v-model="scope.row.ucMock"></el-input>
|
<el-input v-if="scope.row.type == 1" placeholder="请输入模拟数据" v-model="scope.row.ucMock"></el-input>
|
||||||
<div v-else-if="scope.row.type == 2">
|
<div v-else-if="scope.row.type == 2">
|
||||||
|
|
@ -258,6 +261,20 @@
|
||||||
></el-date-picker>
|
></el-date-picker>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="显示字典类型" width="150px">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dictTypeList"
|
||||||
|
:key="dict.dictType"
|
||||||
|
:label="dict.dictName"
|
||||||
|
:value="dict.dictType">
|
||||||
|
<span style="float: left">{{ dict.dictName }}</span>
|
||||||
|
<span style="float: right; color: #8492a6; font-size: 13px">{{ dict.dictType }}</span>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -325,6 +342,7 @@ export default {
|
||||||
nodes: [],
|
nodes: [],
|
||||||
edges: []
|
edges: []
|
||||||
},
|
},
|
||||||
|
dictTypeList:[],
|
||||||
// 表格Column设置弹窗开关
|
// 表格Column设置弹窗开关
|
||||||
tableColumnEditOpen:false,
|
tableColumnEditOpen:false,
|
||||||
loading: false,
|
loading: false,
|
||||||
|
|
@ -332,11 +350,6 @@ export default {
|
||||||
clientHeight: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
|
clientHeight: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
|
||||||
//todo 设置线段的选择 er图中只有一种线
|
//todo 设置线段的选择 er图中只有一种线
|
||||||
edgeShapeList: [
|
edgeShapeList: [
|
||||||
// { guid: "top-line", label: "直线", class: "iconfont icon-flow-line" },
|
|
||||||
// { guid: "dice-er-edge", label: "连线", class: "iconfont icon-flow-line" },
|
|
||||||
// { guid: "top-brokenline", label: "折线", class: "iconfont icon-flow-broken" },
|
|
||||||
// { guid: "top-polyline", label: "多段线", class: "iconfont icon-flow-broken" },
|
|
||||||
// { guid: "top-cubic", label: "曲线", class: "iconfont icon-flow-curve" }
|
|
||||||
],
|
],
|
||||||
graph: null,
|
graph: null,
|
||||||
grid: null,
|
grid: null,
|
||||||
|
|
@ -510,7 +523,6 @@ export default {
|
||||||
// 修改字段信息
|
// 修改字段信息
|
||||||
editColumns() {
|
editColumns() {
|
||||||
this.tableColumnEditOpen = true
|
this.tableColumnEditOpen = true
|
||||||
|
|
||||||
},
|
},
|
||||||
// 连线的三个选择框触发实践
|
// 连线的三个选择框触发实践
|
||||||
tableCommentChang(e) {
|
tableCommentChang(e) {
|
||||||
|
|
@ -583,6 +595,9 @@ export default {
|
||||||
},
|
},
|
||||||
dragendHandler() {
|
dragendHandler() {
|
||||||
},
|
},
|
||||||
|
tranDictData(list){
|
||||||
|
this.dictTypeList = list
|
||||||
|
},
|
||||||
initTopo(graphData) {
|
initTopo(graphData) {
|
||||||
let self = this
|
let self = this
|
||||||
if (self.graph) {
|
if (self.graph) {
|
||||||
|
|
@ -1162,6 +1177,7 @@ export default {
|
||||||
item.type = 1
|
item.type = 1
|
||||||
item.ucMock = ''
|
item.ucMock = ''
|
||||||
item.ucName = item.columnComment
|
item.ucName = item.columnComment
|
||||||
|
item.dictType = null
|
||||||
columns.push(item)
|
columns.push(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,23 +80,21 @@
|
||||||
<right-toolbar :showSearch.sync="previewDate.showSearch" @queryTable="handleQuery"></right-toolbar>
|
<right-toolbar :showSearch.sync="previewDate.showSearch" @queryTable="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-table :data="previewDate.data">
|
<el-table :data="previewDate.data">
|
||||||
<span v-for="(item,index) in previewDate.header">
|
<el-table-column v-for="(item,index) in previewDate.header"
|
||||||
<el-table-column v-if="checkDateType(item.prop)"
|
:label="item.label"
|
||||||
:label="item.label"
|
align="center"
|
||||||
align="center"
|
:key="index"
|
||||||
:key="index"
|
:prop="item.prop">
|
||||||
:prop="item.prop">
|
<template slot-scope="scope">
|
||||||
<template slot-scope="scope">
|
<span v-if="checkDateType(item.prop)">
|
||||||
{{ parseDateOrTime(scope.row[item.prop]) }}
|
{{ parseDateOrTime(scope.row[item.prop]) }}
|
||||||
</template>
|
</span>
|
||||||
</el-table-column>
|
<span v-else-if="item.dictType!=null">
|
||||||
<el-table-column v-else
|
{{ dictFormat(item.dictType, scope.row[item.prop]) }}
|
||||||
:label="item.label"
|
</span>
|
||||||
align="center"
|
<span v-else>{{ scope.row[item.prop] }}</span>
|
||||||
:key="index"
|
</template>
|
||||||
:prop="item.prop"
|
</el-table-column>
|
||||||
/>
|
|
||||||
</span>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination
|
||||||
v-show="previewDate.total>0"
|
v-show="previewDate.total>0"
|
||||||
|
|
@ -113,13 +111,15 @@
|
||||||
<script>
|
<script>
|
||||||
/* 局部注册 */
|
/* 局部注册 */
|
||||||
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, preview } from '@/api/tool/top'
|
import {getQuery, getTables, updateQuery, preview} from '@/api/tool/top'
|
||||||
import { realData } from '@/api/system/data'
|
import {realData} from '@/api/system/data'
|
||||||
import { exportReal } from '../../../api/system/data'
|
import {exportReal} from '@/api/system/data'
|
||||||
|
import {optionSelect} from "@/api/system/dict/type";
|
||||||
import {eventBus} from "@/views/tool/top/utils/eventBus";
|
import {eventBus} from "@/views/tool/top/utils/eventBus";
|
||||||
import {Release} from "@/api/tool/query";
|
import {Release} from "@/api/tool/query";
|
||||||
import {Message} from "element-ui";
|
import {Message} from "element-ui";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DemoTopology',
|
name: 'DemoTopology',
|
||||||
components: {
|
components: {
|
||||||
|
|
@ -162,14 +162,15 @@ export default {
|
||||||
tableComment: '主表字段',
|
tableComment: '主表字段',
|
||||||
relComment: '关联字段'
|
relComment: '关联字段'
|
||||||
},
|
},
|
||||||
autoRefreshTimer: null
|
autoRefreshTimer: null,
|
||||||
|
dictTypeDataList: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.topId = this.$route.params && this.$route.params.topId
|
this.topId = this.$route.params && this.$route.params.topId
|
||||||
getQuery(this.topId).then(res => {
|
getQuery(this.topId).then(res => {
|
||||||
this.baseData = res.data
|
this.baseData = res.data
|
||||||
eventBus.$emit('isRelease',this.baseData.isRelease)
|
eventBus.$emit('isRelease', this.baseData.isRelease)
|
||||||
|
|
||||||
console.log(res.data)
|
console.log(res.data)
|
||||||
if (res.data.topJson) {
|
if (res.data.topJson) {
|
||||||
|
|
@ -189,8 +190,21 @@ export default {
|
||||||
this.nodeTypeList = res.data.tables
|
this.nodeTypeList = res.data.tables
|
||||||
this.relationalMap = res.data.relationalMap
|
this.relationalMap = res.data.relationalMap
|
||||||
})
|
})
|
||||||
|
optionSelect().then(res => {
|
||||||
|
this.$refs.topology.tranDictData(res.data)
|
||||||
|
})
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
/**
|
||||||
|
* 字典渲染
|
||||||
|
* @param dictType
|
||||||
|
* @param data
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
dictFormat(dictType, data) {
|
||||||
|
return this.selectDictLabel(this.dictTypeDataList[dictType], data)
|
||||||
|
},
|
||||||
/**
|
/**
|
||||||
* 重置
|
* 重置
|
||||||
*/
|
*/
|
||||||
|
|
@ -206,7 +220,7 @@ export default {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(function() {
|
}).then(function () {
|
||||||
let data = {
|
let data = {
|
||||||
id: that.topId,
|
id: that.topId,
|
||||||
uniCons: that.previewDate.uconList
|
uniCons: that.previewDate.uconList
|
||||||
|
|
@ -265,21 +279,17 @@ export default {
|
||||||
},
|
},
|
||||||
changeOnLine(release) {
|
changeOnLine(release) {
|
||||||
let that = this
|
let that = this
|
||||||
this.$confirm(release === 1?'请确认top图结构无误并预览结果无误后上线?':'请确认是否撤销当前发布内容!', '警告', {
|
this.$confirm(release === 1 ? '请确认top图结构无误并预览结果无误后上线?' : '请确认是否撤销当前发布内容!', '警告', {
|
||||||
confirmButtonText: '确定',
|
confirmButtonText: '确定',
|
||||||
cancelButtonText: '取消',
|
cancelButtonText: '取消',
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(function() {
|
}).then(function () {
|
||||||
let data = {
|
let data = {
|
||||||
id: that.baseData.id,
|
id: that.baseData.id,
|
||||||
isRelease: release
|
isRelease: release
|
||||||
}
|
}
|
||||||
Release(data).then(res => {
|
Release(data).then(res => {
|
||||||
that.$router.replace('/tool/er-top')
|
window.close()
|
||||||
Message({
|
|
||||||
message: res.msg,
|
|
||||||
type: 'success'
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
@ -300,7 +310,7 @@ export default {
|
||||||
let edges = []
|
let edges = []
|
||||||
edgeList.forEach(edge => {
|
edgeList.forEach(edge => {
|
||||||
edges.push({
|
edges.push({
|
||||||
id:edge.id,
|
id: edge.id,
|
||||||
label: edge.label,
|
label: edge.label,
|
||||||
source: edge.source,
|
source: edge.source,
|
||||||
target: edge.target,
|
target: edge.target,
|
||||||
|
|
@ -316,6 +326,7 @@ export default {
|
||||||
id: this.topId
|
id: this.topId
|
||||||
}
|
}
|
||||||
preview(data).then(res => {
|
preview(data).then(res => {
|
||||||
|
this.dictTypeDataList = res.dictList
|
||||||
this.previewDate.data = res.rows
|
this.previewDate.data = res.rows
|
||||||
this.previewDate.total = res.total
|
this.previewDate.total = res.total
|
||||||
this.previewDate.uconList = res.uconList
|
this.previewDate.uconList = res.uconList
|
||||||
|
|
@ -324,11 +335,12 @@ export default {
|
||||||
}
|
}
|
||||||
this.previewDate.header = []
|
this.previewDate.header = []
|
||||||
let infoList = res.infoList
|
let infoList = res.infoList
|
||||||
infoList.forEach( info=>{
|
infoList.forEach(info => {
|
||||||
this.previewDate.header.push({
|
this.previewDate.header.push({
|
||||||
key: info.prop,
|
key: info.prop,
|
||||||
label: info.label,
|
label: info.label,
|
||||||
prop: info.prop
|
prop: info.prop,
|
||||||
|
dictType: info.dictType
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
this.previewDate.title = this.baseData.uqName + '数据预览'
|
this.previewDate.title = this.baseData.uqName + '数据预览'
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ebts.web.controller.system;
|
||||||
|
|
||||||
import com.ebts.common.core.controller.BaseController;
|
import com.ebts.common.core.controller.BaseController;
|
||||||
import com.ebts.common.core.entity.Result;
|
import com.ebts.common.core.entity.Result;
|
||||||
|
import com.ebts.common.core.entity.entity.DictData;
|
||||||
|
import com.ebts.common.utils.DictUtils;
|
||||||
import com.ebts.common.utils.MapExcelUtil;
|
import com.ebts.common.utils.MapExcelUtil;
|
||||||
import com.ebts.system.entity.RealUniQuery;
|
import com.ebts.system.entity.RealUniQuery;
|
||||||
import com.ebts.system.entity.RelColumnInfo;
|
import com.ebts.system.entity.RelColumnInfo;
|
||||||
|
|
@ -40,13 +42,18 @@ public class RealQueryController extends BaseController {
|
||||||
Result<List<Map<String, Object>>> result = realQueryService.RealData(realUniQuery, 1);
|
Result<List<Map<String, Object>>> result = realQueryService.RealData(realUniQuery, 1);
|
||||||
List<RelColumnInfo> infoList = realQueryService.getInfoList(realUniQuery.getId());
|
List<RelColumnInfo> infoList = realQueryService.getInfoList(realUniQuery.getId());
|
||||||
if (result.isSuccess()) {
|
if (result.isSuccess()) {
|
||||||
List<Map<String,String>> infoMap = infoList.stream().map(info->{
|
Map<String, List<DictData>> dictList = new HashMap<>();
|
||||||
Map<String,String> map = new HashMap<>();
|
List<Map<String, String>> infoMap = infoList.stream().map(info -> {
|
||||||
map.put("label",info.getLabel());
|
Map<String, String> map = new HashMap<>();
|
||||||
map.put("prop",info.getProp());
|
map.put("label", info.getLabel());
|
||||||
|
map.put("prop", info.getProp());
|
||||||
|
map.put("dictType", info.getDictType());
|
||||||
|
if (info.getDictType() != null) {
|
||||||
|
dictList.put(info.getDictType(), DictUtils.getDictCache(info.getDictType()));
|
||||||
|
}
|
||||||
return map;
|
return map;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return new MapExcelUtil().exportExcel(result.getData(), result.getMsg(),infoMap);
|
return new MapExcelUtil().exportExcel(result.getData(), result.getMsg(), infoMap, dictList);
|
||||||
} else {
|
} else {
|
||||||
return Result.error(result.getMsg());
|
return Result.error(result.getMsg());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.InitBinder;
|
||||||
import java.beans.PropertyEditorSupport;
|
import java.beans.PropertyEditorSupport;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web层通用数据处理
|
* web层通用数据处理
|
||||||
|
|
@ -71,13 +72,14 @@ public class BaseController {
|
||||||
* 响应请求分页数据
|
* 响应请求分页数据
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
protected TableDataTop getDataTable(List<?> list, List<?> uconList,List<?> infoList) {
|
protected TableDataTop getDataTable(List<?> list, List<?> uconList, List<?> infoList, Map<String,?> dictList) {
|
||||||
TableDataTop dataTop = new TableDataTop();
|
TableDataTop dataTop = new TableDataTop();
|
||||||
dataTop.setCode(HttpStatus.SUCCESS);
|
dataTop.setCode(HttpStatus.SUCCESS);
|
||||||
dataTop.setMsg("查询成功");
|
dataTop.setMsg("查询成功");
|
||||||
dataTop.setRows(list);
|
dataTop.setRows(list);
|
||||||
dataTop.setUconList(uconList);
|
dataTop.setUconList(uconList);
|
||||||
dataTop.setInfoList(infoList);
|
dataTop.setInfoList(infoList);
|
||||||
|
dataTop.setDictList(dictList);
|
||||||
dataTop.setTotal(new PageInfo(list).getTotal());
|
dataTop.setTotal(new PageInfo(list).getTotal());
|
||||||
return dataTop;
|
return dataTop;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ebts.common.core.page;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 表格分页数据对象
|
* 表格分页数据对象
|
||||||
|
|
@ -24,6 +25,8 @@ public class TableDataTop implements Serializable {
|
||||||
private List<?> uconList;
|
private List<?> uconList;
|
||||||
|
|
||||||
private List<?> infoList;
|
private List<?> infoList;
|
||||||
|
private Map<String,?> dictList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息状态码
|
* 消息状态码
|
||||||
|
|
@ -100,4 +103,12 @@ public class TableDataTop implements Serializable {
|
||||||
public void setInfoList(List<?> infoList) {
|
public void setInfoList(List<?> infoList) {
|
||||||
this.infoList = infoList;
|
this.infoList = infoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, ?> getDictList() {
|
||||||
|
return dictList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictList(Map<String, ?> dictList) {
|
||||||
|
this.dictList = dictList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ebts.common.utils;
|
||||||
|
|
||||||
import com.ebts.common.config.EBTSConfig;
|
import com.ebts.common.config.EBTSConfig;
|
||||||
import com.ebts.common.core.entity.Result;
|
import com.ebts.common.core.entity.Result;
|
||||||
|
import com.ebts.common.core.entity.entity.DictData;
|
||||||
import com.ebts.common.exception.CustomException;
|
import com.ebts.common.exception.CustomException;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
||||||
|
|
@ -56,6 +57,7 @@ public class MapExcelUtil {
|
||||||
* 注解列表
|
* 注解列表
|
||||||
*/
|
*/
|
||||||
private List<Map<String, String>> herders;
|
private List<Map<String, String>> herders;
|
||||||
|
private Map<String,List<DictData>> dictList;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,8 +72,9 @@ public class MapExcelUtil {
|
||||||
return exportExcel();
|
return exportExcel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public <T>Result<T> exportExcel(List<Map<String, Object>> list, String sheetName,List<Map<String,String>> infoMap) {
|
public <T>Result<T> exportExcel(List<Map<String, Object>> list, String sheetName, List<Map<String,String>> infoMap, Map<String,List<DictData>> dictList) {
|
||||||
this.herders = infoMap;
|
this.herders = infoMap;
|
||||||
|
this.dictList = dictList;
|
||||||
this.init(list, sheetName);
|
this.init(list, sheetName);
|
||||||
return exportExcel();
|
return exportExcel();
|
||||||
}
|
}
|
||||||
|
|
@ -180,27 +183,31 @@ public class MapExcelUtil {
|
||||||
int k = 0;
|
int k = 0;
|
||||||
for (Map<String, String> herder : herders) {
|
for (Map<String, String> herder : herders) {
|
||||||
// 填充单元格的值
|
// 填充单元格的值
|
||||||
this.addCell(row, herder.get("prop"), i, k++);
|
this.addCell(row, herder, i, k++);
|
||||||
}
|
}
|
||||||
// for (String key : herders) {
|
|
||||||
// // 填充单元格的值
|
|
||||||
// this.addCell(row, key, i, k++);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加单元格
|
* 添加单元格
|
||||||
*/
|
*/
|
||||||
public Cell addCell(Row row, String key, int column, Integer k) {
|
public Cell addCell(Row row, Map<String, String> herder, int column, Integer k) {
|
||||||
Cell cell = null;
|
Cell cell = null;
|
||||||
try {
|
try {
|
||||||
|
Object value = this.list.get(column).get(herder.get("prop"));
|
||||||
|
String dictType = herder.get("dictType");
|
||||||
|
if (dictType!=null&&!"".equals(dictType)){
|
||||||
|
for (DictData dictData : dictList.get(dictType)) {
|
||||||
|
if (dictData.getDictValue().equals(value.toString())){
|
||||||
|
value = dictData.getDictLabel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// 设置行高
|
// 设置行高
|
||||||
row.setHeight((short) 280);
|
row.setHeight((short) 280);
|
||||||
// 创建cell
|
// 创建cell
|
||||||
cell = row.createCell(k);
|
cell = row.createCell(k);
|
||||||
cell.setCellStyle(styles.get("data"));
|
cell.setCellStyle(styles.get("data"));
|
||||||
Object value = this.list.get(column).get(key);
|
|
||||||
cell.setCellValue(value.toString());
|
cell.setCellValue(value.toString());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("导出Excel失败{}", e);
|
logger.error("导出Excel失败{}", e);
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ebts.generator.controller;
|
||||||
|
|
||||||
import com.ebts.common.core.controller.BaseController;
|
import com.ebts.common.core.controller.BaseController;
|
||||||
import com.ebts.common.core.entity.Result;
|
import com.ebts.common.core.entity.Result;
|
||||||
|
import com.ebts.common.core.entity.entity.DictData;
|
||||||
|
import com.ebts.common.utils.DictUtils;
|
||||||
import com.ebts.common.utils.MapExcelUtil;
|
import com.ebts.common.utils.MapExcelUtil;
|
||||||
import com.ebts.common.utils.StringUtils;
|
import com.ebts.common.utils.StringUtils;
|
||||||
import com.ebts.generator.entity.UniColumnInfo;
|
import com.ebts.generator.entity.UniColumnInfo;
|
||||||
|
|
@ -18,9 +20,8 @@ import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.HashMap;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.stream.Collectors;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -70,7 +71,7 @@ public class QueryController extends BaseController {
|
||||||
@PreAuthorize("@ebts.hasPermi('query:edit')")
|
@PreAuthorize("@ebts.hasPermi('query:edit')")
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public Result<Integer> edit(@Validated @RequestBody UniQuery uniQuery) {
|
public Result<Integer> edit(@Validated @RequestBody UniQuery uniQuery) {
|
||||||
if (uniQuery.getInfoList().size() == 0){
|
if (uniQuery.getInfoList().size() == 0) {
|
||||||
return Result.error("字段信息为空,请提取字段信息!");
|
return Result.error("字段信息为空,请提取字段信息!");
|
||||||
}
|
}
|
||||||
return queryService.updateQueryInfo(uniQuery);
|
return queryService.updateQueryInfo(uniQuery);
|
||||||
|
|
@ -87,7 +88,28 @@ public class QueryController extends BaseController {
|
||||||
public Result<Map<String, Object>> export(@Validated @RequestBody UniQuery uniQuery) {
|
public Result<Map<String, Object>> export(@Validated @RequestBody UniQuery uniQuery) {
|
||||||
Result<List<Map<String, Object>>> result = queryService.previewQuery(uniQuery);
|
Result<List<Map<String, Object>>> result = queryService.previewQuery(uniQuery);
|
||||||
if (result.isSuccess()) {
|
if (result.isSuccess()) {
|
||||||
return new MapExcelUtil().exportExcel(result.getData(), uniQuery.getUqName());
|
List<UniColumnInfo> infoList;
|
||||||
|
Map<String, List<DictData>> dictList = new HashMap<>();
|
||||||
|
if (uniQuery.getInfoList().size() != 0) {
|
||||||
|
infoList = uniQuery.getInfoList();
|
||||||
|
} else {
|
||||||
|
infoList = new ArrayList<>();
|
||||||
|
Set<String> keySet = result.getData().get(0).keySet();
|
||||||
|
keySet.forEach(s -> {
|
||||||
|
infoList.add(new UniColumnInfo(uniQuery.getId(), s, s, null));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
List<Map<String, String>> infoMap = infoList.stream().map(info -> {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
map.put("label", info.getLabel());
|
||||||
|
map.put("prop", info.getProp());
|
||||||
|
map.put("dictType", info.getDictType());
|
||||||
|
if (info.getDictType() != null) {
|
||||||
|
dictList.put(info.getDictType(), DictUtils.getDictCache(info.getDictType()));
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return new MapExcelUtil().exportExcel(result.getData(), uniQuery.getUqName(), infoMap, dictList);
|
||||||
} else {
|
} else {
|
||||||
return Result.error(result.getMsg());
|
return Result.error(result.getMsg());
|
||||||
}
|
}
|
||||||
|
|
@ -103,7 +125,7 @@ public class QueryController extends BaseController {
|
||||||
@PutMapping("preview")
|
@PutMapping("preview")
|
||||||
public Serializable Preview(@Validated @RequestBody UniQueryBo uniQuery) {
|
public Serializable Preview(@Validated @RequestBody UniQueryBo uniQuery) {
|
||||||
UniQuery query = new UniQuery();
|
UniQuery query = new UniQuery();
|
||||||
BeanUtils.copyProperties(uniQuery,query);
|
BeanUtils.copyProperties(uniQuery, query);
|
||||||
startPage(uniQuery);
|
startPage(uniQuery);
|
||||||
Result<List<Map<String, Object>>> result = queryService.previewQuery(query);
|
Result<List<Map<String, Object>>> result = queryService.previewQuery(query);
|
||||||
if (result.isSuccess()) {
|
if (result.isSuccess()) {
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ public class TopQueryController extends BaseController {
|
||||||
Result<TopResult> result = topQueryService.preview(params.get("jsonData"), params.get("id"));
|
Result<TopResult> result = topQueryService.preview(params.get("jsonData"), params.get("id"));
|
||||||
if (result.isSuccess()){
|
if (result.isSuccess()){
|
||||||
TopResult data = result.getData();
|
TopResult data = result.getData();
|
||||||
return getDataTable(data.getDataMap(),data.getUniCons(),data.getInfoList());
|
return getDataTable(data.getDataMap(),data.getUniCons(),data.getInfoList(),data.getDictList());
|
||||||
}else {
|
}else {
|
||||||
return Result.error(result.getMsg());
|
return Result.error(result.getMsg());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.ebts.generator.dto;
|
package com.ebts.generator.dto;
|
||||||
|
|
||||||
|
import com.ebts.common.core.entity.entity.DictData;
|
||||||
import com.ebts.generator.entity.UniColumnInfo;
|
import com.ebts.generator.entity.UniColumnInfo;
|
||||||
import com.ebts.generator.entity.UniCon;
|
import com.ebts.generator.entity.UniCon;
|
||||||
|
|
||||||
|
|
@ -17,11 +18,14 @@ public class TopResult {
|
||||||
private List<UniCon> uniCons;
|
private List<UniCon> uniCons;
|
||||||
private List<UniColumnInfo> infoList;
|
private List<UniColumnInfo> infoList;
|
||||||
|
|
||||||
|
private Map<String,List<DictData>> dictList;
|
||||||
|
|
||||||
public TopResult(List<Map<String, Object>> dataMap, List<UniCon> uniCons,List<UniColumnInfo> infoList) {
|
|
||||||
|
public TopResult(List<Map<String, Object>> dataMap, List<UniCon> uniCons,List<UniColumnInfo> infoList,Map<String,List<DictData>> dictList) {
|
||||||
this.dataMap = dataMap;
|
this.dataMap = dataMap;
|
||||||
this.uniCons = uniCons;
|
this.uniCons = uniCons;
|
||||||
this.infoList = infoList;
|
this.infoList = infoList;
|
||||||
|
this.dictList = dictList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Map<String, Object>> getDataMap() {
|
public List<Map<String, Object>> getDataMap() {
|
||||||
|
|
@ -47,4 +51,12 @@ public class TopResult {
|
||||||
public void setInfoList(List<UniColumnInfo> infoList) {
|
public void setInfoList(List<UniColumnInfo> infoList) {
|
||||||
this.infoList = infoList;
|
this.infoList = infoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, List<DictData>> getDictList() {
|
||||||
|
return dictList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictList(Map<String, List<DictData>> dictList) {
|
||||||
|
this.dictList = dictList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,11 +84,11 @@ public class QueryServiceImpl implements QueryService {
|
||||||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
||||||
public Result<Integer> updateQueryInfo(UniQuery uniQuery) {
|
public Result<Integer> updateQueryInfo(UniQuery uniQuery) {
|
||||||
uniQueryDao.updateUniQuery(uniQuery);
|
uniQueryDao.updateUniQuery(uniQuery);
|
||||||
|
queryDao.deleteUniCon(uniQuery.getId());
|
||||||
if (uniQuery.getUniCons() != null && uniQuery.getUniCons().size() > 0) {
|
if (uniQuery.getUniCons() != null && uniQuery.getUniCons().size() > 0) {
|
||||||
queryDao.deleteUniCon(uniQuery.getId());
|
|
||||||
queryDao.insertUniCon(uniQuery.getUniCons());
|
queryDao.insertUniCon(uniQuery.getUniCons());
|
||||||
resetColumnInfo(uniQuery);
|
|
||||||
}
|
}
|
||||||
|
resetColumnInfo(uniQuery);
|
||||||
return Result.ok();
|
return Result.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ebts.common.core.entity.Result;
|
import com.ebts.common.core.entity.Result;
|
||||||
|
import com.ebts.common.core.entity.entity.DictData;
|
||||||
|
import com.ebts.common.utils.DictUtils;
|
||||||
import com.ebts.common.utils.SecurityUtils;
|
import com.ebts.common.utils.SecurityUtils;
|
||||||
import com.ebts.common.utils.ServerResult;
|
import com.ebts.common.utils.ServerResult;
|
||||||
import com.ebts.generator.dao.*;
|
import com.ebts.generator.dao.*;
|
||||||
|
|
@ -41,6 +43,8 @@ public class TopQueryServiceImpl implements TopQueryService {
|
||||||
private UniQueryDao uniQueryDao;
|
private UniQueryDao uniQueryDao;
|
||||||
@Resource
|
@Resource
|
||||||
private UniColumnInfoDao uniColumnInfoDao;
|
private UniColumnInfoDao uniColumnInfoDao;
|
||||||
|
// @Resource
|
||||||
|
// private Dict
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> selectTopSearchTables() {
|
public Map<String, Object> selectTopSearchTables() {
|
||||||
|
|
@ -147,7 +151,15 @@ public class TopQueryServiceImpl implements TopQueryService {
|
||||||
sql.append(selectQuery);
|
sql.append(selectQuery);
|
||||||
PageHelper.startPage(1, 10, "");
|
PageHelper.startPage(1, 10, "");
|
||||||
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql.toString());
|
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql.toString());
|
||||||
TopResult topResult = new TopResult(dataMap, uniCons,infoList);
|
Map<String,List<DictData>> dictList = new HashMap<>();
|
||||||
|
infoList.forEach(info ->{
|
||||||
|
if (info.getDictType()!=null){
|
||||||
|
//todo 后期优化不适用循环
|
||||||
|
dictList.put(info.getDictType(),DictUtils.getDictCache(info.getDictType()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
TopResult topResult = new TopResult(dataMap, uniCons,infoList,dictList);
|
||||||
return Result.ok(topResult);
|
return Result.ok(topResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@ public class RelColumnInfo {
|
||||||
private String prop;
|
private String prop;
|
||||||
private String label;
|
private String label;
|
||||||
|
|
||||||
|
private String dictType;
|
||||||
|
|
||||||
public long getQueryId() {
|
public long getQueryId() {
|
||||||
return queryId;
|
return queryId;
|
||||||
}
|
}
|
||||||
|
|
@ -29,4 +31,12 @@ public class RelColumnInfo {
|
||||||
public void setLabel(String label) {
|
public void setLabel(String label) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDictType() {
|
||||||
|
return dictType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictType(String dictType) {
|
||||||
|
this.dictType = dictType;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,17 +4,20 @@ import com.ebts.system.entity.RealUniQuery;
|
||||||
import com.ebts.system.entity.RelColumnInfo;
|
import com.ebts.system.entity.RelColumnInfo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class RealInfo {
|
public class RealInfo {
|
||||||
private List<RealUniQuery> uniCons;
|
private List<RealUniQuery> uniCons;
|
||||||
private List<RelColumnInfo> infoList;
|
private List<RelColumnInfo> infoList;
|
||||||
|
private Map<String,?> dictList;
|
||||||
|
|
||||||
public RealInfo() {
|
public RealInfo() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RealInfo(List<RealUniQuery> uniCons, List<RelColumnInfo> infoList) {
|
public RealInfo(List<RealUniQuery> uniCons, List<RelColumnInfo> infoList,Map<String,?> dictList) {
|
||||||
this.uniCons = uniCons;
|
this.uniCons = uniCons;
|
||||||
this.infoList = infoList;
|
this.infoList = infoList;
|
||||||
|
this.dictList = dictList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RealUniQuery> getUniCons() {
|
public List<RealUniQuery> getUniCons() {
|
||||||
|
|
@ -29,7 +32,16 @@ public class RealInfo {
|
||||||
return infoList;
|
return infoList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, ?> getDictList() {
|
||||||
|
return dictList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDictList(Map<String, ?> dictList) {
|
||||||
|
this.dictList = dictList;
|
||||||
|
}
|
||||||
|
|
||||||
public void setInfoList(List<RelColumnInfo> infoList) {
|
public void setInfoList(List<RelColumnInfo> infoList) {
|
||||||
|
|
||||||
this.infoList = infoList;
|
this.infoList = infoList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.ebts.system.service.impl;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.ebts.common.constant.ReturnConstants;
|
import com.ebts.common.constant.ReturnConstants;
|
||||||
import com.ebts.common.core.entity.Result;
|
import com.ebts.common.core.entity.Result;
|
||||||
|
import com.ebts.common.core.entity.entity.DictData;
|
||||||
|
import com.ebts.common.utils.DictUtils;
|
||||||
import com.ebts.system.dao.RealQueryServiceDao;
|
import com.ebts.system.dao.RealQueryServiceDao;
|
||||||
import com.ebts.system.entity.RealUniCon;
|
import com.ebts.system.entity.RealUniCon;
|
||||||
import com.ebts.system.entity.RealUniQuery;
|
import com.ebts.system.entity.RealUniQuery;
|
||||||
|
|
@ -18,6 +20,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
@ -42,7 +45,13 @@ public class RealQueryServiceImpl implements RealQueryService {
|
||||||
public Result<RealInfo> RealInfo(Long id) {
|
public Result<RealInfo> RealInfo(Long id) {
|
||||||
List<RealUniQuery> uniCons = realQueryServiceDao.queryRealInfo(id);
|
List<RealUniQuery> uniCons = realQueryServiceDao.queryRealInfo(id);
|
||||||
List<RelColumnInfo> infoList = realQueryServiceDao.queryRealColumnInfo(id);
|
List<RelColumnInfo> infoList = realQueryServiceDao.queryRealColumnInfo(id);
|
||||||
return Result.ok(new RealInfo(uniCons,infoList));
|
Map<String,List<DictData>> dictList = new HashMap<>();
|
||||||
|
infoList.forEach(info->{
|
||||||
|
if (info.getDictType()!=null){
|
||||||
|
dictList.put(info.getDictType(), DictUtils.getDictCache(info.getDictType()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return Result.ok(new RealInfo(uniCons,infoList,dictList));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,6 @@
|
||||||
${paramSQL}
|
${paramSQL}
|
||||||
</select>
|
</select>
|
||||||
<select id="queryRealColumnInfo" resultType="com.ebts.system.entity.RelColumnInfo">
|
<select id="queryRealColumnInfo" resultType="com.ebts.system.entity.RelColumnInfo">
|
||||||
select label,prop from gen_uni_column_info where query_id = #{id}
|
select label,prop,dict_type from gen_uni_column_info where query_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue