top图完善

This commit is contained in:
clay 2021-07-21 01:25:22 +08:00
parent 5fa018f70f
commit e6096b5cbc
14 changed files with 1447 additions and 7 deletions

View File

@ -0,0 +1,65 @@
import request from '@/utils/request'
// 查询top万能查询主列表
export function listTable(data) {
return request({
url: '/tool/table/list',
method: 'post',
data: data
})
}
// 导出top万能查询主
export function exportTable(data) {
return request({
url: '/tool/table/export',
method: 'post',
data: data
})
}
// 导入表
export function importTopTable(data) {
return request({
url: '/tool/table/importTopTable',
method: 'post',
params: data
})
}
// 查询top万能查询主详细
export function getTable(id) {
return request({
url: '/tool/table/' + id,
method: 'get'
})
}
// 新增top万能查询主
export function addTable(data) {
return request({
url: '/tool/table',
method: 'post',
data: data
})
}
// 修改top万能查询主
export function updateTable(data) {
return request({
url: '/tool/table',
method: 'put',
data: data
})
}
// 删除top万能查询主
export function delTable(id) {
return request({
url: '/tool/table/' + id,
method: 'delete'
})
}

View File

@ -31,7 +31,7 @@
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column> <el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column> <el-table-column prop="createTime" label="创建时间"></el-table-column>
<el-table-column prop="updateTime" label="更新时间"></el-table-column> <!-- <el-table-column prop="updateTime" label="更新时间"></el-table-column>-->
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"

View File

@ -86,7 +86,6 @@
<el-table v-loading="loading" :data="queryList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="queryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" width="50"></el-table-column> <el-table-column type="index" width="50"></el-table-column>
<!-- <el-table-column label="id" align="center" prop="id" />-->
<el-table-column label="名称" align="center" prop="uqName" /> <el-table-column label="名称" align="center" prop="uqName" />
<el-table-column label="描述" align="center" prop="uqDescribe" /> <el-table-column label="描述" align="center" prop="uqDescribe" />
<el-table-column label="创建时间" align="center" prop="createTime"> <el-table-column label="创建时间" align="center" prop="createTime">

View File

@ -0,0 +1,119 @@
<template>
<!-- 导入表 -->
<el-dialog title="导入表" :visible.sync="visible" width="800px" top="5vh" append-to-body>
<el-form :model="queryParams" ref="queryForm" :inline="true">
<el-form-item label="表名称" prop="tableName">
<el-input
v-model="queryParams.tableName"
placeholder="请输入表名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="表描述" prop="tableComment">
<el-input
v-model="queryParams.tableComment"
placeholder="请输入表描述"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</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>
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
<el-table-column type="selection" width="55"></el-table-column>
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="tableComment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
<el-table-column prop="createTime" label="创建时间"></el-table-column>
<!-- <el-table-column prop="updateTime" label="更新时间"></el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-row>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="handleImportTopTable"> </el-button>
<el-button @click="visible = false"> </el-button>
</div>
</el-dialog>
</template>
<script>
import { listDbTable} from "@/api/tool/gen";
import {importTopTable} from '../../../api/tool/table'
export default {
data() {
return {
//
visible: false,
//
tables: [],
//
total: 0,
//
dbTableList: [],
//
queryParams: {
pageNum: 1,
pageSize: 10,
tableName: undefined,
tableComment: undefined
}
};
},
methods: {
//
show() {
this.getList();
this.visible = true;
},
clickRow(row) {
this.$refs.table.toggleRowSelection(row);
},
//
handleSelectionChange(selection) {
this.tables = selection.map(item => item.tableName);
},
//
getList() {
listDbTable(this.queryParams).then(res => {
if (res.code === 200) {
this.dbTableList = res.rows;
this.total = res.total;
}
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
/** 导入按钮操作 */
handleImportTopTable() {
importTopTable({ tables: this.tables.join(",") }).then(res => {
this.msgSuccess(res.msg);
if (res.code === 200) {
this.visible = false;
this.$emit("ok");
}
});
}
}
};
</script>

View File

@ -0,0 +1,459 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="表名" prop="tableName">
<el-input
v-model="queryParams.tableName"
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 label="更新时间">
<el-date-picker
v-model="daterangeUpdateTime"
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:table: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:table: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:table:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="info"
plain
icon="el-icon-upload"
size="mini"
@click="openImportTable"
v-hasPermi="['tool:gen:import']"
>导入</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:table:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="tableList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="序号" type="index" align="center">
<template slot-scope="scope">
<span>{{ ((queryParams.pageInfo.pageNum - 1) * queryParams.pageInfo.pageSize + scope.$index + 1)}}</span>
</template>
</el-table-column>
<el-table-column label="表名" align="center" prop="tableName" />
<el-table-column label="表描述" align="center" prop="tableComment" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<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" width="180">
<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:table:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['tool:table:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageInfo.pageNum"
:limit.sync="queryParams.pageInfo.pageSize"
@pagination="getList"
/>
<!-- 添加或修改top万能查询主对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="12">
<el-form-item label="表名:" prop="tableName">
<span>{{form.tableName}}</span>
</el-form-item>
<el-form-item label="角色">
<el-select v-model="form.roleIds" multiple placeholder="请选择">
<el-option
v-for="item in roleOptions"
:key="item.roleId"
:label="item.roleName"
:value="item.roleId"
:disabled="item.status == 1"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="表描述" prop="tableComment">
<el-input v-model="form.tableComment" type="textarea" placeholder="请输入内容" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-col>
<el-col :span="12">
</el-col>
</el-row>
<el-divider content-position="center">top万能查询字段信息</el-divider>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">-->
<!-- <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddTopSearchColumn">添加</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteTopSearchColumn">删除</el-button>-->
<!-- </el-col>-->
</el-row>
<el-table :data="topSearchColumnList" :row-class-name="rowTopSearchColumnIndex" @selection-change="handleTopSearchColumnSelectionChange" ref="topSearchColumn">
<el-table-column label="序号" align="center" prop="index" width="50"/>
<el-table-column label="列名称" prop="columnName">
<template slot-scope="scope">
<span>{{scope.row.columnName}}</span>
</template>
</el-table-column>
<el-table-column label="列描述" prop="columnComment">
<template slot-scope="scope">
<el-input v-model="scope.row.columnComment" placeholder="请输入列描述" />
</template>
</el-table-column>
<el-table-column label="列类型" prop="columnType">
<template slot-scope="scope">
<span>{{scope.row.columnType}}</span>
</template>
</el-table-column>
<el-table-column label="是否使用" prop="isUse" align="center">
<template slot-scope="scope">
<el-checkbox :false-label="0" :true-label="1" v-model="scope.row.isUse"/>
</template>
</el-table-column>
<el-table-column label="创建时间" prop="createTime">
<template slot-scope="scope">
<span>{{scope.row.createTime}}</span>
</template>
</el-table-column>
<el-table-column label="更新时间" prop="updateTime">
<template slot-scope="scope">
<span>{{scope.row.updateTime}}</span>
</template>
</el-table-column>
</el-table>
</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>
<import-top-table ref="import" @ok="handleQuery" />
</div>
</template>
<script>
import { listTable, getTable, delTable, addTable, updateTable, exportTable } from "@/api/tool/table";
import {listRole} from '../../../api/system/role'
import importTopTable from "./importTopTable";
export default {
name: "Table",
components: { importTopTable },
data() {
return {
//
loading: true,
//
ids: [],
//
checkedTopSearchColumn: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
// top
tableList: [],
//
roleOptions: [],
// top
topSearchColumnList: [],
//
title: "",
//
open: false,
//
daterangeCreateTime: [],
//
daterangeUpdateTime: [],
//
queryParams: {
pageInfo:{
pageNum: 1,
pageSize: 10,
},
params:{},
tableName: null,
tableComment: null,
},
//
form: {
roleIds:[]
},
//
rules: {
}
};
},
created() {
this.getList();
this.getRoleList();
},
methods: {
getRoleList(){
listRole().then(res=>{
this.roleOptions = res.rows
})
},
/** 查询top万能查询主列表 */
getList() {
this.loading = true;
this.queryParams.params={}
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
}
this.queryParams.params={}
if (null != this.daterangeUpdateTime && '' != this.daterangeUpdateTime) {
this.queryParams.params["beginUpdateTime"] = this.daterangeUpdateTime[0];
this.queryParams.params["endUpdateTime"] = this.daterangeUpdateTime[1];
}
listTable(this.queryParams).then(response => {
this.tableList = response.rows;
if(response.total!==undefined){
this.total = response.total;
}
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
tableName: null,
tableComment: null,
remark: null,
roleIds:[],
};
this.topSearchColumnList = [];
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 打开导入表弹窗 */
openImportTable() {
this.$refs.import.show();
},
/** 重置按钮操作 */
resetQuery() {
this.daterangeCreateTime = [];
this.queryParams.params={}
this.daterangeUpdateTime = [];
this.queryParams.params={}
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 = "添加top万能查询主";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getTable(id).then(response => {
this.form = response.data;
this.topSearchColumnList = response.data.topSearchColumnList;
this.open = true;
this.title = "修改top万能查询主";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.form.topSearchColumnList = this.topSearchColumnList;
if (this.form.id != null) {
updateTable(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addTable(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除top万能查询主编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delTable(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** top万能查询字段序号 */
rowTopSearchColumnIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** top万能查询字段添加按钮操作 */
handleAddTopSearchColumn() {
let obj = {};
obj.columnName = "";
obj.columnComment = "";
obj.columnType = "";
obj.isUse = "";
obj.createTime = "";
obj.updateTime = "";
this.topSearchColumnList.push(obj);
},
/** top万能查询字段删除按钮操作 */
handleDeleteTopSearchColumn() {
if (this.checkedTopSearchColumn.length == 0) {
this.$alert("请先选择要删除的top万能查询字段数据", "提示", { confirmButtonText: "确定", });
} else {
this.topSearchColumnList.splice(this.checkedTopSearchColumn[0].index - 1, 1);
}
},
/** 单选框选中数据 */
handleTopSearchColumnSelectionChange(selection) {
if (selection.length > 1) {
this.$refs.topSearchColumn.clearSelection();
this.$refs.topSearchColumn.toggleRowSelection(selection.pop());
} else {
this.checkedTopSearchColumn = selection;
}
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有top万能查询主数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportTable(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>

View File

@ -7,4 +7,4 @@ gen:
# 自动去除表前缀默认是false # 自动去除表前缀默认是false
autoRemovePre: true autoRemovePre: true
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔) # 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_,test_ tablePrefix: sys_,test_,gen_

View File

@ -0,0 +1,154 @@
package com.ebts.generator.controller;
import java.io.Serializable;
import java.util.List;
import java.util.regex.Pattern;
import com.ebts.common.constant.ReturnConstants;
import com.ebts.common.core.controller.EBTSController;
import com.ebts.common.utils.ServerResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ebts.common.annotation.Log;
import com.ebts.common.core.entity.AjaxResult;
import com.ebts.common.enums.BusinessType;
import com.ebts.common.exception.EbtsException;
import com.ebts.generator.entity.TopSearchTable;
import com.ebts.generator.service.TopSearchTableService;
import com.ebts.common.utils.poi.ExcelUtil;
import com.ebts.common.core.page.TableDataInfo;
/**
* top万能查询主Controller
*
* @author clay
* @date 2021-07-20
*/
@Api(value = "top万能查询主管理",tags = "top万能查询主管理")
@RestController
@RequestMapping("/tool/table")
public class TopSearchTableController extends EBTSController {
protected final Logger logger = LoggerFactory.getLogger(TopSearchTableController.class);
@Autowired
private TopSearchTableService topSearchTableService;
/**
* 查询top万能查询主列表
*/
@ApiOperation("查询top万能查询主列表")
@PreAuthorize("@ebts.hasPermi('tool:table:list')")
@PostMapping("/list")
public Serializable list(@Validated @RequestBody TopSearchTable topSearchTable) {
startPage(topSearchTable.getPageInfo());
ServerResult<List<TopSearchTable>> genServerResult = topSearchTableService.selectTopSearchTableList(topSearchTable);
if (genServerResult.isStart()) {
return getDataTable(genServerResult.getData());
} else {
return AjaxResult.info(genServerResult.getMsg());
}
}
/**
* 导出top万能查询主列表
*/
@ApiOperation("导出top万能查询主列表")
@PreAuthorize("@ebts.hasPermi('tool:table:export')")
@Log(title = "top万能查询主", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public AjaxResult export(@Validated @RequestBody TopSearchTable topSearchTable) {
ServerResult<List<TopSearchTable>> genServerResult = topSearchTableService.selectTopSearchTableList(topSearchTable);
ExcelUtil<TopSearchTable> util = new ExcelUtil<TopSearchTable>(TopSearchTable. class);
if (genServerResult.isStart()) {
return util.exportExcel(genServerResult.getData(), "table");
} else {
return AjaxResult.error(genServerResult.getMsg());
}
}
/**
* 获取top万能查询主详细信息
*/
@ApiOperation("获取top万能查询主详细信息")
@ApiImplicitParam(name = "id" , value = "top万能查询主id" , required = true, dataType = "Long" , paramType = "path")
@PreAuthorize("@ebts.hasPermi('tool:table:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
ServerResult<TopSearchTable> genServerResult = topSearchTableService.selectTopSearchTableById(id);
if (genServerResult.isStart()) {
return AjaxResult.success(genServerResult.getData());
} else {
return AjaxResult.info(genServerResult.getMsg());
}
}
/**
* 新增top万能查询主
*/
@ApiOperation("新增top万能查询主")
@ApiImplicitParam(name = "topSearchTable" , value = "新增top万能查询主信息" , dataType = "TopSearchTable")
@PreAuthorize("@ebts.hasPermi('tool:table:add')")
@Log(title = "top万能查询主", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody TopSearchTable topSearchTable) {
ServerResult<Integer> genServerResult = topSearchTableService.insertTopSearchTable(topSearchTable);
if (genServerResult.isStart()) {
return AjaxResult.success();
} else {
return AjaxResult.error(genServerResult.getMsg());
}
}
/**
* 修改top万能查询主
*/
@ApiOperation("修改top万能查询主")
@ApiImplicitParam(name = "topSearchTable" , value = "修改top万能查询主信息" , dataType = "TopSearchTable")
@PreAuthorize("@ebts.hasPermi('tool:table:edit')")
@Log(title = "top万能查询主", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody TopSearchTable topSearchTable) {
ServerResult<Integer> genServerResult = topSearchTableService.updateTopSearchTable(topSearchTable);
if (genServerResult.isStart()) {
return AjaxResult.success();
} else {
return AjaxResult.error(genServerResult.getMsg());
}
}
/**
* 删除top万能查询主
*/
@ApiOperation("删除top万能查询主")
@ApiImplicitParam(name = "ids" , value = "top万能查询主ids" , required = true, dataType = "Long" , paramType = "path")
@PreAuthorize("@ebts.hasPermi('tool:table:remove')")
@Log(title = "top万能查询主", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
if (ids.length<0){
return AjaxResult.error("id不能为空!");
}
ServerResult<Integer> genServerResult = topSearchTableService.deleteTopSearchTableByIds(ids);
if (genServerResult.isStart()) {
return AjaxResult.success();
} else {
return AjaxResult.error(genServerResult.getMsg());
}
}
}

View File

@ -0,0 +1,86 @@
package com.ebts.generator.dao;
import java.util.List;
import com.ebts.generator.entity.TopSearchTable;
import com.ebts.generator.entity.TopSearchColumn;
/**
* top万能查询主Mapper接口
*
* @author clay
* @date 2021-07-20
*/
public interface TopSearchTableDao {
/**
* 查询top万能查询主
*
* @param id top万能查询主ID
* @return top万能查询主
*/
TopSearchTable selectTopSearchTableById(Long id);
/**
* 查询top万能查询主列表
*
* @param topSearchTable top万能查询主
* @return top万能查询主集合
*/
List<TopSearchTable> selectTopSearchTableList(TopSearchTable topSearchTable);
/**
* 新增top万能查询主
*
* @param topSearchTable top万能查询主
* @return 结果
*/
int insertTopSearchTable(TopSearchTable topSearchTable);
/**
* 修改top万能查询主
*
* @param topSearchTable top万能查询主
* @return 结果
*/
int updateTopSearchTable(TopSearchTable topSearchTable);
/**
* 删除top万能查询主
*
* @param id top万能查询主ID
* @return 结果
*/
int deleteTopSearchTableById(Long id);
/**
* 批量删除top万能查询主
*
* @param ids 需要删除的数据ID
* @return 结果
*/
int deleteTopSearchTableByIds(Long[] ids);
/**
* 批量删除top万能查询字段
*
* @param ids 需要删除的数据ID
* @return 结果
*/
int deleteTopSearchColumnBySearchTableIds(Long[] ids);
/**
* 批量新增top万能查询字段
*
* @param topSearchColumnList top万能查询字段列表
* @return 结果
*/
int batchTopSearchColumn(List<TopSearchColumn> topSearchColumnList);
/**
* 通过top万能查询主ID删除top万能查询字段信息
*
* @param id top万能查询主ID
* @return 结果
*/
int deleteTopSearchColumnBySearchTableId(Long id);
}

View File

@ -0,0 +1,95 @@
package com.ebts.generator.entity;
import com.ebts.common.annotation.Excel;
import com.ebts.common.core.entity.BaseEntity;
/**
* top万能查询字段对象 gen_top_search_column
*
* @author clay
* @date 2021-07-20
*/
public class TopSearchColumn extends BaseEntity{
/** 主键id */
private Long id;
/** top万能查询表格主键id */
@Excel(name = "top万能查询表格主键id")
private Long searchTableId;
/** 列名称 */
@Excel(name = "列名称")
private String columnName;
/** 列描述 */
@Excel(name = "列描述")
private String columnComment;
/** 列类型 */
@Excel(name = "列类型")
private String columnType;
/** 是否使用 */
@Excel(name = "是否使用")
private Integer isUse;
public void setId(Long id){
this.id = id;
}
public Long getId(){
return id;
}
public void setSearchTableId(Long searchTableId){
this.searchTableId = searchTableId;
}
public Long getSearchTableId(){
return searchTableId;
}
public void setColumnName(String columnName){
this.columnName = columnName;
}
public String getColumnName(){
return columnName;
}
public void setColumnComment(String columnComment){
this.columnComment = columnComment;
}
public String getColumnComment(){
return columnComment;
}
public void setColumnType(String columnType){
this.columnType = columnType;
}
public String getColumnType(){
return columnType;
}
public void setIsUse(Integer isUse){
this.isUse = isUse;
}
public Integer getIsUse(){
return isUse;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("searchTableId", getSearchTableId())
.append("columnName", getColumnName())
.append("columnComment", getColumnComment())
.append("columnType", getColumnType())
.append("isUse", getIsUse())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

View File

@ -0,0 +1,85 @@
package com.ebts.generator.entity;
import java.util.List;
import com.ebts.generator.entity.TopSearchColumn;
import com.ebts.common.core.entity.BaseEntity;
import com.ebts.common.annotation.Excel;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* top万能查询主对象 gen_top_search_table
*
* @author clay
* @date 2021-07-20
*/
@ApiModel("top万能查询主")
public class TopSearchTable extends BaseEntity{
/** 主键id */
@ApiModelProperty("主键id")
private Long id;
/** 表名 */
@Excel(name = "表名")
@ApiModelProperty("表名")
private String tableName;
/** 表描述 */
@Excel(name = "表描述")
@ApiModelProperty("表描述")
private String tableComment;
/** top万能查询字段信息 */
@ApiModelProperty("top万能查询字段信息")
private List<TopSearchColumn> topSearchColumnList;
public void setId(Long id){
this.id = id;
}
public Long getId(){
return id;
}
public void setTableName(String tableName){
this.tableName = tableName;
}
public String getTableName(){
return tableName;
}
public void setTableComment(String tableComment){
this.tableComment = tableComment;
}
public String getTableComment(){
return tableComment;
}
public List<TopSearchColumn> getTopSearchColumnList(){
return topSearchColumnList;
}
public void setTopSearchColumnList(List<TopSearchColumn> topSearchColumnList){
this.topSearchColumnList = topSearchColumnList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("tableName", getTableName())
.append("tableComment", getTableComment())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("topSearchColumnList", getTopSearchColumnList())
.toString();
}
}

View File

@ -0,0 +1,63 @@
package com.ebts.generator.service;
import java.util.List;
import com.ebts.common.utils.ServerResult;
import com.ebts.generator.entity.TopSearchTable;
/**
* top万能查询主Service接口
*
* @author clay
* @date 2021-07-20
*/
public interface TopSearchTableService
{
/**
* 查询top万能查询主
*
* @param id top万能查询主ID
* @return top万能查询主
*/
ServerResult<TopSearchTable> selectTopSearchTableById(Long id);
/**
* 查询top万能查询主列表
*
* @param topSearchTable top万能查询主
* @return top万能查询主集合
*/
ServerResult<List<TopSearchTable>> selectTopSearchTableList(TopSearchTable topSearchTable);
/**
* 新增top万能查询主
*
* @param topSearchTable top万能查询主
* @return 结果
*/
ServerResult<Integer> insertTopSearchTable(TopSearchTable topSearchTable);
/**
* 修改top万能查询主
*
* @param topSearchTable top万能查询主
* @return 结果
*/
ServerResult<Integer> updateTopSearchTable(TopSearchTable topSearchTable);
/**
* 批量删除top万能查询主
*
* @param ids 需要删除的top万能查询主ID
* @return 结果
*/
ServerResult<Integer> deleteTopSearchTableByIds(Long[] ids);
/**
* 删除top万能查询主信息
*
* @param id top万能查询主ID
* @return 结果
*/
ServerResult<Integer> deleteTopSearchTableById(Long id);
}

View File

@ -0,0 +1,202 @@
package com.ebts.generator.service.impl;
import java.util.List;
import com.ebts.common.constant.ReturnConstants;
import com.ebts.common.exception.EbtsException;
import com.ebts.common.utils.SecurityUtils;
import com.ebts.common.utils.DateUtils;
import com.ebts.common.utils.SecurityUtils;
import com.ebts.common.utils.DateUtils;
import com.ebts.common.utils.ServerResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.ebts.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.ebts.generator.entity.TopSearchColumn;
import com.ebts.generator.dao.TopSearchTableDao;
import com.ebts.generator.entity.TopSearchTable;
import com.ebts.generator.service.TopSearchTableService;
/**
* top万能查询主Service业务层处理
*
* @author clay
* @date 2021-07-20
*/
@Service
public class TopSearchTableServiceImpl implements TopSearchTableService {
private Logger logger = LoggerFactory.getLogger(TopSearchTableServiceImpl.class);
@Autowired
private TopSearchTableDao topSearchTableDao;
/**
* 查询top万能查询主
*
* @param id top万能查询主ID
* @return top万能查询主
*/
@Override
public ServerResult<TopSearchTable> selectTopSearchTableById(Long id) {
try {
TopSearchTable topSearchTable = topSearchTableDao.selectTopSearchTableById(id);
if (topSearchTable != null){
return new ServerResult<>(true,topSearchTable);
}else {
return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY);
}
}catch (RuntimeException e){
logger.error(e.getMessage());
throw new EbtsException(ReturnConstants.OP_ERROR,e);
}
}
/**
* 查询top万能查询主列表
*
* @param topSearchTable top万能查询主
* @return top万能查询主
*/
@Override
public ServerResult<List<TopSearchTable>> selectTopSearchTableList(TopSearchTable topSearchTable) {
try {
List<TopSearchTable> topSearchTableList = topSearchTableDao.selectTopSearchTableList(topSearchTable);
if (topSearchTableList.size()>0){
return new ServerResult<>(true,topSearchTableList);
}else {
return new ServerResult<>(false,ReturnConstants.RESULT_EMPTY);
}
}catch (RuntimeException e){
logger.error(e.getMessage());
throw new EbtsException(ReturnConstants.OP_ERROR,e);
}
}
/**
* 新增top万能查询主
*
* @param topSearchTable top万能查询主
* @return 结果
*/
@Transactional
@Override
public ServerResult<Integer> insertTopSearchTable(TopSearchTable topSearchTable) {
try {
topSearchTable.setCreateBy(SecurityUtils.getUserId());
int renewal = topSearchTableDao.insertTopSearchTable(topSearchTable);
if (insertTopSearchColumn(topSearchTable)){
return new ServerResult<>(false,ReturnConstants.DB_EX);
}
if (renewal >0){
return new ServerResult<>(true,renewal);
}else {
return new ServerResult<>(false,ReturnConstants.SYS_FAILL);
}
}catch (RuntimeException e){
logger.error(e.getMessage());
throw new EbtsException(ReturnConstants.OP_ERROR,e);
}
}
/**
* 修改top万能查询主
*
* @param topSearchTable top万能查询主
* @return 结果
*/
@Transactional
@Override
public ServerResult<Integer> updateTopSearchTable(TopSearchTable topSearchTable) {
try {
topSearchTable.setUpdateBy(SecurityUtils.getUserId());
topSearchTableDao.deleteTopSearchColumnBySearchTableId(topSearchTable.getId());
if (insertTopSearchColumn(topSearchTable)){
return new ServerResult<>(false,ReturnConstants.DB_EX);
}
Integer renewal = topSearchTableDao.updateTopSearchTable(topSearchTable);
if (renewal >0){
return new ServerResult<>(true,renewal);
}else {
return new ServerResult<>(false,ReturnConstants.SYS_FAILL);
}
}catch (RuntimeException e){
logger.error(e.getMessage());
throw new EbtsException(ReturnConstants.OP_ERROR,e);
}
}
/**
* 批量删除top万能查询主
*
* @param ids 需要删除的top万能查询主ID
* @return 结果
*/
@Transactional
@Override
public ServerResult<Integer> deleteTopSearchTableByIds(Long[] ids) {
try {
//批量删除子表数据
topSearchTableDao.deleteTopSearchColumnBySearchTableIds(ids);
Integer renewal = topSearchTableDao.deleteTopSearchTableByIds(ids);
if (renewal >0){
return new ServerResult<>(true,renewal);
}else {
return new ServerResult<>(false,ReturnConstants.SYS_FAILL);
}
}catch (RuntimeException e){
logger.error(e.getMessage());
throw new EbtsException(ReturnConstants.OP_ERROR,e);
}
}
/**
* 删除top万能查询主信息
*
* @param id top万能查询主ID
* @return 结果
*/
@Override
public ServerResult<Integer> deleteTopSearchTableById(Long id) {
try {
//删除子表数据
topSearchTableDao.deleteTopSearchColumnBySearchTableId(id);
Integer renewal = topSearchTableDao.deleteTopSearchTableById(id);
if (renewal >0){
return new ServerResult<>(true,renewal);
}else {
return new ServerResult<>(false,ReturnConstants.SYS_FAILL);
}
}catch (RuntimeException e){
logger.error(e.getMessage());
throw new EbtsException(ReturnConstants.OP_ERROR,e);
}
}
/**
* 新增top万能查询字段信息
*
* @param topSearchTable top万能查询主对象
*/
public boolean insertTopSearchColumn(TopSearchTable topSearchTable) {
List<TopSearchColumn> topSearchColumnList = topSearchTable.getTopSearchColumnList();
Long id = topSearchTable.getId();
if (StringUtils.isNotNull(topSearchColumnList)) {
List<TopSearchColumn> list = new ArrayList<TopSearchColumn>();
for (TopSearchColumn topSearchColumn : topSearchColumnList){
topSearchColumn.setSearchTableId(id);
list.add(topSearchColumn);
}
if (list.size() > 0) {
Integer renewal = topSearchTableDao.batchTopSearchColumn(list);
if (renewal>0){
return false;
}
}
}
return true;
}
}

View File

@ -81,11 +81,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if> </if>
</where> </where>
</select> </select>
<!--AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'-->
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult"> <select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">
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_schema = (select database()) where table_schema = (select database())
AND table_name NOT LIKE 'qrtz_%' AND table_name NOT LIKE 'gen_%'
AND table_name NOT IN (select table_name from gen_table) AND table_name NOT IN (select table_name from gen_table)
<if test="tableName != null and tableName != ''"> <if test="tableName != null and tableName != ''">
AND lower(table_name) like lower(concat('%', #{tableName}, '%')) AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
@ -100,10 +100,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d') AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if> </if>
</select> </select>
<!--AND table_name NOT LIKE 'gen_%'-->
<select id="selectDbTableListByNames" resultMap="GenTableResult"> <select id="selectDbTableListByNames" resultMap="GenTableResult">
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_schema = (select database())
and table_name in and table_name in
<foreach collection="array" item="name" open="(" separator="," close=")"> <foreach collection="array" item="name" open="(" separator="," close=")">
#{name} #{name}

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ebts.generator.dao.TopSearchTableDao">
<resultMap type="com.ebts.generator.entity.TopSearchTable" id="TopSearchTableResult">
<result property="id" column="id" />
<result property="tableName" column="table_name" />
<result property="tableComment" column="table_comment" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap id="TopSearchTableTopSearchColumnResult" type="com.ebts.generator.entity.TopSearchTable" extends="TopSearchTableResult">
<collection property="topSearchColumnList" notNullColumn="id" javaType="java.util.List" resultMap="TopSearchColumnResult" />
</resultMap>
<resultMap type="com.ebts.generator.entity.TopSearchColumn" id="TopSearchColumnResult">
<result property="id" column="id" />
<result property="searchTableId" column="search_table_id" />
<result property="columnName" column="column_name" />
<result property="columnComment" column="column_comment" />
<result property="columnType" column="column_type" />
<result property="isUse" column="is_use" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTopSearchTableVo">
select id, table_name, table_comment, remark, create_by, create_time, update_by, update_time from gen_top_search_table
</sql>
<select id="selectTopSearchTableList" parameterType="TopSearchTable" resultMap="TopSearchTableResult">
<include refid="selectTopSearchTableVo"/>
<where>
<if test="tableName != null and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
<if test="tableComment != null and tableComment != ''"> and table_comment like concat('%', #{tableComment}, '%')</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.beginUpdateTime != null and params.beginUpdateTime != '' and params.endUpdateTime != null and params.endUpdateTime != ''"> and update_time between #{params.beginUpdateTime} and #{params.endUpdateTime}</if>
</where>
</select>
<select id="selectTopSearchTableById" parameterType="Long" 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, 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 from gen_top_search_table gtst
left join gen_top_search_column gtsc on gtsc.search_table_id = gtst.id
where gtst.id = #{id}
</select>
<insert id="insertTopSearchTable" parameterType="TopSearchTable" useGeneratedKeys="true" keyProperty="id">
insert into gen_top_search_table
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="tableName != null">table_name,</if>
<if test="tableComment != null">table_comment,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="tableName != null">#{tableName},</if>
<if test="tableComment != null">#{tableComment},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
</trim>
</insert>
<update id="updateTopSearchTable" parameterType="TopSearchTable">
update gen_top_search_table
<trim prefix="SET" suffixOverrides=",">
<if test="tableName != null">table_name = #{tableName},</if>
<if test="tableComment != null">table_comment = #{tableComment},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTopSearchTableById" parameterType="Long">
delete from gen_top_search_table where id = #{id}
</delete>
<delete id="deleteTopSearchTableByIds" parameterType="String">
delete from gen_top_search_table where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteTopSearchColumnBySearchTableIds" parameterType="String">
delete from gen_top_search_column where search_table_id in
<foreach item="searchTableId" collection="array" open="(" separator="," close=")">
#{searchTableId}
</foreach>
</delete>
<delete id="deleteTopSearchColumnBySearchTableId" parameterType="Long">
delete from gen_top_search_column where search_table_id = #{searchTableId}
</delete>
<insert id="batchTopSearchColumn">
insert into gen_top_search_column(search_table_id,column_name,column_comment,column_type,is_use,create_by,create_time,update_by,update_time) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.searchTableId},#{item.columnName},#{item.columnComment},#{item.columnType},#{item.isUse},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime})
</foreach>
</insert>
</mapper>