Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dataease
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
zhu
dataease
Commits
3db9e411
提交
3db9e411
authored
7月 29, 2021
作者:
taojinlong
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' of github.com:dataease/dataease into dev
上级
42b8840a
46f56cc5
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
21 个修改的文件
包含
613 行增加
和
50 行删除
+613
-50
DatasetTableFunction.java
...in/java/io/dataease/base/domain/DatasetTableFunction.java
+22
-0
DatasetTableFunctionExample.java
.../io/dataease/base/domain/DatasetTableFunctionExample.java
+0
-0
DatasetTableFunctionMapper.java
...a/io/dataease/base/mapper/DatasetTableFunctionMapper.java
+37
-0
DatasetTableFunctionMapper.xml
...va/io/dataease/base/mapper/DatasetTableFunctionMapper.xml
+271
-0
ChartViewController.java
...ava/io/dataease/controller/chart/ChartViewController.java
+8
-1
DataSetTableFieldController.java
...aease/controller/dataset/DataSetTableFieldController.java
+10
-0
DatasetFunctionController.java
...ataease/controller/dataset/DatasetFunctionController.java
+27
-0
ChartViewService.java
...main/java/io/dataease/service/chart/ChartViewService.java
+0
-6
DataSetTableFieldsService.java
...o/dataease/service/dataset/DataSetTableFieldsService.java
+12
-0
DatasetFunctionService.java
...a/io/dataease/service/dataset/DatasetFunctionService.java
+54
-0
V18__area_mapping.sql
...end/src/main/resources/db/migration/V18__area_mapping.sql
+59
-0
V9__chart_view_copy.sql
...d/src/main/resources/db/migration/V9__chart_view_copy.sql
+1
-1
generatorConfig.xml
backend/src/main/resources/generatorConfig.xml
+1
-1
SettingMenu.vue
...d/src/components/canvas/components/Editor/SettingMenu.vue
+0
-1
en.js
frontend/src/lang/en.js
+3
-1
tw.js
frontend/src/lang/tw.js
+3
-1
zh.js
frontend/src/lang/zh.js
+3
-1
ChartEdit.vue
frontend/src/views/chart/view/ChartEdit.vue
+3
-1
CalcFieldEdit.vue
frontend/src/views/dataset/data/CalcFieldEdit.vue
+91
-34
FieldEdit.vue
frontend/src/views/dataset/data/FieldEdit.vue
+0
-0
ViewTable.vue
frontend/src/views/dataset/data/ViewTable.vue
+8
-2
没有找到文件。
backend/src/main/java/io/dataease/base/domain/DatasetTableFunction.java
0 → 100644
浏览文件 @
3db9e411
package
io
.
dataease
.
base
.
domain
;
import
java.io.Serializable
;
import
lombok.Data
;
@Data
public
class
DatasetTableFunction
implements
Serializable
{
private
Long
id
;
private
String
name
;
private
String
func
;
private
String
dbType
;
private
Integer
funcType
;
private
String
desc
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/domain/DatasetTableFunctionExample.java
0 → 100644
浏览文件 @
3db9e411
差异被折叠。
点击展开。
backend/src/main/java/io/dataease/base/mapper/DatasetTableFunctionMapper.java
0 → 100644
浏览文件 @
3db9e411
package
io
.
dataease
.
base
.
mapper
;
import
io.dataease.base.domain.DatasetTableFunction
;
import
io.dataease.base.domain.DatasetTableFunctionExample
;
import
java.util.List
;
import
org.apache.ibatis.annotations.Param
;
public
interface
DatasetTableFunctionMapper
{
long
countByExample
(
DatasetTableFunctionExample
example
);
int
deleteByExample
(
DatasetTableFunctionExample
example
);
int
deleteByPrimaryKey
(
Long
id
);
int
insert
(
DatasetTableFunction
record
);
int
insertSelective
(
DatasetTableFunction
record
);
List
<
DatasetTableFunction
>
selectByExampleWithBLOBs
(
DatasetTableFunctionExample
example
);
List
<
DatasetTableFunction
>
selectByExample
(
DatasetTableFunctionExample
example
);
DatasetTableFunction
selectByPrimaryKey
(
Long
id
);
int
updateByExampleSelective
(
@Param
(
"record"
)
DatasetTableFunction
record
,
@Param
(
"example"
)
DatasetTableFunctionExample
example
);
int
updateByExampleWithBLOBs
(
@Param
(
"record"
)
DatasetTableFunction
record
,
@Param
(
"example"
)
DatasetTableFunctionExample
example
);
int
updateByExample
(
@Param
(
"record"
)
DatasetTableFunction
record
,
@Param
(
"example"
)
DatasetTableFunctionExample
example
);
int
updateByPrimaryKeySelective
(
DatasetTableFunction
record
);
int
updateByPrimaryKeyWithBLOBs
(
DatasetTableFunction
record
);
int
updateByPrimaryKey
(
DatasetTableFunction
record
);
}
\ No newline at end of file
backend/src/main/java/io/dataease/base/mapper/DatasetTableFunctionMapper.xml
0 → 100644
浏览文件 @
3db9e411
<?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=
"io.dataease.base.mapper.DatasetTableFunctionMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"io.dataease.base.domain.DatasetTableFunction"
>
<id
column=
"id"
jdbcType=
"BIGINT"
property=
"id"
/>
<result
column=
"name"
jdbcType=
"VARCHAR"
property=
"name"
/>
<result
column=
"func"
jdbcType=
"VARCHAR"
property=
"func"
/>
<result
column=
"db_type"
jdbcType=
"VARCHAR"
property=
"dbType"
/>
<result
column=
"func_type"
jdbcType=
"INTEGER"
property=
"funcType"
/>
</resultMap>
<resultMap
extends=
"BaseResultMap"
id=
"ResultMapWithBLOBs"
type=
"io.dataease.base.domain.DatasetTableFunction"
>
<result
column=
"desc"
jdbcType=
"LONGVARCHAR"
property=
"desc"
/>
</resultMap>
<sql
id=
"Example_Where_Clause"
>
<where>
<foreach
collection=
"oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Update_By_Example_Where_Clause"
>
<where>
<foreach
collection=
"example.oredCriteria"
item=
"criteria"
separator=
"or"
>
<if
test=
"criteria.valid"
>
<trim
prefix=
"("
prefixOverrides=
"and"
suffix=
")"
>
<foreach
collection=
"criteria.criteria"
item=
"criterion"
>
<choose>
<when
test=
"criterion.noValue"
>
and ${criterion.condition}
</when>
<when
test=
"criterion.singleValue"
>
and ${criterion.condition} #{criterion.value}
</when>
<when
test=
"criterion.betweenValue"
>
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when
test=
"criterion.listValue"
>
and ${criterion.condition}
<foreach
close=
")"
collection=
"criterion.value"
item=
"listItem"
open=
"("
separator=
","
>
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql
id=
"Base_Column_List"
>
id, `name`, func, db_type, func_type
</sql>
<sql
id=
"Blob_Column_List"
>
`desc`
</sql>
<select
id=
"selectByExampleWithBLOBs"
parameterType=
"io.dataease.base.domain.DatasetTableFunctionExample"
resultMap=
"ResultMapWithBLOBs"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
,
<include
refid=
"Blob_Column_List"
/>
from dataset_table_function
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByExample"
parameterType=
"io.dataease.base.domain.DatasetTableFunctionExample"
resultMap=
"BaseResultMap"
>
select
<if
test=
"distinct"
>
distinct
</if>
<include
refid=
"Base_Column_List"
/>
from dataset_table_function
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
<if
test=
"orderByClause != null"
>
order by ${orderByClause}
</if>
</select>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Long"
resultMap=
"ResultMapWithBLOBs"
>
select
<include
refid=
"Base_Column_List"
/>
,
<include
refid=
"Blob_Column_List"
/>
from dataset_table_function
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Long"
>
delete from dataset_table_function
where id = #{id,jdbcType=BIGINT}
</delete>
<delete
id=
"deleteByExample"
parameterType=
"io.dataease.base.domain.DatasetTableFunctionExample"
>
delete from dataset_table_function
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</delete>
<insert
id=
"insert"
parameterType=
"io.dataease.base.domain.DatasetTableFunction"
>
insert into dataset_table_function (id, `name`, func,
db_type, func_type, `desc`
)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{func,jdbcType=VARCHAR},
#{dbType,jdbcType=VARCHAR}, #{funcType,jdbcType=INTEGER}, #{desc,jdbcType=LONGVARCHAR}
)
</insert>
<insert
id=
"insertSelective"
parameterType=
"io.dataease.base.domain.DatasetTableFunction"
>
insert into dataset_table_function
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"name != null"
>
`name`,
</if>
<if
test=
"func != null"
>
func,
</if>
<if
test=
"dbType != null"
>
db_type,
</if>
<if
test=
"funcType != null"
>
func_type,
</if>
<if
test=
"desc != null"
>
`desc`,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=BIGINT},
</if>
<if
test=
"name != null"
>
#{name,jdbcType=VARCHAR},
</if>
<if
test=
"func != null"
>
#{func,jdbcType=VARCHAR},
</if>
<if
test=
"dbType != null"
>
#{dbType,jdbcType=VARCHAR},
</if>
<if
test=
"funcType != null"
>
#{funcType,jdbcType=INTEGER},
</if>
<if
test=
"desc != null"
>
#{desc,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select
id=
"countByExample"
parameterType=
"io.dataease.base.domain.DatasetTableFunctionExample"
resultType=
"java.lang.Long"
>
select count(*) from dataset_table_function
<if
test=
"_parameter != null"
>
<include
refid=
"Example_Where_Clause"
/>
</if>
</select>
<update
id=
"updateByExampleSelective"
parameterType=
"map"
>
update dataset_table_function
<set>
<if
test=
"record.id != null"
>
id = #{record.id,jdbcType=BIGINT},
</if>
<if
test=
"record.name != null"
>
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if
test=
"record.func != null"
>
func = #{record.func,jdbcType=VARCHAR},
</if>
<if
test=
"record.dbType != null"
>
db_type = #{record.dbType,jdbcType=VARCHAR},
</if>
<if
test=
"record.funcType != null"
>
func_type = #{record.funcType,jdbcType=INTEGER},
</if>
<if
test=
"record.desc != null"
>
`desc` = #{record.desc,jdbcType=LONGVARCHAR},
</if>
</set>
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExampleWithBLOBs"
parameterType=
"map"
>
update dataset_table_function
set id = #{record.id,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
func = #{record.func,jdbcType=VARCHAR},
db_type = #{record.dbType,jdbcType=VARCHAR},
func_type = #{record.funcType,jdbcType=INTEGER},
`desc` = #{record.desc,jdbcType=LONGVARCHAR}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByExample"
parameterType=
"map"
>
update dataset_table_function
set id = #{record.id,jdbcType=BIGINT},
`name` = #{record.name,jdbcType=VARCHAR},
func = #{record.func,jdbcType=VARCHAR},
db_type = #{record.dbType,jdbcType=VARCHAR},
func_type = #{record.funcType,jdbcType=INTEGER}
<if
test=
"_parameter != null"
>
<include
refid=
"Update_By_Example_Where_Clause"
/>
</if>
</update>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"io.dataease.base.domain.DatasetTableFunction"
>
update dataset_table_function
<set>
<if
test=
"name != null"
>
`name` = #{name,jdbcType=VARCHAR},
</if>
<if
test=
"func != null"
>
func = #{func,jdbcType=VARCHAR},
</if>
<if
test=
"dbType != null"
>
db_type = #{dbType,jdbcType=VARCHAR},
</if>
<if
test=
"funcType != null"
>
func_type = #{funcType,jdbcType=INTEGER},
</if>
<if
test=
"desc != null"
>
`desc` = #{desc,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKeyWithBLOBs"
parameterType=
"io.dataease.base.domain.DatasetTableFunction"
>
update dataset_table_function
set `name` = #{name,jdbcType=VARCHAR},
func = #{func,jdbcType=VARCHAR},
db_type = #{dbType,jdbcType=VARCHAR},
func_type = #{funcType,jdbcType=INTEGER},
`desc` = #{desc,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"io.dataease.base.domain.DatasetTableFunction"
>
update dataset_table_function
set `name` = #{name,jdbcType=VARCHAR},
func = #{func,jdbcType=VARCHAR},
db_type = #{dbType,jdbcType=VARCHAR},
func_type = #{funcType,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
backend/src/main/java/io/dataease/controller/chart/ChartViewController.java
浏览文件 @
3db9e411
package
io
.
dataease
.
controller
.
chart
;
import
io.dataease.base.domain.ChartViewWithBLOBs
;
import
io.dataease.commons.utils.AuthUtils
;
import
io.dataease.controller.request.chart.ChartExtRequest
;
import
io.dataease.controller.request.chart.ChartViewRequest
;
import
io.dataease.dto.chart.ChartViewDTO
;
...
...
@@ -68,6 +69,12 @@ public class ChartViewController {
@PostMapping
(
"/getOneWithPermission/{id}"
)
public
ChartViewDTO
getOneWithPermission
(
@PathVariable
String
id
,
@RequestBody
ChartExtRequest
requestList
)
throws
Exception
{
return
chartViewService
.
getData
(
id
,
requestList
);
//如果能获取用户 则添加对应的权限
ChartViewDTO
dto
=
chartViewService
.
getData
(
id
,
requestList
);
if
(
dto
!=
null
&&
AuthUtils
.
getUser
()!=
null
){
ChartViewDTO
permissionDto
=
chartViewService
.
getOneWithPermission
(
dto
.
getId
());
dto
.
setPrivileges
(
permissionDto
.
getPrivileges
());
}
return
dto
;
}
}
backend/src/main/java/io/dataease/controller/dataset/DataSetTableFieldController.java
浏览文件 @
3db9e411
...
...
@@ -51,6 +51,16 @@ public class DataSetTableFieldController {
dataSetTableFieldsService
.
batchEdit
(
list
);
}
@PostMapping
(
"save"
)
public
DatasetTableField
save
(
@RequestBody
DatasetTableField
datasetTableField
)
{
return
dataSetTableFieldsService
.
save
(
datasetTableField
);
}
@PostMapping
(
"delete/{id}"
)
public
void
delete
(
@PathVariable
String
id
)
{
dataSetTableFieldsService
.
delete
(
id
);
}
@PostMapping
(
"fieldValues/{fieldId}"
)
public
List
<
Object
>
fieldValues
(
@PathVariable
String
fieldId
)
{
return
dataSetFieldService
.
fieldValues
(
fieldId
);
...
...
backend/src/main/java/io/dataease/controller/dataset/DatasetFunctionController.java
0 → 100644
浏览文件 @
3db9e411
package
io
.
dataease
.
controller
.
dataset
;
import
io.dataease.base.domain.DatasetTableFunction
;
import
io.dataease.service.dataset.DatasetFunctionService
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* @Author gin
* @Date 2021/7/29 11:58 上午
*/
@RestController
@RequestMapping
(
"dataset/function"
)
public
class
DatasetFunctionController
{
@Resource
private
DatasetFunctionService
datasetFunctionService
;
@PostMapping
(
"listByTableId/{tableId}"
)
public
List
<
DatasetTableFunction
>
listByTableId
(
@PathVariable
String
tableId
)
{
return
datasetFunctionService
.
listByTableId
(
tableId
);
}
}
backend/src/main/java/io/dataease/service/chart/ChartViewService.java
浏览文件 @
3db9e411
...
...
@@ -315,12 +315,6 @@ public class ChartViewService {
BeanUtils
.
copyBean
(
dto
,
view
);
dto
.
setData
(
map
);
dto
.
setSql
(
datasourceRequest
.
getQuery
());
//如果能获取用户 则添加对应的权限
if
(
AuthUtils
.
getUser
()!=
null
){
ChartViewDTO
permissionDto
=
getOneWithPermission
(
dto
.
getId
());
dto
.
setPrivileges
(
permissionDto
.
getPrivileges
());
}
return
dto
;
}
...
...
backend/src/main/java/io/dataease/service/dataset/DataSetTableFieldsService.java
浏览文件 @
3db9e411
...
...
@@ -3,6 +3,7 @@ package io.dataease.service.dataset;
import
io.dataease.base.domain.DatasetTableField
;
import
io.dataease.base.domain.DatasetTableFieldExample
;
import
io.dataease.base.mapper.DatasetTableFieldMapper
;
import
io.dataease.commons.utils.DorisTableUtils
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -32,6 +33,13 @@ public class DataSetTableFieldsService {
public
DatasetTableField
save
(
DatasetTableField
datasetTableField
)
{
if
(
StringUtils
.
isEmpty
(
datasetTableField
.
getId
()))
{
datasetTableField
.
setId
(
UUID
.
randomUUID
().
toString
());
// 若dataeasename为空,则用MD5(id)作为dataeasename
if
(
StringUtils
.
isEmpty
(
datasetTableField
.
getDataeaseName
()))
{
datasetTableField
.
setDataeaseName
(
DorisTableUtils
.
dorisFieldName
(
datasetTableField
.
getId
()));
}
if
(
ObjectUtils
.
isEmpty
(
datasetTableField
.
getLastSyncTime
()))
{
datasetTableField
.
setLastSyncTime
(
System
.
currentTimeMillis
());
}
datasetTableFieldMapper
.
insert
(
datasetTableField
);
}
else
{
datasetTableFieldMapper
.
updateByPrimaryKeySelective
(
datasetTableField
);
...
...
@@ -86,4 +94,8 @@ public class DataSetTableFieldsService {
public
DatasetTableField
get
(
String
id
)
{
return
datasetTableFieldMapper
.
selectByPrimaryKey
(
id
);
}
public
void
delete
(
String
id
)
{
datasetTableFieldMapper
.
deleteByPrimaryKey
(
id
);
}
}
backend/src/main/java/io/dataease/service/dataset/DatasetFunctionService.java
0 → 100644
浏览文件 @
3db9e411
package
io
.
dataease
.
service
.
dataset
;
import
io.dataease.base.domain.*
;
import
io.dataease.base.mapper.DatasetTableFunctionMapper
;
import
io.dataease.commons.utils.DorisTableUtils
;
import
io.dataease.datasource.service.DatasourceService
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.util.UUID
;
/**
* @Author gin
* @Date 2021/7/29 11:58 上午
*/
@Service
public
class
DatasetFunctionService
{
@Resource
private
DatasetTableFunctionMapper
datasetTableFunctionMapper
;
@Resource
private
DataSetTableService
dataSetTableService
;
@Resource
private
DatasourceService
datasourceService
;
public
DatasetTableFunction
get
(
Long
id
)
{
return
datasetTableFunctionMapper
.
selectByPrimaryKey
(
id
);
}
public
List
<
DatasetTableFunction
>
list
(
DatasetTableFunction
datasetTableFunction
)
{
DatasetTableFunctionExample
datasetTableFunctionExample
=
new
DatasetTableFunctionExample
();
DatasetTableFunctionExample
.
Criteria
criteria
=
datasetTableFunctionExample
.
createCriteria
();
if
(
StringUtils
.
isNotEmpty
(
datasetTableFunction
.
getDbType
()))
{
criteria
.
andDbTypeEqualTo
(
datasetTableFunction
.
getDbType
());
}
return
datasetTableFunctionMapper
.
selectByExampleWithBLOBs
(
datasetTableFunctionExample
);
}
public
List
<
DatasetTableFunction
>
listByTableId
(
String
id
)
{
DatasetTable
datasetTable
=
dataSetTableService
.
get
(
id
);
String
dbType
;
if
(
datasetTable
.
getMode
()
==
0
)
{
Datasource
datasource
=
datasourceService
.
get
(
datasetTable
.
getDataSourceId
());
dbType
=
datasource
.
getType
();
}
else
{
dbType
=
"doris"
;
}
DatasetTableFunction
datasetTableFunction
=
new
DatasetTableFunction
();
datasetTableFunction
.
setDbType
(
dbType
);
return
list
(
datasetTableFunction
);
}
}
backend/src/main/resources/db/migration/V18__area_mapping.sql
浏览文件 @
3db9e411
...
...
@@ -2939,3 +2939,62 @@ INSERT INTO `area_mapping` VALUES (2897, '澳门特别行政区', '156820000', '
COMMIT
;
SET
FOREIGN_KEY_CHECKS
=
1
;
ALTER
TABLE
`dataset_table_field`
MODIFY
COLUMN
`origin_name`
LONGTEXT
;
/*
Navicat Premium Data Transfer
Source Server : local
Source Server Type : MySQL
Source Server Version : 50730
Source Host : 127.0.0.1:3306
Source Schema : dataease
Target Server Type : MySQL
Target Server Version : 50730
File Encoding : 65001
Date: 29/07/2021 11:55:10
*/
SET
NAMES
utf8mb4
;
SET
FOREIGN_KEY_CHECKS
=
0
;
-- ----------------------------
-- Table structure for dataset_table_function
-- ----------------------------
DROP
TABLE
IF
EXISTS
`dataset_table_function`
;
CREATE
TABLE
`dataset_table_function`
(
`id`
bigint
(
20
)
NOT
NULL
COMMENT
'ID'
,
`name`
varchar
(
255
)
COLLATE
utf8mb4_bin
DEFAULT
NULL
COMMENT
'函数名称'
,
`func`
varchar
(
500
)
COLLATE
utf8mb4_bin
DEFAULT
NULL
COMMENT
'函数表达式'
,
`db_type`
varchar
(
255
)
COLLATE
utf8mb4_bin
DEFAULT
NULL
COMMENT
'所属数据库'
,
`func_type`
int
(
10
)
DEFAULT
NULL
COMMENT
'函数类型:0-聚合函数;1-快速计算函数;2-数学和三角函数;3-日期函数;4-文本函数;5-逻辑函数;6-其它函数'
,
`desc`
longtext
COLLATE
utf8mb4_bin
COMMENT
'描述'
,
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
COLLATE
=
utf8mb4_bin
;
-- ----------------------------
-- Records of dataset_table_function
-- ----------------------------
BEGIN
;
INSERT
INTO
`dataset_table_function`
VALUES
(
1
,
'ABS'
,
'ABS(x)'
,
'mysql'
,
2
,
'返回x的绝对值'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
2
,
'PI'
,
'PI()'
,
'mysql'
,
2
,
'返回圆周率π,默认显示6位小数'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
3
,
'CHAR_LENGTH'
,
'CHAR_LENGTH(str)'
,
'mysql'
,
4
,
'计算字符串字符个数'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
4
,
'TRIM'
,
'TRIM(s)'
,
'mysql'
,
4
,
'返回字符串s删除了两边空格之后的字符串'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
5
,
'REPLACE'
,
'REPLACE(s,s1,s2)'
,
'mysql'
,
4
,
'返回一个字符串,用字符串s2替代字符串s中所有的字符串s1'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
6
,
'SUBSTRING'
,
'SUBSTRING(s,n,len)'
,
'mysql'
,
4
,
'获取从字符串s中的第n个位置开始长度为len的字符串'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
7
,
'IF'
,
'IF(expr,v1,v2)'
,
'mysql'
,
5
,
'如果expr是TRUE则返回v1,否则返回v2'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
8
,
'IFNULL'
,
'IFNULL(v1,v2)'
,
'mysql'
,
5
,
'如果v1不为NULL,则返回v1,否则返回v2'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
9
,
'FLOOR'
,
'FLOOR(x)'
,
'mysql'
,
2
,
'返回不大于x的最大整数'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
10
,
'ROUND'
,
'ROUND(x)'
,
'mysql'
,
2
,
'返回离x最近的整数'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
11
,
'ROUND'
,
'ROUND(x,y)'
,
'mysql'
,
2
,
'保留x小数点后y位的值,但截断时要进行四舍五入'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
12
,
'ABS'
,
'ABS(x)'
,
'doris'
,
2
,
'返回x的绝对值'
);
INSERT
INTO
`dataset_table_function`
VALUES
(
13
,
'SUBSTR'
,
'SUBSTR(char, position, substring_length)'
,
'oracle'
,
4
,
'获取从字符串char中的第position个位置开始长度为substring_lenght的字符串'
);
COMMIT
;
SET
FOREIGN_KEY_CHECKS
=
1
;
backend/src/main/resources/db/migration/V9__chart_view_copy.sql
浏览文件 @
3db9e411
DROP
FUNCTION
IF
EXISTS
`GET_CHART_VIEW_COPY_NAME`
;
delimiter
;;
CREATE
DEFINER
=
`root`
@
`%`
FUNCTION
`GET_CHART_VIEW_COPY_NAME`
(
chartId
varchar
(
255
))
RETURNS
varchar
(
255
)
CHARSET
utf8
CREATE
FUNCTION
`GET_CHART_VIEW_COPY_NAME`
(
chartId
varchar
(
255
))
RETURNS
varchar
(
255
)
CHARSET
utf8
READS
SQL
DATA
BEGIN
...
...
backend/src/main/resources/generatorConfig.xml
浏览文件 @
3db9e411
...
...
@@ -64,7 +64,7 @@
<!--要生成的数据库表 -->
<table
tableName=
"
chart_view
"
/>
<table
tableName=
"
dataset_table_function
"
/>
<!-- <table tableName="sys_dict"/>-->
<!-- <table tableName="sys_dict_item"/>-->
<!-- <table tableName="dataset_table_field"/>-->
...
...
frontend/src/components/canvas/components/Editor/SettingMenu.vue
浏览文件 @
3db9e411
...
...
@@ -4,7 +4,6 @@
<el-dropdown
trigger=
"click"
@
mouseup=
"handleMouseUp"
>
<slot
name=
"icon"
/>
<el-dropdown-menu>
this is test
<el-dropdown-item
v-if=
"curComponent&&editFilter.includes(curComponent.type)"
icon=
"el-icon-edit-outline"
@
click
.
native=
"edit"
>
{{
$t
(
'panel.edit'
)
}}
</el-dropdown-item>
<el-dropdown-item
icon=
"el-icon-document-copy"
@
click
.
native=
"copy"
>
{{
$t
(
'panel.copy'
)
}}
</el-dropdown-item>
<el-dropdown-item
icon=
"el-icon-delete"
@
click
.
native=
"deleteComponent"
>
{{
$t
(
'panel.delete'
)
}}
</el-dropdown-item>
...
...
frontend/src/lang/en.js
浏览文件 @
3db9e411
...
...
@@ -986,7 +986,9 @@ export default {
data_type
:
'Data Type'
,
click_ref_field
:
'Click Quote Field'
,
click_ref_function
:
'Click Quote Function'
,
field_manage
:
'Field Manage'
field_manage
:
'Field Manage'
,
edit_calc_field
:
'Edit calc field'
,
calc_field
:
'Calc Field'
},
datasource
:
{
datasource
:
'Data Source'
,
...
...
frontend/src/lang/tw.js
浏览文件 @
3db9e411
...
...
@@ -986,7 +986,9 @@ export default {
data_type
:
'數據類型'
,
click_ref_field
:
'點擊引用字段'
,
click_ref_function
:
'點擊引用函數'
,
field_manage
:
'字段管理'
field_manage
:
'字段管理'
,
edit_calc_field
:
'編輯計算字段'
,
calc_field
:
'計算字段'
},
datasource
:
{
datasource
:
'數據源'
,
...
...
frontend/src/lang/zh.js
浏览文件 @
3db9e411
...
...
@@ -986,7 +986,9 @@ export default {
data_type
:
'数据类型'
,
click_ref_field
:
'点击引用字段'
,
click_ref_function
:
'点击引用函数'
,
field_manage
:
'字段管理'
field_manage
:
'字段管理'
,
edit_calc_field
:
'编辑计算字段'
,
calc_field
:
'计算字段'
},
datasource
:
{
datasource
:
'数据源'
,
...
...
frontend/src/views/chart/view/ChartEdit.vue
浏览文件 @
3db9e411
...
...
@@ -908,7 +908,9 @@ export default {
this
.
data
=
response
.
data
.
data
// console.log(JSON.stringify(this.chart))
this
.
httpRequest
.
status
=
true
this
.
param
.
privileges
=
this
.
chart
.
privileges
if
(
this
.
chart
.
privileges
)
{
this
.
param
.
privileges
=
this
.
chart
.
privileges
}
}).
catch
(
err
=>
{
this
.
resetView
()
this
.
httpRequest
.
status
=
err
.
response
.
data
.
success
...
...
frontend/src/views/dataset/data/CalcFieldEdit.vue
浏览文件 @
3db9e411
...
...
@@ -14,7 +14,7 @@
<span>
{{
$t
(
'dataset.field_exp'
)
}}
</span>
<codemirror
ref=
"myCm"
v-model=
"field
Exp
"
v-model=
"field
Form.originName
"
class=
"codemirror"
:options=
"cmOption"
@
ready=
"onCmReady"
...
...
@@ -67,7 +67,7 @@
:disabled="true"
>
<transition-group>
<span
v-for=
"item in tableFields.dimensionList
"
:key=
"item.id"
class=
"item-dimension"
:title=
"item.name"
@
click=
"insertParamToCodeMirror(item.id
)"
>
<span
v-for=
"item in tableFields.dimensionList
.filter(ele => ele.extField === 0)"
:key=
"item.id"
class=
"item-dimension"
:title=
"item.name"
@
click=
"insertParamToCodeMirror('['+item.id+']'
)"
>
<svg-icon
v-if=
"item.deType === 0"
icon-class=
"field_text"
class=
"field-icon-text"
/>
<svg-icon
v-if=
"item.deType === 1"
icon-class=
"field_time"
class=
"field-icon-time"
/>
<svg-icon
v-if=
"item.deType === 2 || item.deType === 3"
icon-class=
"field_value"
class=
"field-icon-value"
/>
...
...
@@ -87,7 +87,7 @@
:disabled="true"
>
<transition-group>
<span
v-for=
"item in tableFields.quotaList
"
:key=
"item.id"
class=
"item-quota"
:title=
"item.name"
@
click=
"insertParamToCodeMirror(item.id
)"
>
<span
v-for=
"item in tableFields.quotaList
.filter(ele => ele.extField === 0)"
:key=
"item.id"
class=
"item-quota"
:title=
"item.name"
@
click=
"insertParamToCodeMirror('['+item.id+']'
)"
>
<svg-icon
v-if=
"item.deType === 0"
icon-class=
"field_text"
class=
"field-icon-text"
/>
<svg-icon
v-if=
"item.deType === 1"
icon-class=
"field_time"
class=
"field-icon-time"
/>
<svg-icon
v-if=
"item.deType === 2 || item.deType === 3"
icon-class=
"field_value"
class=
"field-icon-value"
/>
...
...
@@ -101,11 +101,31 @@
<el-col
:span=
"12"
style=
"height: 100%"
>
<span>
{{
$t
(
'dataset.click_ref_function'
)
}}
</span>
<el-row
class=
"padding-lr function-height"
>
<span
v-for=
"(item,index) in functions"
:key=
"index"
class=
"function-style"
@
click=
"insertParamToCodeMirror(item.name)"
>
{{
item
.
name
}}
</span>
<el-popover
v-for=
"(item,index) in functions"
:key=
"index"
class=
"function-pop"
placement=
"right"
width=
"200"
trigger=
"hover"
:open-delay=
"500"
>
<p
class=
"pop-title"
>
{{
item
.
name
}}
</p>
<p
class=
"pop-info"
>
{{
item
.
func
}}
</p>
<p
class=
"pop-info"
>
{{
item
.
desc
}}
</p>
<span
slot=
"reference"
class=
"function-style"
:title=
"item.func"
@
click=
"insertParamToCodeMirror(item.func)"
>
{{
item
.
func
}}
</span>
</el-popover>
</el-row>
</el-col>
</el-col>
</el-row>
<el-row>
<div
class=
"dialog-button"
>
<el-button
size=
"mini"
@
click=
"closeCalcField"
>
{{
$t
(
'dataset.cancel'
)
}}
</el-button>
<el-button
:disabled=
"!fieldForm.name || !fieldForm.originName"
type=
"primary"
size=
"mini"
@
click=
"saveCalcField"
>
{{
$t
(
'dataset.confirm'
)
}}
</el-button>
</div>
</el-row>
</el-row>
</
template
>
...
...
@@ -134,6 +154,7 @@ import 'codemirror/keymap/emacs.js'
import
'codemirror/addon/hint/show-hint.css'
import
'codemirror/addon/hint/sql-hint'
import
'codemirror/addon/hint/show-hint'
import
{
post
}
from
'../../../api/dataset/dataset'
export
default
{
name
:
'CalcFieldEdit'
,
...
...
@@ -146,16 +167,26 @@ export default {
tableFields
:
{
type
:
Object
,
required
:
true
},
field
:
{
type
:
Object
,
required
:
true
}
},
data
()
{
return
{
fieldForm
:
{
id
:
null
,
name
:
''
,
groupType
:
'd'
,
deType
:
0
deType
:
0
,
originName
:
''
,
tableId
:
this
.
param
.
id
,
checked
:
1
,
columnIndex
:
this
.
tableFields
.
dimensionList
.
length
+
this
.
tableFields
.
quotaList
.
length
,
size
:
0
,
extField
:
2
},
fieldExp
:
''
,
cmOption
:
{
tabSize
:
2
,
styleActiveLine
:
true
,
...
...
@@ -174,33 +205,7 @@ export default {
{
label
:
this
.
$t
(
'dataset.value'
)
+
'('
+
this
.
$t
(
'dataset.float'
)
+
')'
,
value
:
3
},
{
label
:
this
.
$t
(
'dataset.location'
),
value
:
5
}
],
functions
:
[
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
},
{
name
:
'ABS(n)'
}
]
functions
:
[]
}
},
computed
:
{
...
...
@@ -208,10 +213,23 @@ export default {
return
this
.
$refs
.
myCm
.
codemirror
}
},
watch
:
{
'param'
:
function
()
{
this
.
initFunctions
()
},
'field'
:
function
()
{
if
(
this
.
field
.
id
)
{
this
.
fieldForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
field
))
}
else
{
this
.
fieldForm
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
fieldForm
))
}
}
},
mounted
()
{
this
.
$refs
.
myCm
.
codemirror
.
on
(
'keypress'
,
()
=>
{
this
.
$refs
.
myCm
.
codemirror
.
showHint
()
})
this
.
initFunctions
()
},
methods
:
{
onCmReady
(
cm
)
{
...
...
@@ -222,7 +240,7 @@ export default {
},
onCmCodeChange
(
newCode
)
{
// console.log(newCode)
this
.
field
Exp
=
newCode
this
.
field
Form
.
originName
=
newCode
},
insertParamToCodeMirror
(
param
)
{
const
pos1
=
this
.
$refs
.
myCm
.
codemirror
.
getCursor
()
...
...
@@ -230,6 +248,26 @@ export default {
pos2
.
line
=
pos1
.
line
pos2
.
ch
=
pos1
.
ch
this
.
$refs
.
myCm
.
codemirror
.
replaceRange
(
param
,
pos2
)
},
initFunctions
()
{
post
(
'/dataset/function/listByTableId/'
+
this
.
param
.
id
,
null
).
then
(
response
=>
{
this
.
functions
=
response
.
data
})
},
closeCalcField
()
{
this
.
$emit
(
'onEditClose'
,
{})
},
saveCalcField
()
{
if
(
!
this
.
fieldForm
.
id
)
{
this
.
fieldForm
.
type
=
this
.
fieldForm
.
deType
this
.
fieldForm
.
deExtractType
=
this
.
fieldForm
.
deType
}
post
(
'/dataset/field/save'
,
this
.
fieldForm
).
then
(
response
=>
{
this
.
closeCalcField
()
})
}
}
}
...
...
@@ -329,9 +367,28 @@ export default {
padding
:
2px
4px
;
cursor
:
pointer
;
margin
:
4px
0
;
overflow-x
:
hidden
;
white-space
:
nowrap
;
text-overflow
:
ellipsis
;
}
.function-height
{
height
:
calc
(
100%
-
20px
);
overflow
:
auto
;
}
.function-pop
>>>
.el-popover
{
padding
:
6px
!important
;
}
.pop-title
{
margin
:
6px
0
0
0
;
font-size
:
14px
;
font-weight
:
500
;
}
.pop-info
{
margin
:
6px
0
0
0
;
font-size
:
10px
;
}
.dialog-button
{
float
:
right
;
margin-top
:
10px
;
}
</
style
>
frontend/src/views/dataset/data/FieldEdit.vue
浏览文件 @
3db9e411
差异被折叠。
点击展开。
frontend/src/views/dataset/data/ViewTable.vue
浏览文件 @
3db9e411
...
...
@@ -44,7 +44,7 @@
</el-row>
<el-divider
/>
<el-tabs
v-model=
"tabActive"
@
tab-click=
"
initTable(param.id)
"
>
<el-tabs
v-model=
"tabActive"
@
tab-click=
"
tabClick
"
>
<el-tab-pane
:label=
"$t('dataset.data_preview')"
name=
"dataPreview"
>
<tab-data-preview
:param=
"param"
:table=
"table"
:fields=
"fields"
:data=
"data"
:page=
"page"
:form=
"tableViewRowForm"
@
reSearch=
"reSearch"
/>
</el-tab-pane>
...
...
@@ -62,7 +62,7 @@
</
template
>
<
script
>
import
{
getTable
,
post
}
from
'@/api/dataset/dataset'
import
{
post
}
from
'@/api/dataset/dataset'
import
TabDataPreview
from
'./TabDataPreview'
import
UpdateInfo
from
'./UpdateInfo'
import
DatasetChartDetail
from
'../common/DatasetChartDetail'
...
...
@@ -207,6 +207,12 @@ export default {
pageSize
:
100
,
show
:
1000
}
},
tabClick
()
{
if
(
this
.
tabActive
===
'dataPreview'
)
{
this
.
initTable
(
this
.
param
.
id
)
}
}
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论