top权限独立
This commit is contained in:
parent
ab4a25b524
commit
aaf2f719b4
|
|
@ -79,3 +79,11 @@ export function delTable(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
// 获取数据库表list
|
||||||
|
export function listDbTable(data) {
|
||||||
|
return request({
|
||||||
|
url: '/tool/table/db/list',
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,10 @@ export default {
|
||||||
codeUrl: "",
|
codeUrl: "",
|
||||||
cookiePassword: "",
|
cookiePassword: "",
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: "admin",
|
username: "clay",
|
||||||
password: "HCY@2020",
|
password: "926425",
|
||||||
|
// username: "admin",
|
||||||
|
// password: "HCY@2020",
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
code: "",
|
code: "",
|
||||||
uuid: ""
|
uuid: ""
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-table @row-click="clickRow" ref="table" :data="dbTableList" @selection-change="handleSelectionChange" height="260px">
|
<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 type="selection" width="55"></el-table-column>
|
||||||
<el-table-column prop="tableName" label="表名称" :show-overflow-tooltip="true"></el-table-column>
|
<el-table-column prop="table_name" 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="table_comment" label="表描述" :show-overflow-tooltip="true"></el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建时间"></el-table-column>
|
<el-table-column prop="create_time" label="创建时间"></el-table-column>
|
||||||
<!-- <el-table-column prop="updateTime" label="更新时间"></el-table-column>-->
|
<!-- <el-table-column prop="update_time" label="更新时间"></el-table-column>-->
|
||||||
</el-table>
|
</el-table>
|
||||||
<pagination
|
<pagination
|
||||||
v-show="total>0"
|
v-show="total>0"
|
||||||
|
|
@ -49,8 +49,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { listDbTable} from "@/api/tool/gen";
|
import {importTopTable,listDbTable} from '../../../api/tool/table'
|
||||||
import {importTopTable} from '../../../api/tool/table'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -83,7 +82,7 @@ export default {
|
||||||
},
|
},
|
||||||
// 多选框选中数据
|
// 多选框选中数据
|
||||||
handleSelectionChange(selection) {
|
handleSelectionChange(selection) {
|
||||||
this.tables = selection.map(item => item.tableName);
|
this.tables = selection.map(item => item.table_name);
|
||||||
},
|
},
|
||||||
// 查询表数据
|
// 查询表数据
|
||||||
getList() {
|
getList() {
|
||||||
|
|
|
||||||
|
|
@ -42,16 +42,6 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-row :gutter="10" class="mb8">
|
<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-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
type="success"
|
type="success"
|
||||||
|
|
@ -81,7 +71,6 @@
|
||||||
icon="el-icon-upload"
|
icon="el-icon-upload"
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="openImportTable"
|
@click="openImportTable"
|
||||||
v-hasPermi="['tool:gen:import']"
|
|
||||||
>导入</el-button>
|
>导入</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@
|
||||||
size="small"
|
size="small"
|
||||||
icon="el-icon-edit-outline"
|
icon="el-icon-edit-outline"
|
||||||
@click="handleEditTable(scope.row)"
|
@click="handleEditTable(scope.row)"
|
||||||
v-hasPermi="['tool:query:update']"
|
v-hasPermi="['tool:query:edit']"
|
||||||
>编辑</el-button>
|
>编辑</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -36,7 +36,6 @@ public class RealQueryController extends BaseController {
|
||||||
* @param realUniQuery
|
* @param realUniQuery
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ebts.hasAnyPermi('data:real:export')")
|
|
||||||
@PutMapping("/real/export")
|
@PutMapping("/real/export")
|
||||||
public AjaxResult exportReal(@Validated @RequestBody RealUniQuery realUniQuery) {
|
public AjaxResult exportReal(@Validated @RequestBody RealUniQuery realUniQuery) {
|
||||||
ServerResult<List<Map<String, Object>>> serverResult = realQueryService.RealData(realUniQuery, 1);
|
ServerResult<List<Map<String, Object>>> serverResult = realQueryService.RealData(realUniQuery, 1);
|
||||||
|
|
@ -53,7 +52,6 @@ public class RealQueryController extends BaseController {
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ebts.hasPermi('data:real:data')")
|
|
||||||
@GetMapping("/real/{id}")
|
@GetMapping("/real/{id}")
|
||||||
public AjaxResult RealInfo(@PathVariable("id") Long id) {
|
public AjaxResult RealInfo(@PathVariable("id") Long id) {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
|
|
@ -74,7 +72,6 @@ public class RealQueryController extends BaseController {
|
||||||
* @param realUniQuery
|
* @param realUniQuery
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ebts.hasAnyPermi('data:real:list')")
|
|
||||||
@PutMapping("/real")
|
@PutMapping("/real")
|
||||||
public Serializable RealData(@Validated @RequestBody RealUniQuery realUniQuery) {
|
public Serializable RealData(@Validated @RequestBody RealUniQuery realUniQuery) {
|
||||||
ServerResult<List<Map<String, Object>>> serverResult = realQueryService.RealData(realUniQuery, 2);
|
ServerResult<List<Map<String, Object>>> serverResult = realQueryService.RealData(realUniQuery, 2);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ public class QueryController extends BaseController {
|
||||||
private QueryService queryService;
|
private QueryService queryService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取编辑sql的基本信息
|
* todo 获取编辑sql的基本信息
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,6 @@ import java.util.Map;
|
||||||
@RequestMapping("/top")
|
@RequestMapping("/top")
|
||||||
public class TopQueryController extends BaseController {
|
public class TopQueryController extends BaseController {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TopSearchTableService topSearchTableService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UniQueryService uniQueryService;
|
private UniQueryService uniQueryService;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
package com.ebts.generator.controller;
|
package com.ebts.generator.controller;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
import com.ebts.common.core.controller.EBTSController;
|
import com.ebts.common.core.controller.EBTSController;
|
||||||
import com.ebts.common.core.text.Convert;
|
import com.ebts.common.core.text.Convert;
|
||||||
import com.ebts.common.utils.ServerResult;
|
import com.ebts.common.utils.ServerResult;
|
||||||
|
import com.ebts.generator.entity.GenTable;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
|
@ -122,6 +125,9 @@ public class TopSearchTableController extends EBTSController {
|
||||||
@Log(title = "top万能查询主", businessType = BusinessType.UPDATE)
|
@Log(title = "top万能查询主", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody TopSearchTable topSearchTable) {
|
public AjaxResult edit(@Validated @RequestBody TopSearchTable topSearchTable) {
|
||||||
|
if (topSearchTable.getRoleIds().length==0){
|
||||||
|
return AjaxResult.error("角色不能为空!");
|
||||||
|
}
|
||||||
ServerResult<Integer> genServerResult = topSearchTableService.updateTopSearchTable(topSearchTable);
|
ServerResult<Integer> genServerResult = topSearchTableService.updateTopSearchTable(topSearchTable);
|
||||||
if (genServerResult.isStart()) {
|
if (genServerResult.isStart()) {
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
@ -150,15 +156,29 @@ public class TopSearchTableController extends EBTSController {
|
||||||
/**
|
/**
|
||||||
* 导入表结构(保存)
|
* 导入表结构(保存)
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ebts.hasPermi('tool:gen:list')")
|
@PreAuthorize("@ebts.hasPermi('tool:table:import')")
|
||||||
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
@Log(title = "代码生成", businessType = BusinessType.IMPORT)
|
||||||
@PostMapping("/importTopTable")
|
@PostMapping("/importTopTable")
|
||||||
public AjaxResult importTableSave(String tables) {
|
public AjaxResult importTableSave(String tables) {
|
||||||
String[] tableNames = Convert.toStrArray(tables);
|
String[] tableNames = Convert.toStrArray(tables);
|
||||||
// 查询表信息
|
// 查询表信息
|
||||||
|
|
||||||
List<TopSearchTable> tableList = topSearchTableService.selectDbTableListByNames(tableNames);
|
List<TopSearchTable> tableList = topSearchTableService.selectDbTableListByNames(tableNames);
|
||||||
topSearchTableService.importGenTable(tableList);
|
topSearchTableService.importGenTable(tableList);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入表结构(获取)
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ebts.hasPermi('tool:table:db:list')")
|
||||||
|
@PostMapping("/db/list")
|
||||||
|
public Serializable dbList(@RequestBody Map<String,Object> params){
|
||||||
|
startPage(params);
|
||||||
|
List<Map<String,Object>> list = topSearchTableService.selectDbTableList(params);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ public interface SearchTableRoleDao {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
int deleteSearchTableRoleById(Long searchTableId);
|
int deleteSearchTableRoleById(Long searchTableId);
|
||||||
|
int deleteSearchTableRoleByIds(Long[] searchTableIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量添加top万能查询角色关系
|
* 批量添加top万能查询角色关系
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,9 @@
|
||||||
package com.ebts.generator.dao;
|
package com.ebts.generator.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.ebts.generator.entity.GenTable;
|
||||||
import com.ebts.generator.entity.TopSearchTable;
|
import com.ebts.generator.entity.TopSearchTable;
|
||||||
import com.ebts.generator.entity.TopSearchColumn;
|
import com.ebts.generator.entity.TopSearchColumn;
|
||||||
|
|
||||||
|
|
@ -45,6 +48,14 @@ public interface TopSearchTableDao {
|
||||||
*/
|
*/
|
||||||
List<TopSearchTable> selectDbTableListByNames(String[] tableNames);
|
List<TopSearchTable> selectDbTableListByNames(String[] tableNames);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据库表信息
|
||||||
|
*
|
||||||
|
* @param params 表名称组
|
||||||
|
* @return 数据库表集合
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> selectDbTableList(Map<String,Object> params);
|
||||||
/**
|
/**
|
||||||
* 根据表名查询列
|
* 根据表名查询列
|
||||||
* @param tableName
|
* @param tableName
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* top万能查询主对象 gen_top_search_table
|
* top万能查询主对象 gen_top_search_table
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ebts.generator.service;
|
package com.ebts.generator.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ebts.common.utils.ServerResult;
|
import com.ebts.common.utils.ServerResult;
|
||||||
import com.ebts.generator.entity.TopSearchColumn;
|
import com.ebts.generator.entity.TopSearchColumn;
|
||||||
|
|
@ -54,6 +55,8 @@ public interface TopSearchTableService {
|
||||||
|
|
||||||
List<TopSearchTable> selectDbTableListByNames(String[] tableNames);
|
List<TopSearchTable> selectDbTableListByNames(String[] tableNames);
|
||||||
|
|
||||||
|
List<Map<String,Object>> selectDbTableList(Map<String,Object> params);
|
||||||
|
|
||||||
void importGenTable(List<TopSearchTable> tableList);
|
void importGenTable(List<TopSearchTable> tableList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,6 @@ import java.util.List;
|
||||||
import com.ebts.common.constant.ReturnConstants;
|
import com.ebts.common.constant.ReturnConstants;
|
||||||
import com.ebts.common.exception.EbtsException;
|
import com.ebts.common.exception.EbtsException;
|
||||||
import com.ebts.common.utils.SecurityUtils;
|
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 com.ebts.common.utils.ServerResult;
|
||||||
import com.ebts.generator.dao.RelationalMapDao;
|
import com.ebts.generator.dao.RelationalMapDao;
|
||||||
import com.ebts.generator.dao.SearchTableRoleDao;
|
import com.ebts.generator.dao.SearchTableRoleDao;
|
||||||
|
|
@ -17,7 +14,10 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.ebts.common.utils.StringUtils;
|
import com.ebts.common.utils.StringUtils;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.ebts.generator.entity.TopSearchColumn;
|
import com.ebts.generator.entity.TopSearchColumn;
|
||||||
|
|
@ -27,7 +27,7 @@ import com.ebts.generator.service.TopSearchTableService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* top万能查询主Service业务层处理
|
* top万能查询主Service业务层处理
|
||||||
*
|
*
|
||||||
* @author clay
|
* @author clay
|
||||||
* @date 2021-07-20
|
* @date 2021-07-20
|
||||||
*/
|
*/
|
||||||
|
|
@ -44,7 +44,7 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询top万能查询主
|
* 查询top万能查询主
|
||||||
*
|
*
|
||||||
* @param id top万能查询主ID
|
* @param id top万能查询主ID
|
||||||
* @return top万能查询主
|
* @return top万能查询主
|
||||||
*/
|
*/
|
||||||
|
|
@ -52,26 +52,26 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
public ServerResult<TopSearchTable> selectTopSearchTableById(Long id) {
|
public ServerResult<TopSearchTable> selectTopSearchTableById(Long id) {
|
||||||
try {
|
try {
|
||||||
TopSearchTable topSearchTable = topSearchTableDao.selectTopSearchTableById(id);
|
TopSearchTable topSearchTable = topSearchTableDao.selectTopSearchTableById(id);
|
||||||
List<SearchTableRole> roleList = searchTableRoleDao.selectSearchTableRoleList(new SearchTableRole(id,null));
|
List<SearchTableRole> roleList = searchTableRoleDao.selectSearchTableRoleList(new SearchTableRole(id, null));
|
||||||
Long[] roles = new Long[roleList.size()] ;
|
Long[] roles = new Long[roleList.size()];
|
||||||
for (int i = 0; i < roleList.size(); i++) {
|
for (int i = 0; i < roleList.size(); i++) {
|
||||||
roles[i] = roleList.get(i).getRoleId();
|
roles[i] = roleList.get(i).getRoleId();
|
||||||
}
|
}
|
||||||
topSearchTable.setRoleIds(roles);
|
topSearchTable.setRoleIds(roles);
|
||||||
if (topSearchTable != null){
|
if (topSearchTable != null) {
|
||||||
return new ServerResult<>(true,topSearchTable);
|
return new ServerResult<>(true, topSearchTable);
|
||||||
}else {
|
} else {
|
||||||
return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY);
|
return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY);
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询top万能查询主列表
|
* 查询top万能查询主列表
|
||||||
*
|
*
|
||||||
* @param topSearchTable top万能查询主
|
* @param topSearchTable top万能查询主
|
||||||
* @return top万能查询主
|
* @return top万能查询主
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,14 +79,14 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
public ServerResult<List<TopSearchTable>> selectTopSearchTableList(TopSearchTable topSearchTable) {
|
public ServerResult<List<TopSearchTable>> selectTopSearchTableList(TopSearchTable topSearchTable) {
|
||||||
try {
|
try {
|
||||||
List<TopSearchTable> topSearchTableList = topSearchTableDao.selectTopSearchTableList(topSearchTable);
|
List<TopSearchTable> topSearchTableList = topSearchTableDao.selectTopSearchTableList(topSearchTable);
|
||||||
if (topSearchTableList.size()>0){
|
if (topSearchTableList.size() > 0) {
|
||||||
return new ServerResult<>(true,topSearchTableList);
|
return new ServerResult<>(true, topSearchTableList);
|
||||||
}else {
|
} else {
|
||||||
return new ServerResult<>(false,ReturnConstants.RESULT_EMPTY);
|
return new ServerResult<>(false, ReturnConstants.RESULT_EMPTY);
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,20 +94,20 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
public ServerResult<List<TopSearchTable>> selectTopSearchTableInfo() {
|
public ServerResult<List<TopSearchTable>> selectTopSearchTableInfo() {
|
||||||
try {
|
try {
|
||||||
List<TopSearchTable> tableList = topSearchTableDao.selectTopSearchTableInfo();
|
List<TopSearchTable> tableList = topSearchTableDao.selectTopSearchTableInfo();
|
||||||
return new ServerResult<>(true,tableList);
|
return new ServerResult<>(true, tableList);
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TopSearchColumn> selectTableColumns(Long id){
|
public List<TopSearchColumn> selectTableColumns(Long id) {
|
||||||
return topSearchTableDao.selectTableColumns(id);
|
return topSearchTableDao.selectTableColumns(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增top万能查询主
|
* 新增top万能查询主
|
||||||
*
|
*
|
||||||
* @param topSearchTable top万能查询主
|
* @param topSearchTable top万能查询主
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -117,23 +117,23 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
try {
|
try {
|
||||||
topSearchTable.setCreateBy(SecurityUtils.getUserId());
|
topSearchTable.setCreateBy(SecurityUtils.getUserId());
|
||||||
int renewal = topSearchTableDao.insertTopSearchTable(topSearchTable);
|
int renewal = topSearchTableDao.insertTopSearchTable(topSearchTable);
|
||||||
if (insertTopSearchColumn(topSearchTable)){
|
if (insertTopSearchColumn(topSearchTable)) {
|
||||||
return new ServerResult<>(false,ReturnConstants.DB_EX);
|
return new ServerResult<>(false, ReturnConstants.DB_EX);
|
||||||
}
|
}
|
||||||
if (renewal >0){
|
if (renewal > 0) {
|
||||||
return new ServerResult<>(true,renewal);
|
return new ServerResult<>(true, renewal);
|
||||||
}else {
|
} else {
|
||||||
return new ServerResult<>(false,ReturnConstants.SYS_FAILL);
|
return new ServerResult<>(false, ReturnConstants.SYS_FAILL);
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改top万能查询主
|
* 修改top万能查询主
|
||||||
*
|
*
|
||||||
* @param topSearchTable top万能查询主
|
* @param topSearchTable top万能查询主
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -143,35 +143,42 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
try {
|
try {
|
||||||
topSearchTable.setUpdateBy(SecurityUtils.getUserId());
|
topSearchTable.setUpdateBy(SecurityUtils.getUserId());
|
||||||
topSearchTableDao.deleteTopSearchColumnBySearchTableId(topSearchTable.getId());
|
topSearchTableDao.deleteTopSearchColumnBySearchTableId(topSearchTable.getId());
|
||||||
if (insertTopSearchColumn(topSearchTable)){
|
if (insertTopSearchColumn(topSearchTable)) {
|
||||||
return new ServerResult<>(false,ReturnConstants.DB_EX);
|
return new ServerResult<>(false, ReturnConstants.DB_EX);
|
||||||
}
|
}
|
||||||
List<SearchTableRole> searchTableRoles = new ArrayList<>();
|
List<SearchTableRole> searchTableRoles = new ArrayList<>();
|
||||||
for (Long roleId : topSearchTable.getRoleIds()) {
|
for (Long roleId : topSearchTable.getRoleIds()) {
|
||||||
searchTableRoles.add(new SearchTableRole(topSearchTable.getId(),roleId));
|
searchTableRoles.add(new SearchTableRole(topSearchTable.getId(), roleId));
|
||||||
}
|
}
|
||||||
relationalMapDao.deleteRelationalMapById(topSearchTable.getId());
|
relationalMapDao.deleteRelationalMapById(topSearchTable.getId());
|
||||||
List<RelationalMap> relationalMapList = topSearchTable.getRelationalMapList();
|
List<RelationalMap> relationalMapList = topSearchTable.getRelationalMapList();
|
||||||
for (RelationalMap relationalMap : relationalMapList) {
|
for (RelationalMap relationalMap : relationalMapList) {
|
||||||
relationalMap.setMainId(topSearchTable.getId());
|
relationalMap.setMainId(topSearchTable.getId());
|
||||||
}
|
}
|
||||||
boolean renewalMap = insertRelationalMap(relationalMapList);
|
insertRelationalMap(relationalMapList);
|
||||||
|
|
||||||
|
|
||||||
searchTableRoleDao.deleteSearchTableRoleById(topSearchTable.getId());
|
searchTableRoleDao.deleteSearchTableRoleById(topSearchTable.getId());
|
||||||
boolean renewalRole = inserTopTableRole(searchTableRoles);
|
boolean renewalRole = inserTopTableRole(searchTableRoles);
|
||||||
Integer renewal = topSearchTableDao.updateTopSearchTable(topSearchTable);
|
Integer renewal = topSearchTableDao.updateTopSearchTable(topSearchTable);
|
||||||
if (renewal >0 && renewalRole && renewalMap){
|
if (renewal > 0 && renewalRole) {
|
||||||
return new ServerResult<>(true,renewal);
|
return new ServerResult<>(true, renewal);
|
||||||
}else {
|
} else {
|
||||||
return new ServerResult<>(false,ReturnConstants.OP_ERROR);
|
return new ServerResult<>(false, ReturnConstants.OP_ERROR);
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// void deleteSearchTableRoleById(Long id){
|
||||||
|
// try {
|
||||||
|
//
|
||||||
|
// }catch (RuntimeException e){
|
||||||
|
// logger.error("无数据");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<TopSearchTable> selectDbTableListByNames(String[] tableNames) {
|
public List<TopSearchTable> selectDbTableListByNames(String[] tableNames) {
|
||||||
|
|
@ -179,7 +186,17 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
return topSearchTableDao.selectDbTableListByNames(tableNames);
|
return topSearchTableDao.selectDbTableListByNames(tableNames);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> selectDbTableList(Map<String, Object> params) {
|
||||||
|
try {
|
||||||
|
return topSearchTableDao.selectDbTableList(params);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,7 +209,7 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
String tableName = table.getTableName();
|
String tableName = table.getTableName();
|
||||||
table.setCreateBy(createBy);
|
table.setCreateBy(createBy);
|
||||||
int row = topSearchTableDao.insertTopSearchTable(table);
|
int row = topSearchTableDao.insertTopSearchTable(table);
|
||||||
if (row>0){
|
if (row > 0) {
|
||||||
List<TopSearchColumn> searchColumns = topSearchTableDao.selectDbTableColumnsByName(tableName);
|
List<TopSearchColumn> searchColumns = topSearchTableDao.selectDbTableColumnsByName(tableName);
|
||||||
for (TopSearchColumn searchColumn : searchColumns) {
|
for (TopSearchColumn searchColumn : searchColumns) {
|
||||||
searchColumn.setSearchTableId(table.getId());
|
searchColumn.setSearchTableId(table.getId());
|
||||||
|
|
@ -202,16 +219,16 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
throw new EbtsException("导入失败:" + e.getMessage(),e);
|
throw new EbtsException("导入失败:" + e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除top万能查询主
|
* 批量删除top万能查询主
|
||||||
*
|
*
|
||||||
* @param ids 需要删除的top万能查询主ID
|
* @param ids 需要删除的top万能查询主ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
|
|
@ -221,53 +238,56 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
try {
|
try {
|
||||||
//批量删除子表数据
|
//批量删除子表数据
|
||||||
topSearchTableDao.deleteTopSearchColumnBySearchTableIds(ids);
|
topSearchTableDao.deleteTopSearchColumnBySearchTableIds(ids);
|
||||||
|
searchTableRoleDao.deleteSearchTableRoleByIds(ids);
|
||||||
Integer renewal = topSearchTableDao.deleteTopSearchTableByIds(ids);
|
Integer renewal = topSearchTableDao.deleteTopSearchTableByIds(ids);
|
||||||
if (renewal >0){
|
if (renewal > 0) {
|
||||||
return new ServerResult<>(true,renewal);
|
return new ServerResult<>(true, renewal);
|
||||||
}else {
|
} else {
|
||||||
return new ServerResult<>(false,ReturnConstants.SYS_FAILL);
|
return new ServerResult<>(false, ReturnConstants.SYS_FAILL);
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除top万能查询主信息
|
* 删除top万能查询主信息
|
||||||
*
|
*
|
||||||
* @param id top万能查询主ID
|
* @param id top万能查询主ID
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ServerResult<Integer> deleteTopSearchTableById(Long id) {
|
public ServerResult<Integer> deleteTopSearchTableById(Long id) {
|
||||||
try {
|
try {
|
||||||
//删除子表数据
|
//删除子表数据
|
||||||
topSearchTableDao.deleteTopSearchColumnBySearchTableId(id);
|
topSearchTableDao.deleteTopSearchColumnBySearchTableId(id);
|
||||||
Integer renewal = topSearchTableDao.deleteTopSearchTableById(id);
|
Integer renewal = topSearchTableDao.deleteTopSearchTableById(id);
|
||||||
if (renewal >0){
|
if (renewal > 0) {
|
||||||
return new ServerResult<>(true,renewal);
|
return new ServerResult<>(true, renewal);
|
||||||
}else {
|
} else {
|
||||||
return new ServerResult<>(false,ReturnConstants.SYS_FAILL);
|
return new ServerResult<>(false, ReturnConstants.SYS_FAILL);
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
throw new EbtsException(ReturnConstants.OP_ERROR,e);
|
throw new EbtsException(ReturnConstants.OP_ERROR, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public boolean inserTopTableRole(List<SearchTableRole> roleList){
|
|
||||||
if (StringUtils.isNotNull(roleList)){
|
public boolean inserTopTableRole(List<SearchTableRole> roleList) {
|
||||||
|
if (StringUtils.isNotNull(roleList)) {
|
||||||
Integer renewal = searchTableRoleDao.batchSearchTableRole(roleList);
|
Integer renewal = searchTableRoleDao.batchSearchTableRole(roleList);
|
||||||
if (renewal>0){
|
if (renewal > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
public boolean insertRelationalMap(List<RelationalMap> relationalMaps){
|
|
||||||
if (StringUtils.isNotNull(relationalMaps)){
|
public boolean insertRelationalMap(List<RelationalMap> relationalMaps) {
|
||||||
|
if (StringUtils.isNotNull(relationalMaps) && relationalMaps.size() > 0) {
|
||||||
Integer renewal = relationalMapDao.batchRelationalMap(relationalMaps);
|
Integer renewal = relationalMapDao.batchRelationalMap(relationalMaps);
|
||||||
if (renewal>0){
|
if (renewal > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -276,7 +296,7 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增top万能查询字段信息
|
* 新增top万能查询字段信息
|
||||||
*
|
*
|
||||||
* @param topSearchTable top万能查询主对象
|
* @param topSearchTable top万能查询主对象
|
||||||
*/
|
*/
|
||||||
public boolean insertTopSearchColumn(TopSearchTable topSearchTable) {
|
public boolean insertTopSearchColumn(TopSearchTable topSearchTable) {
|
||||||
|
|
@ -284,13 +304,13 @@ public class TopSearchTableServiceImpl implements TopSearchTableService {
|
||||||
Long id = topSearchTable.getId();
|
Long id = topSearchTable.getId();
|
||||||
if (StringUtils.isNotNull(topSearchColumnList)) {
|
if (StringUtils.isNotNull(topSearchColumnList)) {
|
||||||
List<TopSearchColumn> list = new ArrayList<TopSearchColumn>();
|
List<TopSearchColumn> list = new ArrayList<TopSearchColumn>();
|
||||||
for (TopSearchColumn topSearchColumn : topSearchColumnList){
|
for (TopSearchColumn topSearchColumn : topSearchColumnList) {
|
||||||
topSearchColumn.setSearchTableId(id);
|
topSearchColumn.setSearchTableId(id);
|
||||||
list.add(topSearchColumn);
|
list.add(topSearchColumn);
|
||||||
}
|
}
|
||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
Integer renewal = topSearchTableDao.batchTopSearchColumn(list);
|
Integer renewal = topSearchTableDao.batchTopSearchColumn(list);
|
||||||
if (renewal>0){
|
if (renewal > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
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 '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}, '%'))
|
||||||
|
|
@ -105,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<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_%'
|
where table_name NOT LIKE 'qrtz_%'
|
||||||
|
AND table_name NOT LIKE 'gen_%'
|
||||||
AND table_schema = (select database())
|
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=")">
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
<result property="ucType" column="uc_type" />
|
<result property="ucType" column="uc_type" />
|
||||||
<result property="type" column="type" />
|
<result property="type" column="type" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="UniQuery" resultType="java.util.HashMap">
|
<select id="UniQuery" resultType="java.util.Map">
|
||||||
${paramSQL}
|
${paramSQL}
|
||||||
</select>
|
</select>
|
||||||
<delete id="deleteMenu">
|
<delete id="deleteMenu">
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,7 @@
|
||||||
<result property="createBy" column="create_by"/>
|
<result property="createBy" column="create_by"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
<select id="tableInfos" resultType="java.util.Map">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="tableInfos" resultType="java.util.HashMap">
|
|
||||||
select table_name, table_comment
|
select table_name, table_comment
|
||||||
from information_schema.tables
|
from information_schema.tables
|
||||||
where table_schema = (select database())
|
where table_schema = (select database())
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
left join gen_relational_mapping grm on grm.main_id = gtst.id
|
left join gen_relational_mapping grm on grm.main_id = gtst.id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<!--AND table_name NOT LIKE 'gen_%'-->
|
||||||
|
<select id="selectDbTableList" resultType="java.util.Map">
|
||||||
|
select table_name, table_comment, create_time, update_time from information_schema.tables
|
||||||
|
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_top_search_table)
|
||||||
|
<if test="tableName != null and tableName != ''">
|
||||||
|
AND lower(table_name) like lower(concat('%', #{tableName}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="tableComment != null and tableComment != ''">
|
||||||
|
AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
||||||
|
AND date_format(create_time,'%y%m%d') >= date_format(#{beginTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
||||||
|
AND date_format(create_time,'%y%m%d') <= date_format(#{endTime},'%y%m%d')
|
||||||
|
</if>
|
||||||
|
</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 in
|
and table_name NOT LIKE 'gen_%'
|
||||||
|
and table_schema = (select database())
|
||||||
|
and table_name in
|
||||||
<foreach collection="array" item="name" open="(" separator="," close=")">
|
<foreach collection="array" item="name" open="(" separator="," close=")">
|
||||||
#{name}
|
#{name}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|
|
||||||
|
|
@ -527,10 +527,11 @@ export default {
|
||||||
#foreach($column in $table.relColumns)
|
#foreach($column in $table.relColumns)
|
||||||
#if($column.isQuery == '1' && $column.htmlType != "datetime" && $column.queryType != "BETWEEN")
|
#if($column.isQuery == '1' && $column.htmlType != "datetime" && $column.queryType != "BETWEEN")
|
||||||
${column.javaField}: null#if($velocityCount != $columns.size()),#end
|
${column.javaField}: null#if($velocityCount != $columns.size()),#end
|
||||||
#end
|
|
||||||
#end
|
|
||||||
|
|
||||||
params:{},
|
#end
|
||||||
|
#end
|
||||||
|
params:{},
|
||||||
|
},
|
||||||
#if($velocityCount != $relTables.size()),#end
|
#if($velocityCount != $relTables.size()),#end
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="realUniQuery" resultType="java.util.HashMap">
|
<select id="realUniQuery" resultType="java.util.Map">
|
||||||
${paramSQL}
|
${paramSQL}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue