This commit is contained in:
parent
fea4dc4540
commit
2a79f7002b
|
|
@ -92,3 +92,11 @@ export function getRealData(data){
|
||||||
data:data
|
data:data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
//发布撤销
|
||||||
|
export function Release(data){
|
||||||
|
return request({
|
||||||
|
url: "/query/release",
|
||||||
|
method: 'put',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,41 @@
|
||||||
<el-form-item v-for="item in uconList"
|
<el-form-item v-for="item in uconList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.ucName">
|
:label="item.ucName">
|
||||||
<el-input v-model="item.ucReal"
|
|
||||||
|
<el-input v-if="item.type == 1" v-model="item.ucReal"
|
||||||
clearable
|
clearable
|
||||||
:placeholder="outPlaceholder(item)"
|
:placeholder="outPlaceholder(item)"
|
||||||
size="small"
|
size="small"
|
||||||
@keyup.enter.native="handleQuery"
|
@keyup.enter.native="handleQuery"
|
||||||
/>
|
/>
|
||||||
|
<div style="width: 200px" v-else-if="item.type == 2">
|
||||||
|
<el-row :gutter="15">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-input size="small" placeholder="开始值" v-model="item.ucReal.begin"></el-input>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-input size="small" placeholder="结束值" v-model="item.ucReal.end"></el-input>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</div>
|
||||||
|
<el-date-picker
|
||||||
|
v-else-if="item.type ==3"
|
||||||
|
v-model="item.ucReal"
|
||||||
|
type="date"
|
||||||
|
format="yyyy-MM-dd"
|
||||||
|
value-format="yyyy-MM-dd"
|
||||||
|
placeholder="选择日期时间">
|
||||||
|
</el-date-picker>
|
||||||
|
<el-date-picker v-else-if="item.type ==4"
|
||||||
|
v-model="item.ucReal"
|
||||||
|
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-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
|
@ -25,7 +54,8 @@
|
||||||
size="mini"
|
size="mini"
|
||||||
@click="handleExport"
|
@click="handleExport"
|
||||||
v-hasPermi="['tool:query:export']"
|
v-hasPermi="['tool:query:export']"
|
||||||
>导出</el-button>
|
>导出
|
||||||
|
</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery"></right-toolbar>
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery"></right-toolbar>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -49,6 +79,17 @@
|
||||||
<script>
|
<script>
|
||||||
import {getRealInfo, getRealData} from "@/api/tool/query"
|
import {getRealInfo, getRealData} from "@/api/tool/query"
|
||||||
|
|
||||||
|
function listInit(list) {
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].type == 2) {
|
||||||
|
list[i].ucReal = {begin: null, end: null}
|
||||||
|
} else if (list[i].type == 4) {
|
||||||
|
list[i].ucReal = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "queryDate",
|
name: "queryDate",
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -70,11 +111,37 @@ export default {
|
||||||
created() {
|
created() {
|
||||||
this.dataId = this.$route.fullPath.split("/")[3]
|
this.dataId = this.$route.fullPath.split("/")[3]
|
||||||
getRealInfo(this.dataId).then(res => {
|
getRealInfo(this.dataId).then(res => {
|
||||||
this.uconList = res.data
|
console.log(res)
|
||||||
|
this.uconList = listInit(res.data)
|
||||||
})
|
})
|
||||||
this.handleQuery()
|
this.handleQuery()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
JSONString(list) {
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].type == 2) {
|
||||||
|
list[i].ucReal = JSON.stringify(list[i].ucReal)
|
||||||
|
} else if (list[i].type == 4) {
|
||||||
|
let time = {
|
||||||
|
startTime: list[i].ucReal[0],
|
||||||
|
endTime: list[i].ucReal[1],
|
||||||
|
}
|
||||||
|
list[i].ucReal = JSON.stringify(time)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
},
|
||||||
|
JSONparse(list) {
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
|
if (list[i].type == 2) {
|
||||||
|
list[i].ucReal = JSON.parse(list[i].ucReal)
|
||||||
|
} else if (list[i].type == 4) {
|
||||||
|
let time = JSON.parse(list[i].ucReal)
|
||||||
|
list[i].ucReal = [time.startTime, time.endTime]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
},
|
||||||
outPlaceholder(item) {
|
outPlaceholder(item) {
|
||||||
return "请输入" + item.ucName
|
return "请输入" + item.ucName
|
||||||
},
|
},
|
||||||
|
|
@ -95,8 +162,8 @@ export default {
|
||||||
pageNum: this.queryParams.pageNum,
|
pageNum: this.queryParams.pageNum,
|
||||||
pageSize: this.queryParams.pageSize,
|
pageSize: this.queryParams.pageSize,
|
||||||
}
|
}
|
||||||
let list = this.uconList
|
// let list = this.JSONString(this.uconList)
|
||||||
data.uniCons = list
|
data.uniCons = this.uconList
|
||||||
getRealData(data).then(res => {
|
getRealData(data).then(res => {
|
||||||
this.realDate.data = res.rows
|
this.realDate.data = res.rows
|
||||||
this.total = res.total
|
this.total = res.total
|
||||||
|
|
@ -104,7 +171,6 @@ export default {
|
||||||
for (var key in this.realDate.data[0]) {
|
for (var key in this.realDate.data[0]) {
|
||||||
this.realDate.header.push(key)
|
this.realDate.header.push(key)
|
||||||
}
|
}
|
||||||
console.log(res)
|
|
||||||
})
|
})
|
||||||
console.log(5)
|
console.log(5)
|
||||||
},
|
},
|
||||||
|
|
@ -116,7 +182,7 @@ export default {
|
||||||
confirmButtonText: "确定",
|
confirmButtonText: "确定",
|
||||||
cancelButtonText: "取消",
|
cancelButtonText: "取消",
|
||||||
type: "warning"
|
type: "warning"
|
||||||
}).then(function() {
|
}).then(function () {
|
||||||
// return exportQuery(queryParams);
|
// return exportQuery(queryParams);
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
this.download(response.msg);
|
this.download(response.msg);
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,10 @@
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<el-button type="text" icon="el-icon-upload" size="medium" @click="submitForm">提交</el-button>
|
<el-button type="text" icon="el-icon-upload" size="medium" @click="submitForm">提交</el-button>
|
||||||
<el-button type="text" icon="el-icon-view" size="medium" @click="previewQuery">预览</el-button>
|
<el-button type="text" icon="el-icon-view" size="medium" @click="previewQuery">预览</el-button>
|
||||||
<el-button type="text" icon="el-icon-plus" size="medium" @click="handleAdd"
|
<el-button type="text" icon="el-icon-plus" size="medium" @click="handleAdd" >新增</el-button>
|
||||||
v-hasPermi="['tool:module:export']">新增
|
<el-button type="text" icon="el-icon-download" size="medium">导出</el-button>
|
||||||
</el-button>
|
<el-button v-if="info.isRelease == 2" type="text" icon="el-icon-success" size="medium" @click="handRelease(1)">发布</el-button>
|
||||||
<el-button type="text" icon="el-icon-download" size="medium" v-hasPermi="['tool:module:export']">导出
|
<el-button v-if="info.isRelease == 1" type="text" icon="el-icon-error" size="medium" @click="handRelease(2)">撤销</el-button>
|
||||||
</el-button>
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-form>
|
</el-form>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
@ -74,7 +73,7 @@
|
||||||
</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-input v-if="scope.row.type == 1" 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">
|
||||||
<el-row :gutter="15">
|
<el-row :gutter="15">
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
|
|
@ -154,7 +153,7 @@ import 'codemirror/mode/sql/sql.js'
|
||||||
import 'codemirror/addon/hint/show-hint.css';
|
import 'codemirror/addon/hint/show-hint.css';
|
||||||
import 'codemirror/addon/hint/show-hint.js';
|
import 'codemirror/addon/hint/show-hint.js';
|
||||||
import 'codemirror/addon/hint/sql-hint.js';
|
import 'codemirror/addon/hint/sql-hint.js';
|
||||||
import {getQueryInfo, editQueryInfo, previewQueryData} from '@/api/tool/query'
|
import {getQueryInfo, editQueryInfo, previewQueryData, Release} from '@/api/tool/query'
|
||||||
import {Message} from "element-ui";
|
import {Message} from "element-ui";
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -291,6 +290,21 @@ export default {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
|
/** 发布与撤销 */
|
||||||
|
handRelease(release){
|
||||||
|
let data = {
|
||||||
|
id: this.queryId,
|
||||||
|
isRelease: release,
|
||||||
|
}
|
||||||
|
Release(data).then(res=>{
|
||||||
|
console.log(res)
|
||||||
|
this.info.isRelease = (this.info.isRelease==1)?2:1
|
||||||
|
Message({
|
||||||
|
message:res.msg,
|
||||||
|
type:"success"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
/** 预览 */
|
/** 预览 */
|
||||||
previewQuery() {
|
previewQuery() {
|
||||||
this.$refs['elForm'].validate(valid => {
|
this.$refs['elForm'].validate(valid => {
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,6 @@ public class ReturnConstants {
|
||||||
public static final String INTER_NULL = "该类下接口数据为空,请先添加接口!";
|
public static final String INTER_NULL = "该类下接口数据为空,请先添加接口!";
|
||||||
|
|
||||||
public static final String STATE_ERROR = "状态错错误!";
|
public static final String STATE_ERROR = "状态错错误!";
|
||||||
|
|
||||||
|
public static final String OP_ERROR = "操作失败!";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Size;
|
import javax.validation.constraints.Size;
|
||||||
|
|
||||||
|
import com.hchyun.common.utils.DateUtils;
|
||||||
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 com.hchyun.common.core.entity.BaseEntity;
|
import com.hchyun.common.core.entity.BaseEntity;
|
||||||
|
|
@ -92,6 +93,24 @@ public class SysMenu extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private List<SysMenu> children = new ArrayList<SysMenu>();
|
private List<SysMenu> children = new ArrayList<SysMenu>();
|
||||||
|
|
||||||
|
public SysMenu() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SysMenu(Long uqId,String uqName,Long create) {
|
||||||
|
parentId = 6L;
|
||||||
|
menuName = uqName;
|
||||||
|
orderNum = "0";
|
||||||
|
path = "data/"+uqId;
|
||||||
|
component = "tool/query/queryDate";
|
||||||
|
isFrame="1";
|
||||||
|
isCache = "0";
|
||||||
|
menuType = "C";
|
||||||
|
visible = "0";
|
||||||
|
status = "0";
|
||||||
|
icon = "chart";
|
||||||
|
setCreateBy(create);
|
||||||
|
}
|
||||||
|
|
||||||
public Long getMenuId() {
|
public Long getMenuId() {
|
||||||
return menuId;
|
return menuId;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ public class InterTableController extends HcyBaseController {
|
||||||
// */
|
// */
|
||||||
// @PreAuthorize("@ss.hasPermi('generator:intertable:query')")
|
// @PreAuthorize("@ss.hasPermi('generator:intertable:query')")
|
||||||
// @GetMapping(value = "/{id}")
|
// @GetMapping(value = "/{id}")
|
||||||
// public AjaxResult getInfo(@PathVariable("id") Long id) {
|
// public AjaxResult Info(@PathVariable("id") Long id) {
|
||||||
// try {
|
// try {
|
||||||
// ServerResult<InterTable> serverResult = interTableService.selectInterTableById(id);
|
// ServerResult<InterTable> serverResult = interTableService.selectInterTableById(id);
|
||||||
// if (serverResult.isStart()) {
|
// if (serverResult.isStart()) {
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
package com.hchyun.generator.controller;
|
package com.hchyun.generator.controller;
|
||||||
|
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import com.hchyun.common.constant.HttpStatus;
|
|
||||||
import com.hchyun.common.constant.ReturnConstants;
|
import com.hchyun.common.constant.ReturnConstants;
|
||||||
import com.hchyun.common.core.controller.BaseController;
|
import com.hchyun.common.core.controller.BaseController;
|
||||||
import com.hchyun.common.core.entity.AjaxResult;
|
import com.hchyun.common.core.entity.AjaxResult;
|
||||||
import com.hchyun.common.core.page.TableDataInfo;
|
|
||||||
import com.hchyun.common.utils.ServerResult;
|
import com.hchyun.common.utils.ServerResult;
|
||||||
import com.hchyun.common.utils.StringUtils;
|
import com.hchyun.common.utils.StringUtils;
|
||||||
import com.hchyun.common.utils.sql.SqlUtil;
|
import com.hchyun.common.utils.sql.SqlUtil;
|
||||||
|
|
@ -50,12 +47,12 @@ public class QueryController extends BaseController {
|
||||||
@ApiOperation("获取查询基本信息")
|
@ApiOperation("获取查询基本信息")
|
||||||
@PreAuthorize("@ss.hasPermi('query:real:list')")
|
@PreAuthorize("@ss.hasPermi('query:real:list')")
|
||||||
@GetMapping("/real/{id}")
|
@GetMapping("/real/{id}")
|
||||||
public AjaxResult getRealInfo(@PathVariable("id") Long id) {
|
public AjaxResult RealInfo(@PathVariable("id") Long id) {
|
||||||
try {
|
try {
|
||||||
if (id == null) {
|
if (id == null) {
|
||||||
return AjaxResult.error("id不能为空!");
|
return AjaxResult.error("id不能为空!");
|
||||||
}
|
}
|
||||||
ServerResult<List<UniCon>> serverResult = queryService.getRealInfo(id);
|
ServerResult<List<UniCon>> serverResult = queryService.RealInfo(id);
|
||||||
if (serverResult.isStart()) {
|
if (serverResult.isStart()) {
|
||||||
return AjaxResult.success(serverResult.getData());
|
return AjaxResult.success(serverResult.getData());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -70,15 +67,15 @@ public class QueryController extends BaseController {
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasAnyPermi('query:real:data')")
|
@PreAuthorize("@ss.hasAnyPermi('query:real:data')")
|
||||||
@PutMapping("/real")
|
@PutMapping("/real")
|
||||||
public Serializable getRealData(@Validated @RequestBody UniQuery uniQuery){
|
public Serializable RealData(@Validated @RequestBody UniQuery uniQuery) {
|
||||||
try {
|
try {
|
||||||
ServerResult<List<Map<String,Object>>> serverResult = queryService.getRealData(uniQuery);
|
ServerResult<List<Map<String, Object>>> serverResult = queryService.RealData(uniQuery);
|
||||||
if (serverResult.isStart()){
|
if (serverResult.isStart()) {
|
||||||
return getDataTable(serverResult.getData());
|
return getDataTable(serverResult.getData());
|
||||||
}else {
|
} else {
|
||||||
return AjaxResult.error(serverResult.getMsg());
|
return AjaxResult.error(serverResult.getMsg());
|
||||||
}
|
}
|
||||||
}catch (RuntimeException e){
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
}
|
}
|
||||||
|
|
@ -87,7 +84,7 @@ public class QueryController extends BaseController {
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('query:list')")
|
@PreAuthorize("@ss.hasPermi('query:list')")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
public AjaxResult Info(@PathVariable("id") Long id) {
|
||||||
try {
|
try {
|
||||||
ServerResult<UniQuery> serverResult = queryService.selectQueryById(id);
|
ServerResult<UniQuery> serverResult = queryService.selectQueryById(id);
|
||||||
if (serverResult.isStart()) {
|
if (serverResult.isStart()) {
|
||||||
|
|
@ -150,6 +147,30 @@ public class QueryController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PutMapping("/release")
|
||||||
|
public AjaxResult Release(@RequestBody UniQuery uniQuery) {
|
||||||
|
try {
|
||||||
|
if (uniQuery.getId() == null) {
|
||||||
|
return AjaxResult.error("id不能为空!");
|
||||||
|
} else {
|
||||||
|
if (uniQuery.getIsRelease() == 1 || uniQuery.getIsRelease() == 2) {
|
||||||
|
ServerResult<Integer> serverResult = queryService.Release(uniQuery);
|
||||||
|
if (serverResult.isStart()){
|
||||||
|
return AjaxResult.success();
|
||||||
|
}else {
|
||||||
|
return AjaxResult.error(serverResult.getMsg());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return AjaxResult.error("状态输入错误!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
return AjaxResult.error(ReturnConstants.SYS_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('query:edit')")
|
@PreAuthorize("@ss.hasPermi('query:edit')")
|
||||||
@GetMapping("/export/{id}")
|
@GetMapping("/export/{id}")
|
||||||
public AjaxResult Export(@PathVariable("id") Long id) {
|
public AjaxResult Export(@PathVariable("id") Long id) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.hchyun.generator.dao;
|
package com.hchyun.generator.dao;
|
||||||
|
|
||||||
|
import com.hchyun.common.core.entity.entity.SysMenu;
|
||||||
import com.hchyun.generator.entity.UniCon;
|
import com.hchyun.generator.entity.UniCon;
|
||||||
import com.hchyun.generator.entity.UniQuery;
|
import com.hchyun.generator.entity.UniQuery;
|
||||||
|
|
||||||
|
|
@ -17,7 +18,6 @@ public interface QueryDao {
|
||||||
|
|
||||||
Integer updateQueryInfo(UniQuery uniQuery);
|
Integer updateQueryInfo(UniQuery uniQuery);
|
||||||
|
|
||||||
|
|
||||||
Integer deleteUniCon(Long uqId);
|
Integer deleteUniCon(Long uqId);
|
||||||
|
|
||||||
Integer insertUniCon(List<UniCon> uniCons);
|
Integer insertUniCon(List<UniCon> uniCons);
|
||||||
|
|
@ -26,4 +26,12 @@ public interface QueryDao {
|
||||||
|
|
||||||
List<UniCon> queryRealInfo(Long id);
|
List<UniCon> queryRealInfo(Long id);
|
||||||
|
|
||||||
|
Integer Release(Long id);
|
||||||
|
|
||||||
|
Integer changeRelease(UniQuery uniQuery);
|
||||||
|
|
||||||
|
Integer insertMenu(SysMenu sysMenu);
|
||||||
|
|
||||||
|
Integer deleteMenu(String path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class UniCon {
|
||||||
/**
|
/**
|
||||||
* 真实数据
|
* 真实数据
|
||||||
*/
|
*/
|
||||||
private String ucReal;
|
private Object ucReal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述
|
* 描述
|
||||||
|
|
@ -131,11 +131,11 @@ public class UniCon {
|
||||||
this.ucDescribe = ucDescribe;
|
this.ucDescribe = ucDescribe;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUcReal() {
|
public Object getUcReal() {
|
||||||
return ucReal;
|
return ucReal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUcReal(String ucReal) {
|
public void setUcReal(Object ucReal) {
|
||||||
this.ucReal = ucReal;
|
this.ucReal = ucReal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -39,12 +39,19 @@ public interface QueryService {
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ServerResult<List<UniCon>> getRealInfo(Long id);
|
ServerResult<List<UniCon>> RealInfo(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取查询信息
|
* 获取查询信息
|
||||||
* @param uniQuery
|
* @param uniQuery
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ServerResult<List<Map<String,Object>>> getRealData(UniQuery uniQuery);
|
ServerResult<List<Map<String,Object>>> RealData(UniQuery uniQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param uniQuery
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
ServerResult<Integer> Release(UniQuery uniQuery);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@ package com.hchyun.generator.service.impl;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.hchyun.common.constant.ReturnConstants;
|
import com.hchyun.common.constant.ReturnConstants;
|
||||||
|
import com.hchyun.common.core.entity.entity.SysMenu;
|
||||||
import com.hchyun.common.utils.DateUtils;
|
import com.hchyun.common.utils.DateUtils;
|
||||||
|
import com.hchyun.common.utils.SecurityUtils;
|
||||||
import com.hchyun.common.utils.ServerResult;
|
import com.hchyun.common.utils.ServerResult;
|
||||||
import com.hchyun.generator.dao.QueryDao;
|
import com.hchyun.generator.dao.QueryDao;
|
||||||
import com.hchyun.generator.dao.UniQueryDao;
|
import com.hchyun.generator.dao.UniQueryDao;
|
||||||
|
|
@ -17,8 +19,8 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -36,6 +38,7 @@ public class QueryServiceImpl implements QueryService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private UniQueryDao uniQueryDao;
|
private UniQueryDao uniQueryDao;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询万能查询的基本信息和条件信息
|
* 查询万能查询的基本信息和条件信息
|
||||||
*
|
*
|
||||||
|
|
@ -58,7 +61,45 @@ public class QueryServiceImpl implements QueryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerResult<List<Map<String, Object>>> getRealData(UniQuery uniQuery) {
|
@Transactional
|
||||||
|
public ServerResult<Integer> Release(UniQuery uniQuery) {
|
||||||
|
try {
|
||||||
|
Integer isRelease = queryDao.Release(uniQuery.getId());
|
||||||
|
if ((isRelease == 1 && uniQuery.getIsRelease() == 2) || (isRelease == 2 && uniQuery.getIsRelease() == 1)) {
|
||||||
|
if (uniQuery.getIsRelease() == 1) {
|
||||||
|
UniQuery query = uniQueryDao.selectUniQueryById(uniQuery.getId());
|
||||||
|
SysMenu sysMenu = new SysMenu(query.getId(), query.getUqName(), SecurityUtils.getUserId());
|
||||||
|
Integer insermenu = queryDao.insertMenu(sysMenu);
|
||||||
|
if (insermenu == 0) {
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return new ServerResult<Integer>(false, ReturnConstants.OP_ERROR);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Integer deleteMenu = queryDao.deleteMenu("data/" + uniQuery.getId());
|
||||||
|
if (deleteMenu == 0) {
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return new ServerResult<Integer>(false, ReturnConstants.OP_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Integer release = queryDao.changeRelease(uniQuery);
|
||||||
|
if (release > 0) {
|
||||||
|
return new ServerResult<Integer>(true);
|
||||||
|
} else {
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return new ServerResult<Integer>(false, ReturnConstants.OP_ERROR);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new ServerResult<Integer>(false, ReturnConstants.STATE_ERROR);
|
||||||
|
}
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
logger.error(e.getMessage());
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
return new ServerResult<Integer>(false, ReturnConstants.SYS_FAILL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ServerResult<List<Map<String, Object>>> RealData(UniQuery uniQuery) {
|
||||||
try {
|
try {
|
||||||
List<UniCon> uniCons = uniQuery.getUniCons();
|
List<UniCon> uniCons = uniQuery.getUniCons();
|
||||||
Integer pageNum = uniQuery.getPageNum();
|
Integer pageNum = uniQuery.getPageNum();
|
||||||
|
|
@ -74,7 +115,7 @@ public class QueryServiceImpl implements QueryService {
|
||||||
for (UniCon uniCon : uniCons) {
|
for (UniCon uniCon : uniCons) {
|
||||||
sql += conversionReal(uniCon);
|
sql += conversionReal(uniCon);
|
||||||
}
|
}
|
||||||
sql+= " 1 = 1";
|
sql += " 1 = 1";
|
||||||
}
|
}
|
||||||
PageHelper.startPage(pageNum, pageSize, "");
|
PageHelper.startPage(pageNum, pageSize, "");
|
||||||
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql);
|
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql);
|
||||||
|
|
@ -102,12 +143,12 @@ public class QueryServiceImpl implements QueryService {
|
||||||
queryDao.deleteUniCon(uniQuery.getId());
|
queryDao.deleteUniCon(uniQuery.getId());
|
||||||
Integer ucrenewal = queryDao.insertUniCon(uniQuery.getUniCons());
|
Integer ucrenewal = queryDao.insertUniCon(uniQuery.getUniCons());
|
||||||
if (ucrenewal == 0) {
|
if (ucrenewal == 0) {
|
||||||
return new ServerResult(false, "操作失败!");
|
return new ServerResult(false, ReturnConstants.OP_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new ServerResult(true);
|
return new ServerResult(true);
|
||||||
}
|
}
|
||||||
return new ServerResult(false, "操作失败!");
|
return new ServerResult(false, ReturnConstants.OP_ERROR);
|
||||||
} catch (RuntimeException e) {
|
} catch (RuntimeException e) {
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
|
|
@ -129,7 +170,7 @@ public class QueryServiceImpl implements QueryService {
|
||||||
for (UniCon uniCon : uniConList) {
|
for (UniCon uniCon : uniConList) {
|
||||||
sql += conversionPreview(uniCon);
|
sql += conversionPreview(uniCon);
|
||||||
}
|
}
|
||||||
sql+= " 1 = 1";
|
sql += " 1 = 1";
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql);
|
List<Map<String, Object>> dataMap = queryDao.UniQuery(sql);
|
||||||
return new ServerResult<List<Map<String, Object>>>(true, dataMap);
|
return new ServerResult<List<Map<String, Object>>>(true, dataMap);
|
||||||
|
|
@ -140,7 +181,7 @@ public class QueryServiceImpl implements QueryService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerResult<List<UniCon>> getRealInfo(Long id) {
|
public ServerResult<List<UniCon>> RealInfo(Long id) {
|
||||||
try {
|
try {
|
||||||
List<UniCon> uniCons = queryDao.queryRealInfo(id);
|
List<UniCon> uniCons = queryDao.queryRealInfo(id);
|
||||||
return new ServerResult<List<UniCon>>(true, uniCons);
|
return new ServerResult<List<UniCon>>(true, uniCons);
|
||||||
|
|
@ -155,9 +196,6 @@ public class QueryServiceImpl implements QueryService {
|
||||||
if (uniCon.getUcReal() == null) {
|
if (uniCon.getUcReal() == null) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
if (uniCon.getUcType().equals("datetime")) {
|
|
||||||
uniCon.setUcReal(DateUtils.getDate(uniCon.getUcReal()));
|
|
||||||
}
|
|
||||||
String sql = "";
|
String sql = "";
|
||||||
if (uniCon.getUcCon().equals("EQ")) {
|
if (uniCon.getUcCon().equals("EQ")) {
|
||||||
sql += uniCon.getUcKey() + " = '" + uniCon.getUcReal() + "' and ";
|
sql += uniCon.getUcKey() + " = '" + uniCon.getUcReal() + "' and ";
|
||||||
|
|
@ -172,17 +210,22 @@ public class QueryServiceImpl implements QueryService {
|
||||||
} else if (uniCon.getUcCon().equals("LTE")) {
|
} else if (uniCon.getUcCon().equals("LTE")) {
|
||||||
sql += uniCon.getUcKey() + " <= '" + uniCon.getUcReal() + "' and ";
|
sql += uniCon.getUcKey() + " <= '" + uniCon.getUcReal() + "' and ";
|
||||||
} else if (uniCon.getUcCon().equals("LIKE")) {
|
} else if (uniCon.getUcCon().equals("LIKE")) {
|
||||||
sql += uniCon.getUcKey() + " like '%" + uniCon.getUcReal() + "%'";
|
sql += uniCon.getUcKey() + " like '%" + uniCon.getUcReal() + "%' and ";
|
||||||
} else if (uniCon.getUcCon().equals("BETWEEN")) {
|
} else if (uniCon.getUcCon().equals("BETWEEN")) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(uniCon.getUcReal());
|
|
||||||
if (uniCon.getUcType().equals("input")) {
|
if (uniCon.getUcType().equals("input")) {
|
||||||
|
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(uniCon.getUcReal());
|
||||||
Object begin = jsonObject.get("begin");
|
Object begin = jsonObject.get("begin");
|
||||||
Object end = jsonObject.get("end");
|
Object end = jsonObject.get("end");
|
||||||
sql += uniCon.getUcKey() + " between '" + begin + "' AND '" + end + "' and ";
|
sql += uniCon.getUcKey() + " between '" + begin + "' AND '" + end + "' and ";
|
||||||
} else if (uniCon.getUcType().equals("datetime")) {
|
} else if (uniCon.getUcType().equals("datetime")) {
|
||||||
Object startTime = jsonObject.get("startTime");
|
List<String> list = (ArrayList<String>) uniCon.getUcReal();
|
||||||
Object endTime = jsonObject.get("endTime");
|
if (list.size() == 2) {
|
||||||
sql += uniCon.getUcKey() + " between '" + startTime + "' AND '" + endTime + "' and ";
|
String startTime = list.get(0);
|
||||||
|
String endTime = list.get(1);
|
||||||
|
sql += uniCon.getUcKey() + " between '" + startTime + "' AND '" + endTime + "' and ";
|
||||||
|
} else {
|
||||||
|
sql = "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sql;
|
return sql;
|
||||||
|
|
@ -208,7 +251,7 @@ public class QueryServiceImpl implements QueryService {
|
||||||
} else if (uniCon.getUcCon().equals("LTE")) {
|
} else if (uniCon.getUcCon().equals("LTE")) {
|
||||||
sql += uniCon.getUcKey() + " <= '" + uniCon.getUcMock() + "' and ";
|
sql += uniCon.getUcKey() + " <= '" + uniCon.getUcMock() + "' and ";
|
||||||
} else if (uniCon.getUcCon().equals("LIKE")) {
|
} else if (uniCon.getUcCon().equals("LIKE")) {
|
||||||
sql += uniCon.getUcKey() + " like '%" + uniCon.getUcMock() + "%'";
|
sql += uniCon.getUcKey() + " like '%" + uniCon.getUcMock() + "%' and ";
|
||||||
} else if (uniCon.getUcCon().equals("BETWEEN")) {
|
} else if (uniCon.getUcCon().equals("BETWEEN")) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(uniCon.getUcMock());
|
JSONObject jsonObject = JSONObject.parseObject(uniCon.getUcMock());
|
||||||
if (uniCon.getUcType().equals("input")) {
|
if (uniCon.getUcType().equals("input")) {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
<result property="uqSql" column="uq_sql" />
|
<result property="uqSql" column="uq_sql" />
|
||||||
<result property="uqDescribe" column="uq_describe" />
|
<result property="uqDescribe" column="uq_describe" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="isRelease" column="is_release" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
|
|
@ -29,14 +30,58 @@
|
||||||
<select id="UniQuery" resultType="java.util.HashMap">
|
<select id="UniQuery" resultType="java.util.HashMap">
|
||||||
${paramSQL}
|
${paramSQL}
|
||||||
</select>
|
</select>
|
||||||
|
<delete id="deleteMenu">
|
||||||
|
delete from sys_menu where path = #{path}
|
||||||
|
</delete>
|
||||||
|
<insert id="insertMenu" parameterType="SysMenu">
|
||||||
|
insert into sys_menu(
|
||||||
|
<if test="menuId != null and menuId != 0">menu_id,</if>
|
||||||
|
<if test="parentId != null and parentId != 0">parent_id,</if>
|
||||||
|
<if test="menuName != null and menuName != ''">menu_name,</if>
|
||||||
|
<if test="orderNum != null and orderNum != ''">order_num,</if>
|
||||||
|
<if test="path != null and path != ''">path,</if>
|
||||||
|
<if test="component != null and component != ''">component,</if>
|
||||||
|
<if test="isFrame != null and isFrame != ''">is_frame,</if>
|
||||||
|
<if test="isCache != null and isCache != ''">is_cache,</if>
|
||||||
|
<if test="menuType != null and menuType != ''">menu_type,</if>
|
||||||
|
<if test="visible != null">visible,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="perms !=null and perms != ''">perms,</if>
|
||||||
|
<if test="icon != null and icon != ''">icon,</if>
|
||||||
|
<if test="remark != null and remark != ''">remark,</if>
|
||||||
|
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||||
|
create_time
|
||||||
|
)values(
|
||||||
|
<if test="menuId != null and menuId != 0">#{menuId},</if>
|
||||||
|
<if test="parentId != null and parentId != 0">#{parentId},</if>
|
||||||
|
<if test="menuName != null and menuName != ''">#{menuName},</if>
|
||||||
|
<if test="orderNum != null and orderNum != ''">#{orderNum},</if>
|
||||||
|
<if test="path != null and path != ''">#{path},</if>
|
||||||
|
<if test="component != null and component != ''">#{component},</if>
|
||||||
|
<if test="isFrame != null and isFrame != ''">#{isFrame},</if>
|
||||||
|
<if test="isCache != null and isCache != ''">#{isCache},</if>
|
||||||
|
<if test="menuType != null and menuType != ''">#{menuType},</if>
|
||||||
|
<if test="visible != null">#{visible},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="perms !=null and perms != ''">#{perms},</if>
|
||||||
|
<if test="icon != null and icon != ''">#{icon},</if>
|
||||||
|
<if test="remark != null and remark != ''">#{remark},</if>
|
||||||
|
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||||
|
sysdate()
|
||||||
|
)
|
||||||
|
</insert>
|
||||||
|
<select id="Release" resultType="Integer" parameterType="Long">
|
||||||
|
select is_release from gen_uni_query where id = #{id}
|
||||||
|
</select>
|
||||||
<select id="queryRealInfo" parameterType="Long" resultMap="UniConResult">
|
<select id="queryRealInfo" parameterType="Long" resultMap="UniConResult">
|
||||||
select * from gen_uni_con where uq_id = #{id}
|
select * from gen_uni_con where uq_id = #{id}
|
||||||
</select>
|
</select>
|
||||||
|
<update id="changeRelease" parameterType="com.hchyun.generator.entity.UniQuery">
|
||||||
|
update gen_uni_query set is_release = #{isRelease} where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
<select id="selectQueryInfo" parameterType="Long" resultMap="QueryResult">
|
<select id="selectQueryInfo" parameterType="Long" resultMap="QueryResult">
|
||||||
select uq.id, uq.uq_name, uq.uq_sql, uq.uq_describe, uq.create_by, uq.create_time, uq.update_by, uq.update_time,
|
select uq.id, uq.uq_name, uq.uq_sql, uq.uq_describe, uq.create_by, uq.is_release, uq.create_time, uq.update_by, uq.update_time,
|
||||||
uc.id as uc_id, uc.uq_id, uc.uc_name, uc.uc_key, uc.uc_con, uc.uc_mock, uc.uc_describe ,uc.uc_type,uc.type
|
uc.id as uc_id, uc.uq_id, uc.uc_name, uc.uc_key, uc.uc_con, uc.uc_mock, uc.uc_describe ,uc.uc_type,uc.type
|
||||||
from gen_uni_query uq
|
from gen_uni_query uq
|
||||||
left join gen_uni_con uc on uc.uq_id = uq.id
|
left join gen_uni_con uc on uc.uq_id = uq.id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue