mirror of
https://github.com/dataease/dataease.git
synced 2026-05-22 13:30:19 +08:00
Merge pull request #411 from dataease/pr@dev@feat_数据集字段管理支持公式函数等运算(UI与CRUD)
fix: 数据集切换页面权限问题
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,530 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DatasetTableFunctionExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public DatasetTableFunctionExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(Long value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(Long value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(Long value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(Long value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(Long value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<Long> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<Long> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(Long value1, Long value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(Long value1, Long value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNull() {
|
||||
addCriterion("`name` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNotNull() {
|
||||
addCriterion("`name` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameEqualTo(String value) {
|
||||
addCriterion("`name` =", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotEqualTo(String value) {
|
||||
addCriterion("`name` <>", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThan(String value) {
|
||||
addCriterion("`name` >", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`name` >=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThan(String value) {
|
||||
addCriterion("`name` <", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("`name` <=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLike(String value) {
|
||||
addCriterion("`name` like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotLike(String value) {
|
||||
addCriterion("`name` not like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIn(List<String> values) {
|
||||
addCriterion("`name` in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotIn(List<String> values) {
|
||||
addCriterion("`name` not in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameBetween(String value1, String value2) {
|
||||
addCriterion("`name` between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotBetween(String value1, String value2) {
|
||||
addCriterion("`name` not between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncIsNull() {
|
||||
addCriterion("func is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncIsNotNull() {
|
||||
addCriterion("func is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncEqualTo(String value) {
|
||||
addCriterion("func =", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncNotEqualTo(String value) {
|
||||
addCriterion("func <>", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncGreaterThan(String value) {
|
||||
addCriterion("func >", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("func >=", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncLessThan(String value) {
|
||||
addCriterion("func <", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncLessThanOrEqualTo(String value) {
|
||||
addCriterion("func <=", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncLike(String value) {
|
||||
addCriterion("func like", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncNotLike(String value) {
|
||||
addCriterion("func not like", value, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncIn(List<String> values) {
|
||||
addCriterion("func in", values, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncNotIn(List<String> values) {
|
||||
addCriterion("func not in", values, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncBetween(String value1, String value2) {
|
||||
addCriterion("func between", value1, value2, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncNotBetween(String value1, String value2) {
|
||||
addCriterion("func not between", value1, value2, "func");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeIsNull() {
|
||||
addCriterion("db_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeIsNotNull() {
|
||||
addCriterion("db_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeEqualTo(String value) {
|
||||
addCriterion("db_type =", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeNotEqualTo(String value) {
|
||||
addCriterion("db_type <>", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeGreaterThan(String value) {
|
||||
addCriterion("db_type >", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("db_type >=", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeLessThan(String value) {
|
||||
addCriterion("db_type <", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("db_type <=", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeLike(String value) {
|
||||
addCriterion("db_type like", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeNotLike(String value) {
|
||||
addCriterion("db_type not like", value, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeIn(List<String> values) {
|
||||
addCriterion("db_type in", values, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeNotIn(List<String> values) {
|
||||
addCriterion("db_type not in", values, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeBetween(String value1, String value2) {
|
||||
addCriterion("db_type between", value1, value2, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDbTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("db_type not between", value1, value2, "dbType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeIsNull() {
|
||||
addCriterion("func_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeIsNotNull() {
|
||||
addCriterion("func_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeEqualTo(Integer value) {
|
||||
addCriterion("func_type =", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeNotEqualTo(Integer value) {
|
||||
addCriterion("func_type <>", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeGreaterThan(Integer value) {
|
||||
addCriterion("func_type >", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("func_type >=", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeLessThan(Integer value) {
|
||||
addCriterion("func_type <", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("func_type <=", value, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeIn(List<Integer> values) {
|
||||
addCriterion("func_type in", values, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeNotIn(List<Integer> values) {
|
||||
addCriterion("func_type not in", values, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeBetween(Integer value1, Integer value2) {
|
||||
addCriterion("func_type between", value1, value2, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andFuncTypeNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("func_type not between", value1, value2, "funcType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
<?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>
|
||||
@@ -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);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
@@ -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"/>-->
|
||||
|
||||
Reference in New Issue
Block a user