Merge remote-tracking branch 'origin/main' into main
# Conflicts: # backend/src/main/java/io/dataease/auth/entity/SysUserEntity.java # backend/src/main/java/io/dataease/base/mapper/ext/AuthMapper.xml # backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java # backend/src/main/resources/generatorConfig.xml # frontend/src/views/panel/list/PanelViewShow.vue
This commit is contained in:
commit
c9b206ccd8
@ -2,6 +2,7 @@ package io.dataease.auth.api;
|
||||
|
||||
|
||||
import io.dataease.auth.api.dto.DynamicMenuDto;
|
||||
import io.dataease.controller.handler.annotation.I18n;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -16,6 +17,7 @@ public interface DynamicMenuApi {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/menus")
|
||||
@I18n
|
||||
List<DynamicMenuDto> menus();
|
||||
|
||||
}
|
||||
|
||||
@ -24,5 +24,7 @@ public class SysUserEntity implements Serializable {
|
||||
|
||||
private String phone;
|
||||
|
||||
private String language;
|
||||
|
||||
private Boolean isAdmin;
|
||||
}
|
||||
|
||||
@ -13,6 +13,9 @@ import io.dataease.auth.util.RsaUtil;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.CodingUtil;
|
||||
import io.dataease.commons.utils.ServletUtils;
|
||||
/*import io.dataease.plugins.config.SpringContextUtil;
|
||||
import io.dataease.plugins.xpack.dto.response.SysSettingDto;
|
||||
import io.dataease.plugins.xpack.service.DePluginXpackService;*/
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
@ -105,6 +108,14 @@ public class AuthServer implements AuthApi {
|
||||
SysUserEntity userById = authUserService.getUserById(4L);
|
||||
String nickName = userById.getNickName();
|
||||
System.out.println(nickName);
|
||||
/* Map<String, DePluginXpackService> beansOfType = SpringContextUtil.getApplicationContext().getBeansOfType(DePluginXpackService.class);
|
||||
for (Map.Entry entry : beansOfType.entrySet()) {
|
||||
Object key = entry.getKey();
|
||||
DePluginXpackService value = (DePluginXpackService)entry.getValue();
|
||||
List<SysSettingDto> sysSettingDtos = value.systemSettings();
|
||||
String name = entry.getValue().getClass().getName();
|
||||
System.out.println("key: "+ key + ", value: "+ name);
|
||||
}*/
|
||||
return "apple";
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,7 +46,12 @@ public class ShiroServiceImpl implements ShiroService {
|
||||
filterChainDefinitionMap.put("/chart/view/getData/**", ANON);
|
||||
|
||||
|
||||
filterChainDefinitionMap.put("/system/ui/**", ANON);
|
||||
filterChainDefinitionMap.put("/PluginDemo.js", ANON);
|
||||
filterChainDefinitionMap.put("/DeXPack.js", ANON);
|
||||
|
||||
filterChainDefinitionMap.put("/api/auth/test", ANON);
|
||||
filterChainDefinitionMap.put("/api/xpack/test", ANON);
|
||||
|
||||
filterChainDefinitionMap.put("/api/auth/login", ANON);
|
||||
filterChainDefinitionMap.put("/api/auth/validateName", ANON);
|
||||
|
||||
@ -24,6 +24,8 @@ public class DatasetTableField implements Serializable {
|
||||
|
||||
private Integer deType;
|
||||
|
||||
private Integer deExtractType;
|
||||
|
||||
private Boolean checked;
|
||||
|
||||
private Integer columnIndex;
|
||||
|
||||
@ -644,6 +644,66 @@ public class DatasetTableFieldExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeIsNull() {
|
||||
addCriterion("de_extract_type is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeIsNotNull() {
|
||||
addCriterion("de_extract_type is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeEqualTo(Integer value) {
|
||||
addCriterion("de_extract_type =", value, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeNotEqualTo(Integer value) {
|
||||
addCriterion("de_extract_type <>", value, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeGreaterThan(Integer value) {
|
||||
addCriterion("de_extract_type >", value, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeGreaterThanOrEqualTo(Integer value) {
|
||||
addCriterion("de_extract_type >=", value, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeLessThan(Integer value) {
|
||||
addCriterion("de_extract_type <", value, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeLessThanOrEqualTo(Integer value) {
|
||||
addCriterion("de_extract_type <=", value, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeIn(List<Integer> values) {
|
||||
addCriterion("de_extract_type in", values, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeNotIn(List<Integer> values) {
|
||||
addCriterion("de_extract_type not in", values, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeBetween(Integer value1, Integer value2) {
|
||||
addCriterion("de_extract_type between", value1, value2, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDeExtractTypeNotBetween(Integer value1, Integer value2) {
|
||||
addCriterion("de_extract_type not between", value1, value2, "deExtractType");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCheckedIsNull() {
|
||||
addCriterion("`checked` is null");
|
||||
return (Criteria) this;
|
||||
|
||||
@ -17,9 +17,9 @@ public class DatasetTableTaskLog implements Serializable {
|
||||
|
||||
private String status;
|
||||
|
||||
private String info;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private String info;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -504,76 +504,6 @@ public class DatasetTableTaskLogExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoIsNull() {
|
||||
addCriterion("info is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoIsNotNull() {
|
||||
addCriterion("info is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoEqualTo(String value) {
|
||||
addCriterion("info =", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoNotEqualTo(String value) {
|
||||
addCriterion("info <>", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoGreaterThan(String value) {
|
||||
addCriterion("info >", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("info >=", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoLessThan(String value) {
|
||||
addCriterion("info <", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoLessThanOrEqualTo(String value) {
|
||||
addCriterion("info <=", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoLike(String value) {
|
||||
addCriterion("info like", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoNotLike(String value) {
|
||||
addCriterion("info not like", value, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoIn(List<String> values) {
|
||||
addCriterion("info in", values, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoNotIn(List<String> values) {
|
||||
addCriterion("info not in", values, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoBetween(String value1, String value2) {
|
||||
addCriterion("info between", value1, value2, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andInfoNotBetween(String value1, String value2) {
|
||||
addCriterion("info not between", value1, value2, "info");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNull() {
|
||||
addCriterion("create_time is null");
|
||||
return (Criteria) this;
|
||||
|
||||
125
backend/src/main/java/io/dataease/base/domain/License.java
Normal file
125
backend/src/main/java/io/dataease/base/domain/License.java
Normal file
@ -0,0 +1,125 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
public class License implements Serializable {
|
||||
@ApiModelProperty("")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty("license")
|
||||
private String license;
|
||||
|
||||
@ApiModelProperty("F2C License")
|
||||
private String f2cLicense;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column license.id
|
||||
*
|
||||
* @return the value of license.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column license.id
|
||||
*
|
||||
* @param id the value for license.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id == null ? null : id.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column license.update_time
|
||||
*
|
||||
* @return the value of license.update_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column license.update_time
|
||||
*
|
||||
* @param updateTime the value for license.update_time
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column license.license
|
||||
*
|
||||
* @return the value of license.license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getLicense() {
|
||||
return license;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column license.license
|
||||
*
|
||||
* @param license the value for license.license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setLicense(String license) {
|
||||
this.license = license == null ? null : license.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column license.f2c_license
|
||||
*
|
||||
* @return the value of license.f2c_license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getF2cLicense() {
|
||||
return f2cLicense;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column license.f2c_license
|
||||
*
|
||||
* @param f2cLicense the value for license.f2c_license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setF2cLicense(String f2cLicense) {
|
||||
this.f2cLicense = f2cLicense == null ? null : f2cLicense.trim();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,578 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class LicenseExample {
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected String orderByClause;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected boolean distinct;
|
||||
|
||||
/**
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public LicenseExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
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(String value) {
|
||||
addCriterion("id =", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotEqualTo(String value) {
|
||||
addCriterion("id <>", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThan(String value) {
|
||||
addCriterion("id >", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("id >=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThan(String value) {
|
||||
addCriterion("id <", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLessThanOrEqualTo(String value) {
|
||||
addCriterion("id <=", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdLike(String value) {
|
||||
addCriterion("id like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotLike(String value) {
|
||||
addCriterion("id not like", value, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIn(List<String> values) {
|
||||
addCriterion("id in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotIn(List<String> values) {
|
||||
addCriterion("id not in", values, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdBetween(String value1, String value2) {
|
||||
addCriterion("id between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdNotBetween(String value1, String value2) {
|
||||
addCriterion("id not between", value1, value2, "id");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeIsNull() {
|
||||
addCriterion("update_time is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeIsNotNull() {
|
||||
addCriterion("update_time is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeEqualTo(Date value) {
|
||||
addCriterion("update_time =", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotEqualTo(Date value) {
|
||||
addCriterion("update_time <>", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeGreaterThan(Date value) {
|
||||
addCriterion("update_time >", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) {
|
||||
addCriterion("update_time >=", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeLessThan(Date value) {
|
||||
addCriterion("update_time <", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeLessThanOrEqualTo(Date value) {
|
||||
addCriterion("update_time <=", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeIn(List<Date> values) {
|
||||
addCriterion("update_time in", values, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotIn(List<Date> values) {
|
||||
addCriterion("update_time not in", values, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeBetween(Date value1, Date value2) {
|
||||
addCriterion("update_time between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotBetween(Date value1, Date value2) {
|
||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseIsNull() {
|
||||
addCriterion("license is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseIsNotNull() {
|
||||
addCriterion("license is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseEqualTo(String value) {
|
||||
addCriterion("license =", value, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseNotEqualTo(String value) {
|
||||
addCriterion("license <>", value, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseGreaterThan(String value) {
|
||||
addCriterion("license >", value, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("license >=", value, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseLessThan(String value) {
|
||||
addCriterion("license <", value, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseLessThanOrEqualTo(String value) {
|
||||
addCriterion("license <=", value, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseLike(String value) {
|
||||
addCriterion("license like", value, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseNotLike(String value) {
|
||||
addCriterion("license not like", value, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseIn(List<String> values) {
|
||||
addCriterion("license in", values, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseNotIn(List<String> values) {
|
||||
addCriterion("license not in", values, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseBetween(String value1, String value2) {
|
||||
addCriterion("license between", value1, value2, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLicenseNotBetween(String value1, String value2) {
|
||||
addCriterion("license not between", value1, value2, "license");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseIsNull() {
|
||||
addCriterion("f2c_license is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseIsNotNull() {
|
||||
addCriterion("f2c_license is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseEqualTo(String value) {
|
||||
addCriterion("f2c_license =", value, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseNotEqualTo(String value) {
|
||||
addCriterion("f2c_license <>", value, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseGreaterThan(String value) {
|
||||
addCriterion("f2c_license >", value, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("f2c_license >=", value, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseLessThan(String value) {
|
||||
addCriterion("f2c_license <", value, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseLessThanOrEqualTo(String value) {
|
||||
addCriterion("f2c_license <=", value, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseLike(String value) {
|
||||
addCriterion("f2c_license like", value, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseNotLike(String value) {
|
||||
addCriterion("f2c_license not like", value, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseIn(List<String> values) {
|
||||
addCriterion("f2c_license in", values, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseNotIn(List<String> values) {
|
||||
addCriterion("f2c_license not in", values, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseBetween(String value1, String value2) {
|
||||
addCriterion("f2c_license between", value1, value2, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andF2cLicenseNotBetween(String value1, String value2) {
|
||||
addCriterion("f2c_license not between", value1, value2, "f2cLicense");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSqlCriterion(String value) {
|
||||
addCriterion("(" + value + ")");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated do_not_delete_during_merge
|
||||
*/
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
35
backend/src/main/java/io/dataease/base/domain/MyPlugin.java
Normal file
35
backend/src/main/java/io/dataease/base/domain/MyPlugin.java
Normal file
@ -0,0 +1,35 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MyPlugin implements Serializable {
|
||||
private Long pluginId;
|
||||
|
||||
private String name;
|
||||
|
||||
private Boolean free;
|
||||
|
||||
private Integer cost;
|
||||
|
||||
private String descript;
|
||||
|
||||
private String version;
|
||||
|
||||
private Integer installType;
|
||||
|
||||
private String creator;
|
||||
|
||||
private Long releaseTime;
|
||||
|
||||
private Long installTime;
|
||||
|
||||
private String moduleName;
|
||||
|
||||
private String beanName;
|
||||
|
||||
private String icon;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
1050
backend/src/main/java/io/dataease/base/domain/MyPluginExample.java
Normal file
1050
backend/src/main/java/io/dataease/base/domain/MyPluginExample.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -35,5 +35,7 @@ public class SysUser implements Serializable {
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private String language;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@ -1083,6 +1083,76 @@ public class SysUserExample {
|
||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageIsNull() {
|
||||
addCriterion("`language` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageIsNotNull() {
|
||||
addCriterion("`language` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageEqualTo(String value) {
|
||||
addCriterion("`language` =", value, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageNotEqualTo(String value) {
|
||||
addCriterion("`language` <>", value, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageGreaterThan(String value) {
|
||||
addCriterion("`language` >", value, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`language` >=", value, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageLessThan(String value) {
|
||||
addCriterion("`language` <", value, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageLessThanOrEqualTo(String value) {
|
||||
addCriterion("`language` <=", value, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageLike(String value) {
|
||||
addCriterion("`language` like", value, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageNotLike(String value) {
|
||||
addCriterion("`language` not like", value, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageIn(List<String> values) {
|
||||
addCriterion("`language` in", values, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageNotIn(List<String> values) {
|
||||
addCriterion("`language` not in", values, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageBetween(String value1, String value2) {
|
||||
addCriterion("`language` between", value1, value2, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andLanguageNotBetween(String value1, String value2) {
|
||||
addCriterion("`language` not between", value1, value2, "language");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="size" jdbcType="INTEGER" property="size" />
|
||||
<result column="de_type" jdbcType="INTEGER" property="deType" />
|
||||
<result column="de_extract_type" jdbcType="INTEGER" property="deExtractType" />
|
||||
<result column="checked" jdbcType="BIT" property="checked" />
|
||||
<result column="column_index" jdbcType="INTEGER" property="columnIndex" />
|
||||
<result column="last_sync_time" jdbcType="BIGINT" property="lastSyncTime" />
|
||||
@ -73,8 +74,8 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, table_id, origin_name, `name`, dataease_name, `type`, `size`, de_type, `checked`,
|
||||
column_index, last_sync_time
|
||||
id, table_id, origin_name, `name`, dataease_name, `type`, `size`, de_type, de_extract_type,
|
||||
`checked`, column_index, last_sync_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.DatasetTableFieldExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -109,12 +110,14 @@
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.DatasetTableField">
|
||||
insert into dataset_table_field (id, table_id, origin_name,
|
||||
`name`, dataease_name, `type`,
|
||||
`size`, de_type, `checked`,
|
||||
column_index, last_sync_time)
|
||||
`size`, de_type, de_extract_type,
|
||||
`checked`, column_index, last_sync_time
|
||||
)
|
||||
values (#{id,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{originName,jdbcType=VARCHAR},
|
||||
#{name,jdbcType=VARCHAR}, #{dataeaseName,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
|
||||
#{size,jdbcType=INTEGER}, #{deType,jdbcType=INTEGER}, #{checked,jdbcType=BIT},
|
||||
#{columnIndex,jdbcType=INTEGER}, #{lastSyncTime,jdbcType=BIGINT})
|
||||
#{size,jdbcType=INTEGER}, #{deType,jdbcType=INTEGER}, #{deExtractType,jdbcType=INTEGER},
|
||||
#{checked,jdbcType=BIT}, #{columnIndex,jdbcType=INTEGER}, #{lastSyncTime,jdbcType=BIGINT}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.DatasetTableField">
|
||||
insert into dataset_table_field
|
||||
@ -143,6 +146,9 @@
|
||||
<if test="deType != null">
|
||||
de_type,
|
||||
</if>
|
||||
<if test="deExtractType != null">
|
||||
de_extract_type,
|
||||
</if>
|
||||
<if test="checked != null">
|
||||
`checked`,
|
||||
</if>
|
||||
@ -178,6 +184,9 @@
|
||||
<if test="deType != null">
|
||||
#{deType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="deExtractType != null">
|
||||
#{deExtractType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="checked != null">
|
||||
#{checked,jdbcType=BIT},
|
||||
</if>
|
||||
@ -222,6 +231,9 @@
|
||||
<if test="record.deType != null">
|
||||
de_type = #{record.deType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.deExtractType != null">
|
||||
de_extract_type = #{record.deExtractType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.checked != null">
|
||||
`checked` = #{record.checked,jdbcType=BIT},
|
||||
</if>
|
||||
@ -246,6 +258,7 @@
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
`size` = #{record.size,jdbcType=INTEGER},
|
||||
de_type = #{record.deType,jdbcType=INTEGER},
|
||||
de_extract_type = #{record.deExtractType,jdbcType=INTEGER},
|
||||
`checked` = #{record.checked,jdbcType=BIT},
|
||||
column_index = #{record.columnIndex,jdbcType=INTEGER},
|
||||
last_sync_time = #{record.lastSyncTime,jdbcType=BIGINT}
|
||||
@ -277,6 +290,9 @@
|
||||
<if test="deType != null">
|
||||
de_type = #{deType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="deExtractType != null">
|
||||
de_extract_type = #{deExtractType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="checked != null">
|
||||
`checked` = #{checked,jdbcType=BIT},
|
||||
</if>
|
||||
@ -298,6 +314,7 @@
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
`size` = #{size,jdbcType=INTEGER},
|
||||
de_type = #{deType,jdbcType=INTEGER},
|
||||
de_extract_type = #{deExtractType,jdbcType=INTEGER},
|
||||
`checked` = #{checked,jdbcType=BIT},
|
||||
column_index = #{columnIndex,jdbcType=INTEGER},
|
||||
last_sync_time = #{lastSyncTime,jdbcType=BIGINT}
|
||||
|
||||
@ -10,13 +10,21 @@ public interface DatasetTableIncrementalConfigMapper {
|
||||
|
||||
int deleteByExample(DatasetTableIncrementalConfigExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(DatasetTableIncrementalConfig record);
|
||||
|
||||
int insertSelective(DatasetTableIncrementalConfig record);
|
||||
|
||||
List<DatasetTableIncrementalConfig> selectByExample(DatasetTableIncrementalConfigExample example);
|
||||
|
||||
DatasetTableIncrementalConfig selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") DatasetTableIncrementalConfig record, @Param("example") DatasetTableIncrementalConfigExample example);
|
||||
|
||||
int updateByExample(@Param("record") DatasetTableIncrementalConfig record, @Param("example") DatasetTableIncrementalConfigExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(DatasetTableIncrementalConfig record);
|
||||
|
||||
int updateByPrimaryKey(DatasetTableIncrementalConfig record);
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.dataease.base.mapper.DatasetTableIncrementalConfigMapper">
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.DatasetTableIncrementalConfig">
|
||||
<result column="id" jdbcType="VARCHAR" property="id" />
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="table_id" jdbcType="VARCHAR" property="tableId" />
|
||||
<result column="incremental_delete" jdbcType="VARCHAR" property="incrementalDelete" />
|
||||
<result column="incremental_add" jdbcType="VARCHAR" property="incrementalAdd" />
|
||||
@ -82,6 +82,16 @@
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from dataset_table_incremental_config
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from dataset_table_incremental_config
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfigExample">
|
||||
delete from dataset_table_incremental_config
|
||||
<if test="_parameter != null">
|
||||
@ -161,4 +171,26 @@
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfig">
|
||||
update dataset_table_incremental_config
|
||||
<set>
|
||||
<if test="tableId != null">
|
||||
table_id = #{tableId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="incrementalDelete != null">
|
||||
incremental_delete = #{incrementalDelete,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="incrementalAdd != null">
|
||||
incremental_add = #{incrementalAdd,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfig">
|
||||
update dataset_table_incremental_config
|
||||
set table_id = #{tableId,jdbcType=VARCHAR},
|
||||
incremental_delete = #{incrementalDelete,jdbcType=VARCHAR},
|
||||
incremental_add = #{incrementalAdd,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -16,15 +16,21 @@ public interface DatasetTableTaskLogMapper {
|
||||
|
||||
int insertSelective(DatasetTableTaskLog record);
|
||||
|
||||
List<DatasetTableTaskLog> selectByExampleWithBLOBs(DatasetTableTaskLogExample example);
|
||||
|
||||
List<DatasetTableTaskLog> selectByExample(DatasetTableTaskLogExample example);
|
||||
|
||||
DatasetTableTaskLog selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") DatasetTableTaskLog record, @Param("example") DatasetTableTaskLogExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") DatasetTableTaskLog record, @Param("example") DatasetTableTaskLogExample example);
|
||||
|
||||
int updateByExample(@Param("record") DatasetTableTaskLog record, @Param("example") DatasetTableTaskLogExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(DatasetTableTaskLog record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(DatasetTableTaskLog record);
|
||||
|
||||
int updateByPrimaryKey(DatasetTableTaskLog record);
|
||||
}
|
||||
@ -8,9 +8,11 @@
|
||||
<result column="start_time" jdbcType="BIGINT" property="startTime" />
|
||||
<result column="end_time" jdbcType="BIGINT" property="endTime" />
|
||||
<result column="status" jdbcType="VARCHAR" property="status" />
|
||||
<result column="info" jdbcType="VARCHAR" property="info" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.DatasetTableTaskLog">
|
||||
<result column="info" jdbcType="LONGVARCHAR" property="info" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
@ -70,8 +72,27 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, table_id, task_id, start_time, end_time, `status`, info, create_time
|
||||
id, table_id, task_id, start_time, end_time, `status`, create_time
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
info
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.DatasetTableTaskLogExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from dataset_table_task_log
|
||||
<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.DatasetTableTaskLogExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
@ -86,9 +107,11 @@
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from dataset_table_task_log
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
@ -105,10 +128,10 @@
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
|
||||
insert into dataset_table_task_log (id, table_id, task_id,
|
||||
start_time, end_time, `status`,
|
||||
info, create_time)
|
||||
create_time, info)
|
||||
values (#{id,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR},
|
||||
#{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
|
||||
#{info,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT})
|
||||
#{createTime,jdbcType=BIGINT}, #{info,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
|
||||
insert into dataset_table_task_log
|
||||
@ -131,12 +154,12 @@
|
||||
<if test="status != null">
|
||||
`status`,
|
||||
</if>
|
||||
<if test="info != null">
|
||||
info,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="info != null">
|
||||
info,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
@ -157,12 +180,12 @@
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="info != null">
|
||||
#{info,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="info != null">
|
||||
#{info,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.DatasetTableTaskLogExample" resultType="java.lang.Long">
|
||||
@ -192,17 +215,31 @@
|
||||
<if test="record.status != null">
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.info != null">
|
||||
info = #{record.info,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.info != null">
|
||||
info = #{record.info,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_task_log
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
table_id = #{record.tableId,jdbcType=VARCHAR},
|
||||
task_id = #{record.taskId,jdbcType=VARCHAR},
|
||||
start_time = #{record.startTime,jdbcType=BIGINT},
|
||||
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
info = #{record.info,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update dataset_table_task_log
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
@ -211,7 +248,6 @@
|
||||
start_time = #{record.startTime,jdbcType=BIGINT},
|
||||
end_time = #{record.endTime,jdbcType=BIGINT},
|
||||
`status` = #{record.status,jdbcType=VARCHAR},
|
||||
info = #{record.info,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -235,15 +271,26 @@
|
||||
<if test="status != null">
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="info != null">
|
||||
info = #{info,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="info != null">
|
||||
info = #{info,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
|
||||
update dataset_table_task_log
|
||||
set table_id = #{tableId,jdbcType=VARCHAR},
|
||||
task_id = #{taskId,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=BIGINT},
|
||||
end_time = #{endTime,jdbcType=BIGINT},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
info = #{info,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
|
||||
update dataset_table_task_log
|
||||
set table_id = #{tableId,jdbcType=VARCHAR},
|
||||
@ -251,7 +298,6 @@
|
||||
start_time = #{startTime,jdbcType=BIGINT},
|
||||
end_time = #{endTime,jdbcType=BIGINT},
|
||||
`status` = #{status,jdbcType=VARCHAR},
|
||||
info = #{info,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
@ -0,0 +1,96 @@
|
||||
package io.dataease.base.mapper;
|
||||
|
||||
import io.dataease.base.domain.License;
|
||||
import io.dataease.base.domain.LicenseExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface LicenseMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
long countByExample(LicenseExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int deleteByExample(LicenseExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int insert(License record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int insertSelective(License record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
List<License> selectByExample(LicenseExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
License selectByPrimaryKey(String id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByExampleSelective(@Param("record") License record, @Param("example") LicenseExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByExample(@Param("record") License record, @Param("example") LicenseExample example);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKeySelective(License record);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table license
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
int updateByPrimaryKey(License record);
|
||||
}
|
||||
256
backend/src/main/java/io/dataease/base/mapper/LicenseMapper.xml
Normal file
256
backend/src/main/java/io/dataease/base/mapper/LicenseMapper.xml
Normal file
@ -0,0 +1,256 @@
|
||||
<?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.LicenseMapper">
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.License">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
<result column="license" jdbcType="VARCHAR" property="license" />
|
||||
<result column="f2c_license" jdbcType="VARCHAR" property="f2cLicense" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<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">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
<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">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
id, update_time, license, f2c_license
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.LicenseExample" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from license
|
||||
<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.String" resultMap="BaseResultMap">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from license
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from license
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.dataease.base.domain.LicenseExample">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
delete from license
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.License">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into license (id, update_time, license,
|
||||
f2c_license)
|
||||
values (#{id,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{license,jdbcType=VARCHAR},
|
||||
#{f2cLicense,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.License">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
insert into license
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="license != null">
|
||||
license,
|
||||
</if>
|
||||
<if test="f2cLicense != null">
|
||||
f2c_license,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="license != null">
|
||||
#{license,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="f2cLicense != null">
|
||||
#{f2cLicense,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.LicenseExample" resultType="java.lang.Long">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
select count(*) from license
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update license
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="record.license != null">
|
||||
license = #{record.license,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.f2cLicense != null">
|
||||
f2c_license = #{record.f2cLicense,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update license
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
update_time = #{record.updateTime,jdbcType=TIMESTAMP},
|
||||
license = #{record.license,jdbcType=VARCHAR},
|
||||
f2c_license = #{record.f2cLicense,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.License">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update license
|
||||
<set>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="license != null">
|
||||
license = #{license,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="f2cLicense != null">
|
||||
f2c_license = #{f2cLicense,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.License">
|
||||
<!--
|
||||
WARNING - @mbg.generated
|
||||
This element is automatically generated by MyBatis Generator, do not modify.
|
||||
-->
|
||||
update license
|
||||
set update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
license = #{license,jdbcType=VARCHAR},
|
||||
f2c_license = #{f2cLicense,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -0,0 +1,30 @@
|
||||
package io.dataease.base.mapper;
|
||||
|
||||
import io.dataease.base.domain.MyPlugin;
|
||||
import io.dataease.base.domain.MyPluginExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface MyPluginMapper {
|
||||
long countByExample(MyPluginExample example);
|
||||
|
||||
int deleteByExample(MyPluginExample example);
|
||||
|
||||
int deleteByPrimaryKey(Long pluginId);
|
||||
|
||||
int insert(MyPlugin record);
|
||||
|
||||
int insertSelective(MyPlugin record);
|
||||
|
||||
List<MyPlugin> selectByExample(MyPluginExample example);
|
||||
|
||||
MyPlugin selectByPrimaryKey(Long pluginId);
|
||||
|
||||
int updateByExampleSelective(@Param("record") MyPlugin record, @Param("example") MyPluginExample example);
|
||||
|
||||
int updateByExample(@Param("record") MyPlugin record, @Param("example") MyPluginExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(MyPlugin record);
|
||||
|
||||
int updateByPrimaryKey(MyPlugin record);
|
||||
}
|
||||
338
backend/src/main/java/io/dataease/base/mapper/MyPluginMapper.xml
Normal file
338
backend/src/main/java/io/dataease/base/mapper/MyPluginMapper.xml
Normal file
@ -0,0 +1,338 @@
|
||||
<?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.MyPluginMapper">
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.MyPlugin">
|
||||
<id column="plugin_id" jdbcType="BIGINT" property="pluginId" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="free" jdbcType="BIT" property="free" />
|
||||
<result column="cost" jdbcType="INTEGER" property="cost" />
|
||||
<result column="descript" jdbcType="VARCHAR" property="descript" />
|
||||
<result column="version" jdbcType="VARCHAR" property="version" />
|
||||
<result column="install_type" jdbcType="INTEGER" property="installType" />
|
||||
<result column="creator" jdbcType="VARCHAR" property="creator" />
|
||||
<result column="release_time" jdbcType="BIGINT" property="releaseTime" />
|
||||
<result column="install_time" jdbcType="BIGINT" property="installTime" />
|
||||
<result column="module_name" jdbcType="VARCHAR" property="moduleName" />
|
||||
<result column="bean_name" jdbcType="VARCHAR" property="beanName" />
|
||||
<result column="icon" jdbcType="VARCHAR" property="icon" />
|
||||
</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">
|
||||
plugin_id, `name`, `free`, cost, descript, version, install_type, creator, release_time,
|
||||
install_time, module_name, bean_name, icon
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.MyPluginExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from my_plugin
|
||||
<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="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from my_plugin
|
||||
where plugin_id = #{pluginId,jdbcType=BIGINT}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from my_plugin
|
||||
where plugin_id = #{pluginId,jdbcType=BIGINT}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.dataease.base.domain.MyPluginExample">
|
||||
delete from my_plugin
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.MyPlugin">
|
||||
insert into my_plugin (plugin_id, `name`, `free`,
|
||||
cost, descript, version,
|
||||
install_type, creator, release_time,
|
||||
install_time, module_name, bean_name,
|
||||
icon)
|
||||
values (#{pluginId,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{free,jdbcType=BIT},
|
||||
#{cost,jdbcType=INTEGER}, #{descript,jdbcType=VARCHAR}, #{version,jdbcType=VARCHAR},
|
||||
#{installType,jdbcType=INTEGER}, #{creator,jdbcType=VARCHAR}, #{releaseTime,jdbcType=BIGINT},
|
||||
#{installTime,jdbcType=BIGINT}, #{moduleName,jdbcType=VARCHAR}, #{beanName,jdbcType=VARCHAR},
|
||||
#{icon,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.MyPlugin">
|
||||
insert into my_plugin
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="pluginId != null">
|
||||
plugin_id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="free != null">
|
||||
`free`,
|
||||
</if>
|
||||
<if test="cost != null">
|
||||
cost,
|
||||
</if>
|
||||
<if test="descript != null">
|
||||
descript,
|
||||
</if>
|
||||
<if test="version != null">
|
||||
version,
|
||||
</if>
|
||||
<if test="installType != null">
|
||||
install_type,
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="releaseTime != null">
|
||||
release_time,
|
||||
</if>
|
||||
<if test="installTime != null">
|
||||
install_time,
|
||||
</if>
|
||||
<if test="moduleName != null">
|
||||
module_name,
|
||||
</if>
|
||||
<if test="beanName != null">
|
||||
bean_name,
|
||||
</if>
|
||||
<if test="icon != null">
|
||||
icon,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="pluginId != null">
|
||||
#{pluginId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="free != null">
|
||||
#{free,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="cost != null">
|
||||
#{cost,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="descript != null">
|
||||
#{descript,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="version != null">
|
||||
#{version,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="installType != null">
|
||||
#{installType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
#{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="releaseTime != null">
|
||||
#{releaseTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="installTime != null">
|
||||
#{installTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="moduleName != null">
|
||||
#{moduleName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="beanName != null">
|
||||
#{beanName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="icon != null">
|
||||
#{icon,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.MyPluginExample" resultType="java.lang.Long">
|
||||
select count(*) from my_plugin
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update my_plugin
|
||||
<set>
|
||||
<if test="record.pluginId != null">
|
||||
plugin_id = #{record.pluginId,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.free != null">
|
||||
`free` = #{record.free,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="record.cost != null">
|
||||
cost = #{record.cost,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.descript != null">
|
||||
descript = #{record.descript,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.version != null">
|
||||
version = #{record.version,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.installType != null">
|
||||
install_type = #{record.installType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="record.creator != null">
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.releaseTime != null">
|
||||
release_time = #{record.releaseTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.installTime != null">
|
||||
install_time = #{record.installTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.moduleName != null">
|
||||
module_name = #{record.moduleName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.beanName != null">
|
||||
bean_name = #{record.beanName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.icon != null">
|
||||
icon = #{record.icon,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update my_plugin
|
||||
set plugin_id = #{record.pluginId,jdbcType=BIGINT},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
`free` = #{record.free,jdbcType=BIT},
|
||||
cost = #{record.cost,jdbcType=INTEGER},
|
||||
descript = #{record.descript,jdbcType=VARCHAR},
|
||||
version = #{record.version,jdbcType=VARCHAR},
|
||||
install_type = #{record.installType,jdbcType=INTEGER},
|
||||
creator = #{record.creator,jdbcType=VARCHAR},
|
||||
release_time = #{record.releaseTime,jdbcType=BIGINT},
|
||||
install_time = #{record.installTime,jdbcType=BIGINT},
|
||||
module_name = #{record.moduleName,jdbcType=VARCHAR},
|
||||
bean_name = #{record.beanName,jdbcType=VARCHAR},
|
||||
icon = #{record.icon,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.MyPlugin">
|
||||
update my_plugin
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="free != null">
|
||||
`free` = #{free,jdbcType=BIT},
|
||||
</if>
|
||||
<if test="cost != null">
|
||||
cost = #{cost,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="descript != null">
|
||||
descript = #{descript,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="version != null">
|
||||
version = #{version,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="installType != null">
|
||||
install_type = #{installType,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="creator != null">
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="releaseTime != null">
|
||||
release_time = #{releaseTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="installTime != null">
|
||||
install_time = #{installTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="moduleName != null">
|
||||
module_name = #{moduleName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="beanName != null">
|
||||
bean_name = #{beanName,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="icon != null">
|
||||
icon = #{icon,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where plugin_id = #{pluginId,jdbcType=BIGINT}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.MyPlugin">
|
||||
update my_plugin
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
`free` = #{free,jdbcType=BIT},
|
||||
cost = #{cost,jdbcType=INTEGER},
|
||||
descript = #{descript,jdbcType=VARCHAR},
|
||||
version = #{version,jdbcType=VARCHAR},
|
||||
install_type = #{installType,jdbcType=INTEGER},
|
||||
creator = #{creator,jdbcType=VARCHAR},
|
||||
release_time = #{releaseTime,jdbcType=BIGINT},
|
||||
install_time = #{installTime,jdbcType=BIGINT},
|
||||
module_name = #{moduleName,jdbcType=VARCHAR},
|
||||
bean_name = #{beanName,jdbcType=VARCHAR},
|
||||
icon = #{icon,jdbcType=VARCHAR}
|
||||
where plugin_id = #{pluginId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -17,6 +17,7 @@
|
||||
<result column="pwd_reset_time" jdbcType="BIGINT" property="pwdResetTime" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
<result column="language" jdbcType="VARCHAR" property="language" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
@ -78,7 +79,7 @@
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
user_id, dept_id, username, nick_name, gender, phone, email, `password`, is_admin,
|
||||
enabled, create_by, update_by, pwd_reset_time, create_time, update_time
|
||||
enabled, create_by, update_by, pwd_reset_time, create_time, update_time, `language`
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.SysUserExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -115,14 +116,14 @@
|
||||
nick_name, gender, phone,
|
||||
email, `password`, is_admin,
|
||||
enabled, create_by, update_by,
|
||||
pwd_reset_time, create_time, update_time
|
||||
)
|
||||
pwd_reset_time, create_time, update_time,
|
||||
`language`)
|
||||
values (#{userId,jdbcType=BIGINT}, #{deptId,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR},
|
||||
#{nickName,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
|
||||
#{email,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{isAdmin,jdbcType=BIT},
|
||||
#{enabled,jdbcType=BIGINT}, #{createBy,jdbcType=VARCHAR}, #{updateBy,jdbcType=VARCHAR},
|
||||
#{pwdResetTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}
|
||||
)
|
||||
#{pwdResetTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{language,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.SysUser">
|
||||
insert into sys_user
|
||||
@ -172,6 +173,9 @@
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="language != null">
|
||||
`language`,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">
|
||||
@ -219,6 +223,9 @@
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="language != null">
|
||||
#{language,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.SysUserExample" resultType="java.lang.Long">
|
||||
@ -275,6 +282,9 @@
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.language != null">
|
||||
`language` = #{record.language,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -296,7 +306,8 @@
|
||||
update_by = #{record.updateBy,jdbcType=VARCHAR},
|
||||
pwd_reset_time = #{record.pwdResetTime,jdbcType=BIGINT},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
`language` = #{record.language,jdbcType=VARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
@ -346,6 +357,9 @@
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="language != null">
|
||||
`language` = #{language,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where user_id = #{userId,jdbcType=BIGINT}
|
||||
</update>
|
||||
@ -364,7 +378,8 @@
|
||||
update_by = #{updateBy,jdbcType=VARCHAR},
|
||||
pwd_reset_time = #{pwdResetTime,jdbcType=BIGINT},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
`language` = #{language,jdbcType=VARCHAR}
|
||||
where user_id = #{userId,jdbcType=BIGINT}
|
||||
</update>
|
||||
</mapper>
|
||||
@ -6,7 +6,6 @@ import io.dataease.auth.api.dto.CurrentRoleDto;
|
||||
import io.dataease.auth.entity.SysUserEntity;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface AuthMapper {
|
||||
|
||||
|
||||
@ -21,11 +21,11 @@
|
||||
|
||||
|
||||
<select id="findUser" resultMap="baseMap">
|
||||
select user_id, username,nick_name, dept_id, password, enabled,email, phone,is_admin from sys_user where user_id = #{userId}
|
||||
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language,is_admin from sys_user where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="findUserByName" resultMap="baseMap">
|
||||
select user_id, username,nick_name, dept_id, password, enabled,email, phone,is_admin from sys_user where username = #{username}
|
||||
select user_id, username,nick_name, dept_id, password, enabled,email, phone, language ,is_admin from sys_user where username = #{username}
|
||||
</select>
|
||||
|
||||
<select id="roleCodes" resultType="String">
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
FROM dataset_table_task_log
|
||||
LEFT JOIN dataset_table_task ON dataset_table_task_log.task_id = dataset_table_task.id
|
||||
WHERE dataset_table_task_log.table_id = #{tableId,jdbcType=VARCHAR}
|
||||
ORDER BY dataset_table_task_log.create_time desc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -0,0 +1,11 @@
|
||||
package io.dataease.base.mapper.ext;
|
||||
|
||||
import io.dataease.base.domain.MyPlugin;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ExtSysPluginMapper {
|
||||
|
||||
List<MyPlugin> query(GridExample example);
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
<?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.ext.ExtSysPluginMapper">
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="query" parameterType="io.dataease.base.mapper.ext.query.GridExample" resultMap="io.dataease.base.mapper.MyPluginMapper.BaseResultMap">
|
||||
select *
|
||||
from my_plugin
|
||||
<if test="_parameter != null">
|
||||
<include refid="io.dataease.base.mapper.ext.query.GridSql.gridCondition" />
|
||||
</if>
|
||||
<if test="orderByClause != null">
|
||||
order by ${orderByClause}
|
||||
</if>
|
||||
<if test="orderByClause == null">
|
||||
order by install_time desc
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum APITestStatus {
|
||||
Saved, Starting, Running, Reporting, Completed, Debug, Error, Success,Underway
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum ApiImportPlatform {
|
||||
Metersphere, Postman, Swagger2, Plugin
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum ApiRunMode {
|
||||
RUN, DEBUG, DEFINITION, SCENARIO, API_PLAN, JENKINS_API_PLAN, JENKINS, SCENARIO_PLAN, API, SCHEDULE_API_PLAN, SCHEDULE_SCENARIO_PLAN, SCHEDULE_PERFORMANCE_TEST
|
||||
}
|
||||
@ -2,5 +2,5 @@ package io.dataease.commons.constants;
|
||||
|
||||
public class I18nConstants {
|
||||
|
||||
public static final String LANG_COOKIE_NAME = "MS_USER_LANG";
|
||||
public static final String LANG_COOKIE_NAME = "DE_USER_LANG";
|
||||
}
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum LoopConstants {
|
||||
LOOP_COUNT, WHILE, FOREACH
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum MsRequestBodyType {
|
||||
|
||||
|
||||
KV("KeyValue"), FORM_DATA("Form Data"), RAW("Raw");
|
||||
|
||||
private String value;
|
||||
|
||||
MsRequestBodyType(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum MsTestElementConstants {
|
||||
LoopController,SCENARIO,REF
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum PerformanceTestStatus {
|
||||
Saved, Starting, Running, Reporting, Completed, Error
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum PostmanRequestBodyMode {
|
||||
|
||||
RAW("raw"), FORM_DATA("formdata"), URLENCODED("urlencoded"), FILE("file");
|
||||
|
||||
private String value;
|
||||
|
||||
PostmanRequestBodyMode(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@ -1,48 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TestCaseConstants {
|
||||
|
||||
public static final int MAX_NODE_DEPTH = 8;
|
||||
|
||||
public enum Type {
|
||||
Functional("functional"), Performance("performance"), Aapi("api");
|
||||
|
||||
private String value;
|
||||
|
||||
Type(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public static List<String> getValues() {
|
||||
List<Type> types = Arrays.asList(Type.values());
|
||||
return types.stream().map(Type::getValue).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
public enum Method {
|
||||
Manual("manual"), Auto("auto");
|
||||
|
||||
private String value;
|
||||
|
||||
Method(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
public static List<String> getValues() {
|
||||
List<Method> types = Arrays.asList(Method.values());
|
||||
return types.stream().map(Method::getValue).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum TestCaseReviewStatus {
|
||||
Prepare, Underway, Completed
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum TestPlanReportStatus {
|
||||
RUNNING, COMPLETED, SUCCESS, FAILED
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum TestPlanTestCaseStatus {
|
||||
Prepare, Pass, Failure, Blocking, Skip, Underway
|
||||
}
|
||||
@ -1,5 +0,0 @@
|
||||
package io.dataease.commons.constants;
|
||||
|
||||
public enum TestReviewCaseStatus {
|
||||
Prepare, Pass, UnPass
|
||||
}
|
||||
@ -0,0 +1,130 @@
|
||||
package io.dataease.commons.license;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.base.domain.License;
|
||||
import io.dataease.commons.exception.DEException;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DefaultLicenseService {
|
||||
@Resource
|
||||
private InnerLicenseService innerLicenseService;
|
||||
@Value("${spring.application.name:null}")
|
||||
private String moduleId;
|
||||
|
||||
private static final String LICENSE_ID = "fit2cloud_license";
|
||||
private static final String validatorUtil = "/usr/bin/validator";
|
||||
private static final String product = "dataease";
|
||||
/*private static final String[] NO_PLU_LIMIT_MODULES = new String[]{"dashboard", "gateway"};*/
|
||||
|
||||
public F2CLicenseResponse validateLicense(String product, String licenseKey){
|
||||
List<String> command = new ArrayList<String>();
|
||||
StringBuilder result = new StringBuilder();
|
||||
command.add(validatorUtil);
|
||||
command.add(licenseKey);
|
||||
try{
|
||||
execCommand(result, command);
|
||||
F2CLicenseResponse f2CLicenseResponse = new Gson().fromJson(result.toString(), F2CLicenseResponse.class);
|
||||
if(f2CLicenseResponse.getStatus() != F2CLicenseResponse.Status.valid){
|
||||
return f2CLicenseResponse;
|
||||
}
|
||||
if(!StringUtils.equals(f2CLicenseResponse.getLicense().getProduct(), product)){
|
||||
f2CLicenseResponse.setStatus(F2CLicenseResponse.Status.invalid);
|
||||
f2CLicenseResponse.setLicense(null);
|
||||
f2CLicenseResponse.setMessage("The license is unavailable for this product.");
|
||||
return f2CLicenseResponse;
|
||||
}
|
||||
|
||||
// 检查每个模块的PLU限制
|
||||
// if(!Arrays.asList(NO_PLU_LIMIT_MODULES).contains(moduleId)){
|
||||
// AuthorizationUnit authorizationUnit= CommonBeanFactory.getBean(AuthorizationUnit.class);
|
||||
// try{
|
||||
// authorizationUnit.calculateAssets(f2CLicenseResponse.getLicense().getCount());
|
||||
// return f2CLicenseResponse;
|
||||
// }catch (Exception e){
|
||||
// f2CLicenseResponse.setStatus(F2CLicenseResponse.Status.invalid);
|
||||
// f2CLicenseResponse.setMessage(e.getMessage());
|
||||
// }
|
||||
// }
|
||||
return f2CLicenseResponse;
|
||||
}catch (Exception e){
|
||||
return F2CLicenseResponse.invalid(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static int execCommand(StringBuilder result, List<String> command) throws Exception{
|
||||
ProcessBuilder builder = new ProcessBuilder();
|
||||
builder.command(command);
|
||||
Process process = builder.start();
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
String line = null;
|
||||
while ((line=bufferedReader.readLine()) != null){
|
||||
result.append(line).append("\n");
|
||||
}
|
||||
int exitCode = process.waitFor();
|
||||
command.clear();
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
public F2CLicenseResponse validateLicense() {
|
||||
try {
|
||||
License license = readLicense();
|
||||
return validateLicense(product, license.getLicense());
|
||||
} catch (Exception e) {
|
||||
return F2CLicenseResponse.invalid(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void validateF2cLicense(){
|
||||
License license = readLicense();
|
||||
F2CLicenseResponse f2CLicenseResponse = validateLicense(product, license.getLicense());
|
||||
writeLicense(license.getLicense(), f2CLicenseResponse);
|
||||
}
|
||||
|
||||
public F2CLicenseResponse updateLicense(String product, String licenseKey) {
|
||||
// 验证license
|
||||
F2CLicenseResponse response = validateLicense(product, licenseKey);
|
||||
if (response.getStatus() != F2CLicenseResponse.Status.valid) {
|
||||
return response;
|
||||
}
|
||||
// 覆盖原license
|
||||
writeLicense(licenseKey, response);
|
||||
return response;
|
||||
}
|
||||
|
||||
// 从数据库读取License
|
||||
public License readLicense() {
|
||||
License license = innerLicenseService.getLicense(LICENSE_ID);
|
||||
if (license == null) {
|
||||
/*DEException.throwException(Translator.get("i18n_no_license_record"));*/
|
||||
DEException.throwException("i18n_no_license_record");
|
||||
}
|
||||
if (StringUtils.isBlank(license.getLicense())) {
|
||||
DEException.throwException("i18n_license_is_empty");
|
||||
//F2CException.throwException(Translator.get("i18n_license_is_empty"));
|
||||
}
|
||||
return license;
|
||||
}
|
||||
|
||||
// 创建或更新License
|
||||
private void writeLicense(String licenseKey, F2CLicenseResponse response) {
|
||||
if (StringUtils.isBlank(licenseKey)) {
|
||||
|
||||
DEException.throwException("i18n_license_is_empty");
|
||||
|
||||
}
|
||||
License license = new License();
|
||||
license.setId(LICENSE_ID);
|
||||
license.setLicense(licenseKey);
|
||||
license.setF2cLicense(new Gson().toJson(response));
|
||||
innerLicenseService.saveLicense(license);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package io.dataease.commons.license;
|
||||
|
||||
public class F2CLicense {
|
||||
|
||||
private String corporation;
|
||||
private String expired;
|
||||
private String licenseVersion;
|
||||
private String product;
|
||||
private Long generateTime;
|
||||
private String edition;
|
||||
private Long count;
|
||||
|
||||
public String getCorporation() {
|
||||
return corporation;
|
||||
}
|
||||
|
||||
public void setCorporation(String corporation) {
|
||||
this.corporation = corporation;
|
||||
}
|
||||
|
||||
public String getExpired() {
|
||||
return expired;
|
||||
}
|
||||
|
||||
public void setExpired(String expired) {
|
||||
this.expired = expired;
|
||||
}
|
||||
|
||||
public String getLicenseVersion() {
|
||||
return licenseVersion;
|
||||
}
|
||||
|
||||
public void setLicenseVersion(String licenseVersion) {
|
||||
this.licenseVersion = licenseVersion;
|
||||
}
|
||||
|
||||
public String getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(String product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public Long getGenerateTime() {
|
||||
return generateTime;
|
||||
}
|
||||
|
||||
public void setGenerateTime(Long generateTime) {
|
||||
this.generateTime = generateTime;
|
||||
}
|
||||
|
||||
public String getEdition() {
|
||||
return edition;
|
||||
}
|
||||
|
||||
public void setEdition(String edition) {
|
||||
this.edition = edition;
|
||||
}
|
||||
|
||||
public Long getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Long count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package io.dataease.commons.license;
|
||||
|
||||
public class F2CLicenseResponse {
|
||||
|
||||
private Status status;
|
||||
private F2CLicense license;
|
||||
private String message;
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public F2CLicense getLicense() {
|
||||
return license;
|
||||
}
|
||||
|
||||
public void setLicense(F2CLicense license) {
|
||||
this.license = license;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static enum Status {
|
||||
valid,
|
||||
invalid,
|
||||
expired;
|
||||
}
|
||||
|
||||
public static F2CLicenseResponse invalid(String a) {
|
||||
F2CLicenseResponse f2CLicenseResponse = new F2CLicenseResponse();
|
||||
f2CLicenseResponse.setStatus(Status.invalid);
|
||||
f2CLicenseResponse.setLicense(null);
|
||||
f2CLicenseResponse.setMessage(a);
|
||||
return f2CLicenseResponse;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package io.dataease.commons.license;
|
||||
|
||||
import io.dataease.base.domain.License;
|
||||
import io.dataease.base.mapper.LicenseMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
class InnerLicenseService {
|
||||
|
||||
@Resource
|
||||
private LicenseMapper licenseMapper;
|
||||
|
||||
boolean existLicense(String key) {
|
||||
License license = licenseMapper.selectByPrimaryKey(key);
|
||||
return license != null;
|
||||
}
|
||||
|
||||
License getLicense(String key) {
|
||||
License license = licenseMapper.selectByPrimaryKey(key);
|
||||
if (license == null) return null;
|
||||
return license;
|
||||
}
|
||||
|
||||
void saveLicense(License license) {
|
||||
license.setUpdateTime(new Date());
|
||||
if (existLicense(license.getId())) {
|
||||
licenseMapper.updateByPrimaryKey(license);
|
||||
} else {
|
||||
licenseMapper.insert(license);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
115
backend/src/main/java/io/dataease/commons/utils/DeFileUtils.java
Normal file
115
backend/src/main/java/io/dataease/commons/utils/DeFileUtils.java
Normal file
@ -0,0 +1,115 @@
|
||||
package io.dataease.commons.utils;
|
||||
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.channels.FileChannel;
|
||||
|
||||
public class DeFileUtils {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Java文件操作 获取不带扩展名的文件名
|
||||
*/
|
||||
public static String getFileNameNoEx(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot > -1) && (dot < (filename.length()))) {
|
||||
return filename.substring(0, dot);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件扩展名,不带 .
|
||||
*/
|
||||
public static String getExtensionName(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot > -1) && (dot < (filename.length() - 1))) {
|
||||
return filename.substring(dot + 1);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
/**
|
||||
* 将文件名解析成文件的上传路径
|
||||
*/
|
||||
public static File upload(MultipartFile file, String filePath) {
|
||||
String name = getFileNameNoEx(file.getOriginalFilename());
|
||||
String suffix = getExtensionName(file.getOriginalFilename());
|
||||
try {
|
||||
String fileName = name + "." + suffix;
|
||||
String path = filePath + fileName;
|
||||
// getCanonicalFile 可解析正确各种路径
|
||||
File dest = new File(path).getCanonicalFile();
|
||||
// 检测是否存在目录
|
||||
if (!dest.getParentFile().exists()) {
|
||||
if (!dest.getParentFile().mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
// 文件写入
|
||||
// file.transferTo(dest);
|
||||
FileOutputStream fileOutputStream = new FileOutputStream(dest);
|
||||
fileOutputStream.write(file.getBytes());
|
||||
fileOutputStream.flush();
|
||||
fileOutputStream.close();
|
||||
return dest;
|
||||
} catch (Exception e) {
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String copy(File source, String targetDir) throws IOException{
|
||||
String name = source.getName();
|
||||
String destPath = null;
|
||||
if (targetDir.endsWith("/") || targetDir.endsWith("\\")){
|
||||
destPath = targetDir + name;
|
||||
}else{
|
||||
destPath = targetDir + "/" + name;
|
||||
}
|
||||
File DestFile = new File(destPath);
|
||||
if (!DestFile.getParentFile().exists()) {
|
||||
DestFile.getParentFile().mkdirs();
|
||||
}
|
||||
copyFileUsingFileChannels(source, DestFile);
|
||||
return destPath;
|
||||
}
|
||||
|
||||
private static void copyFileUsingFileChannels(File source, File dest) throws IOException {
|
||||
FileChannel inputChannel = null;
|
||||
FileChannel outputChannel = null;
|
||||
try {
|
||||
inputChannel = new FileInputStream(source).getChannel();
|
||||
outputChannel = new FileOutputStream(dest).getChannel();
|
||||
outputChannel.transferFrom(inputChannel, 0, inputChannel.size());
|
||||
} finally {
|
||||
inputChannel.close();
|
||||
outputChannel.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static String readJson(File file) {
|
||||
String str = null;
|
||||
try {
|
||||
FileReader fileReader = new FileReader(file);
|
||||
Reader reader = new InputStreamReader(new FileInputStream(file), "utf-8");
|
||||
int ch=0;
|
||||
StringBuffer sb = new StringBuffer();
|
||||
while ((ch = reader.read()) != -1) {
|
||||
sb.append((char) ch);
|
||||
}
|
||||
fileReader.close();
|
||||
reader.close();
|
||||
str = sb.toString();
|
||||
return str;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,16 +2,23 @@ package io.dataease.commons.utils;
|
||||
|
||||
public class DorisTableUtils {
|
||||
|
||||
public static String dorisName(String datasetId){
|
||||
public static String dorisName(String datasetId) {
|
||||
return "ds_" + datasetId.replace("-", "_");
|
||||
}
|
||||
|
||||
public static String dorisTmpName(String dorisName){
|
||||
public static String dorisTmpName(String dorisName) {
|
||||
return "tmp_" + dorisName;
|
||||
}
|
||||
|
||||
public static String dorisDeleteName(String dorisName){
|
||||
public static String dorisDeleteName(String dorisName) {
|
||||
return "delete_" + dorisName;
|
||||
}
|
||||
|
||||
public static String dorisFieldName(String dorisName) {
|
||||
return "f_" + Md5Utils.md5(dorisName);
|
||||
}
|
||||
|
||||
public static String excelColumnName(String filedName) {
|
||||
return "C_" + Md5Utils.md5(filedName);
|
||||
}
|
||||
}
|
||||
|
||||
72
backend/src/main/java/io/dataease/commons/utils/HttpClientConfig.java
Executable file
72
backend/src/main/java/io/dataease/commons/utils/HttpClientConfig.java
Executable file
@ -0,0 +1,72 @@
|
||||
package io.dataease.commons.utils;
|
||||
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.config.RequestConfig.Builder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpClientConfig {
|
||||
|
||||
// 字符集
|
||||
private String charset = "UTF-8";
|
||||
|
||||
// 请求头
|
||||
private Map<String, String> header = new HashMap<>();
|
||||
|
||||
// 设置连接超时时间,单位毫秒
|
||||
private int connectTimeout = 5000;
|
||||
// 设置从connect Manager获取Connection 超时时间,单位毫秒。这个属性是新加的属性,因为目前版本是可以共享连接池的
|
||||
private int connectionRequestTimeout = 5000;
|
||||
// 请求获取数据的超时时间,单位毫秒。 如果访问一个接口,多少时间内无法返回数据,就直接放弃此次调用
|
||||
private int cocketTimeout = 60000;
|
||||
|
||||
public RequestConfig buildRequestConfig() {
|
||||
Builder builder = RequestConfig.custom();
|
||||
builder.setConnectTimeout(connectTimeout);
|
||||
builder.setConnectionRequestTimeout(connectionRequestTimeout);
|
||||
builder.setSocketTimeout(cocketTimeout);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public String getCharset() {
|
||||
return charset;
|
||||
}
|
||||
|
||||
public void setCharset(String charset) {
|
||||
this.charset = charset;
|
||||
}
|
||||
|
||||
public Map<String, String> getHeader() {
|
||||
return header;
|
||||
}
|
||||
|
||||
public void addHeader(String key, String value) {
|
||||
header.put(key, value);
|
||||
}
|
||||
|
||||
public int getConnectTimeout() {
|
||||
return connectTimeout;
|
||||
}
|
||||
|
||||
public void setConnectTimeout(int connectTimeout) {
|
||||
this.connectTimeout = connectTimeout;
|
||||
}
|
||||
|
||||
public int getConnectionRequestTimeout() {
|
||||
return connectionRequestTimeout;
|
||||
}
|
||||
|
||||
public void setConnectionRequestTimeout(int connectionRequestTimeout) {
|
||||
this.connectionRequestTimeout = connectionRequestTimeout;
|
||||
}
|
||||
|
||||
public int getCocketTimeout() {
|
||||
return cocketTimeout;
|
||||
}
|
||||
|
||||
public void setCocketTimeout(int cocketTimeout) {
|
||||
this.cocketTimeout = cocketTimeout;
|
||||
}
|
||||
|
||||
}
|
||||
207
backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java
Executable file
207
backend/src/main/java/io/dataease/commons/utils/HttpClientUtil.java
Executable file
@ -0,0 +1,207 @@
|
||||
package io.dataease.commons.utils;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.entity.EntityBuilder;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.conn.ssl.NoopHostnameVerifier;
|
||||
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;
|
||||
import org.apache.http.conn.ssl.TrustStrategy;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.protocol.HTTP;
|
||||
import org.apache.http.ssl.SSLContexts;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.net.ssl.HostnameVerifier;
|
||||
import javax.net.ssl.SSLContext;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class HttpClientUtil {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(HttpClientUtil.class);
|
||||
|
||||
private static final String HTTPS = "https";
|
||||
|
||||
/**
|
||||
* 根据url构建HttpClient(区分http和https)
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @return CloseableHttpClient实例
|
||||
*/
|
||||
private static CloseableHttpClient buildHttpClient(String url) {
|
||||
try {
|
||||
if (url.startsWith(HTTPS)) {
|
||||
// https 增加信任设置
|
||||
TrustStrategy trustStrategy = new TrustSelfSignedStrategy();
|
||||
SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(trustStrategy).build();
|
||||
HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE;
|
||||
return HttpClients.custom().setSSLContext(sslContext).setSSLHostnameVerifier(hostnameVerifier).build();
|
||||
} else {
|
||||
// http
|
||||
return HttpClientBuilder.create().build();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("HttpClient构建失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get http请求
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param config 配置项,如果null则使用默认配置
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String get(String url, HttpClientConfig config) {
|
||||
CloseableHttpClient httpClient = buildHttpClient(url);
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
|
||||
if (config == null) {
|
||||
config = new HttpClientConfig();
|
||||
}
|
||||
try {
|
||||
httpGet.setConfig(config.buildRequestConfig());
|
||||
|
||||
Map<String, String> header = config.getHeader();
|
||||
for (String key : header.keySet()) {
|
||||
httpGet.addHeader(key, header.get(key));
|
||||
}
|
||||
|
||||
httpGet.addHeader(HTTP.CONTENT_ENCODING, config.getCharset());
|
||||
|
||||
HttpResponse response = httpClient.execute(httpGet);
|
||||
HttpEntity entity = response.getEntity();
|
||||
return EntityUtils.toString(entity, config.getCharset());
|
||||
} catch (Exception e) {
|
||||
logger.error("HttpClient查询失败", e);
|
||||
throw new RuntimeException("HttpClient查询失败", e);
|
||||
} finally {
|
||||
try {
|
||||
httpClient.close();
|
||||
} catch (Exception e) {
|
||||
logger.error("HttpClient关闭连接失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post请求,请求内容必须为JSON格式的字符串
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param config 配置项,如果null则使用默认配置
|
||||
* @param json JSON格式的字符串
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String post(String url, String json, HttpClientConfig config) {
|
||||
CloseableHttpClient httpClient = buildHttpClient(url);
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
if (config == null) {
|
||||
config = new HttpClientConfig();
|
||||
}
|
||||
try {
|
||||
httpPost.setConfig(config.buildRequestConfig());
|
||||
|
||||
Map<String, String> header = config.getHeader();
|
||||
for (String key : header.keySet()) {
|
||||
httpPost.addHeader(key, header.get(key));
|
||||
}
|
||||
httpPost.addHeader(HTTP.CONTENT_TYPE, "application/json");
|
||||
httpPost.addHeader(HTTP.CONTENT_ENCODING, config.getCharset());
|
||||
|
||||
EntityBuilder entityBuilder = EntityBuilder.create();
|
||||
entityBuilder.setText(json);
|
||||
entityBuilder.setContentType(ContentType.APPLICATION_JSON);
|
||||
entityBuilder.setContentEncoding(config.getCharset());
|
||||
HttpEntity requestEntity = entityBuilder.build();
|
||||
httpPost.setEntity(requestEntity);
|
||||
|
||||
HttpResponse response = httpClient.execute(httpPost);
|
||||
HttpEntity entity = response.getEntity();
|
||||
return EntityUtils.toString(entity, config.getCharset());
|
||||
} catch (Exception e) {
|
||||
logger.error("HttpClient查询失败", e);
|
||||
throw new RuntimeException("HttpClient查询失败", e);
|
||||
} finally {
|
||||
try {
|
||||
httpClient.close();
|
||||
} catch (Exception e) {
|
||||
logger.error("HttpClient关闭连接失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Post请求,请求内容必须为JSON格式的字符串
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param json JSON格式的字符串
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String post(String url, String json) {
|
||||
return HttpClientUtil.post(url, json, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Post请求,请求内容必须为键值对参数
|
||||
*
|
||||
* @param url 请求地址
|
||||
* @param config 配置项,如果null则使用默认配置
|
||||
* @param body 请求内容键值对参数
|
||||
* @return 响应结果字符串
|
||||
*/
|
||||
public static String post(String url, Map<String, String> body, HttpClientConfig config) {
|
||||
CloseableHttpClient httpClient = buildHttpClient(url);
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
if (config == null) {
|
||||
config = new HttpClientConfig();
|
||||
}
|
||||
try {
|
||||
httpPost.setConfig(config.buildRequestConfig());
|
||||
|
||||
Map<String, String> header = config.getHeader();
|
||||
for (String key : header.keySet()) {
|
||||
httpPost.addHeader(key, header.get(key));
|
||||
}
|
||||
httpPost.addHeader(HTTP.CONTENT_ENCODING, config.getCharset());
|
||||
|
||||
if (body != null && body.size() > 0) {
|
||||
List<NameValuePair> nvps = new ArrayList<>();
|
||||
for (String key : body.keySet()) {
|
||||
nvps.add(new BasicNameValuePair(key, body.get(key)));
|
||||
}
|
||||
try {
|
||||
httpPost.setEntity(new UrlEncodedFormEntity(nvps, config.getCharset()));
|
||||
} catch (Exception e) {
|
||||
logger.error("HttpClient转换编码错误", e);
|
||||
throw new RuntimeException("HttpClient转换编码错误", e);
|
||||
}
|
||||
}
|
||||
|
||||
HttpResponse response = httpClient.execute(httpPost);
|
||||
HttpEntity entity = response.getEntity();
|
||||
return EntityUtils.toString(entity, config.getCharset());
|
||||
} catch (Exception e) {
|
||||
logger.error("HttpClient查询失败", e);
|
||||
throw new RuntimeException("HttpClient查询失败", e);
|
||||
} finally {
|
||||
try {
|
||||
httpClient.close();
|
||||
} catch (Exception e) {
|
||||
logger.error("HttpClient关闭连接失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
141
backend/src/main/java/io/dataease/commons/utils/ZipUtils.java
Normal file
141
backend/src/main/java/io/dataease/commons/utils/ZipUtils.java
Normal file
@ -0,0 +1,141 @@
|
||||
package io.dataease.commons.utils;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipException;
|
||||
import java.util.zip.ZipFile;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
public class ZipUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 解压文件
|
||||
*
|
||||
* @param zipFilePath 解压文件路径
|
||||
* @param outputFolder 输出解压文件路径
|
||||
*/
|
||||
public static void unZipIt(String zipFilePath, String outputFolder) {
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
File folder = new File(outputFolder);
|
||||
if (!folder.exists()) {
|
||||
folder.mkdir();
|
||||
}
|
||||
try {
|
||||
//get the zip file content
|
||||
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFilePath));
|
||||
ZipEntry ze = zis.getNextEntry();
|
||||
while (ze != null) {
|
||||
String fileName = ze.getName();
|
||||
File newFile = new File(outputFolder + File.separator + fileName);
|
||||
System.out.println("file unzip : " + newFile.getAbsoluteFile());
|
||||
//大部分网络上的源码,这里没有判断子目录
|
||||
if (ze.isDirectory()) {
|
||||
if (!newFile.mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
} else {
|
||||
if (!new File(newFile.getParent()).mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(newFile);
|
||||
int len;
|
||||
while ((len = zis.read(buffer)) != -1) {
|
||||
fos.write(buffer, 0, len);
|
||||
}
|
||||
fos.close();
|
||||
}
|
||||
ze = zis.getNextEntry();
|
||||
}
|
||||
zis.closeEntry();
|
||||
zis.close();
|
||||
System.out.println("Done");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void unzip(File source, String out) throws IOException {
|
||||
try (ZipInputStream zis = new ZipInputStream(new FileInputStream(source))) {
|
||||
|
||||
ZipEntry entry = zis.getNextEntry();
|
||||
|
||||
while (entry != null) {
|
||||
|
||||
File file = new File(out, entry.getName());
|
||||
|
||||
if (entry.isDirectory()) {
|
||||
if (!file.mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
} else {
|
||||
File parent = file.getParentFile();
|
||||
|
||||
if (!parent.exists()) {
|
||||
if (!parent.mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
|
||||
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))) {
|
||||
|
||||
byte[] buffer = new byte[Math.toIntExact(entry.getSize())];
|
||||
|
||||
int location;
|
||||
|
||||
while ((location = zis.read(buffer)) != -1) {
|
||||
bos.write(buffer, 0, location);
|
||||
}
|
||||
}
|
||||
}
|
||||
entry = zis.getNextEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把所有文件都直接解压到指定目录(忽略子文件夹)
|
||||
*
|
||||
* @param zipFile
|
||||
* @param folderPath
|
||||
* @throws ZipException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void upZipFile(File zipFile, String folderPath) throws ZipException, IOException {
|
||||
File desDir = new File(folderPath);
|
||||
if (!desDir.exists()) {
|
||||
if (!desDir.mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
ZipFile zf = new ZipFile(zipFile);
|
||||
for (Enumeration<?> entries = zf.entries(); entries.hasMoreElements(); ) {
|
||||
ZipEntry entry = ((ZipEntry) entries.nextElement());
|
||||
InputStream in = zf.getInputStream(entry);
|
||||
File desFile = new File(folderPath, java.net.URLEncoder.encode(entry.getName(), "UTF-8"));
|
||||
|
||||
if (!desFile.exists()) {
|
||||
File fileParentDir = desFile.getParentFile();
|
||||
if (!fileParentDir.exists()) {
|
||||
if (!fileParentDir.mkdirs()) {
|
||||
System.out.println("was not successful.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OutputStream out = new FileOutputStream(desFile);
|
||||
byte[] buffer = new byte[1024 * 1024];
|
||||
int realLength = in.read(buffer);
|
||||
while (realLength != -1) {
|
||||
out.write(buffer, 0, realLength);
|
||||
realLength = in.read(buffer);
|
||||
}
|
||||
|
||||
out.close();
|
||||
in.close();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -39,7 +39,7 @@ public class CommonConfig {
|
||||
datasource.setId("doris");
|
||||
datasource.setName("doris");
|
||||
datasource.setDesc("doris");
|
||||
datasource.setType("mysql");
|
||||
datasource.setType("doris");
|
||||
datasource.setConfiguration(jsonObject.toJSONString());
|
||||
return datasource;
|
||||
}
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package io.dataease.controller;
|
||||
|
||||
|
||||
import io.dataease.commons.license.F2CLicenseResponse;
|
||||
import io.dataease.service.AboutService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Map;
|
||||
|
||||
@RequestMapping("/about")
|
||||
@RestController
|
||||
public class AboutController {
|
||||
|
||||
@Resource
|
||||
private AboutService aboutService;
|
||||
|
||||
@PostMapping("/license/update")
|
||||
public F2CLicenseResponse updateLicense(@RequestBody Map<String, String> map) {
|
||||
return aboutService.updateLicense(map.get("license"));
|
||||
}
|
||||
|
||||
@PostMapping("/license/validate")
|
||||
public F2CLicenseResponse validateLicense(@RequestBody Map<String, String> map) {
|
||||
return aboutService.validateLicense(map.get("license"));
|
||||
}
|
||||
|
||||
@GetMapping("/build/version")
|
||||
public Object getBuildVersion() {
|
||||
return aboutService.getBuildVersion();
|
||||
}
|
||||
}
|
||||
@ -27,8 +27,6 @@ public class I18nController {
|
||||
@Value("${run.mode:release}")
|
||||
private String runMode;
|
||||
|
||||
// @Resource
|
||||
// private UserService userService;
|
||||
|
||||
@GetMapping("lang/change/{lang}")
|
||||
public void changeLang(@PathVariable String lang, HttpServletRequest request, HttpServletResponse response) {
|
||||
@ -38,14 +36,13 @@ public class I18nController {
|
||||
LogUtil.error("Invalid parameter: " + lang);
|
||||
DEException.throwException(Translator.get("error_lang_invalid"));
|
||||
}
|
||||
// userService.setLanguage(targetLang.getDesc());
|
||||
Cookie cookie = new Cookie(I18nConstants.LANG_COOKIE_NAME, targetLang.getDesc());
|
||||
cookie.setPath("/");
|
||||
cookie.setMaxAge(FOR_EVER);
|
||||
response.addCookie(cookie);
|
||||
//重新登录
|
||||
if ("release".equals(runMode)) {
|
||||
Cookie f2cCookie = new Cookie("MS_SESSION_ID", "deleteMe");
|
||||
Cookie f2cCookie = new Cookie("DE_SESSION_ID", "deleteMe");
|
||||
f2cCookie.setPath("/");
|
||||
f2cCookie.setMaxAge(0);
|
||||
response.addCookie(f2cCookie);
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
package io.dataease.controller;
|
||||
|
||||
|
||||
|
||||
import io.dataease.commons.license.DefaultLicenseService;
|
||||
import io.dataease.commons.license.F2CLicenseResponse;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping(headers = "Accept=application/json")
|
||||
public class LicenseController {
|
||||
|
||||
@Value("${dataease.need_validate_lic:true}")
|
||||
private Boolean need_validate_lic;
|
||||
|
||||
@Resource
|
||||
private DefaultLicenseService defaultLicenseService;
|
||||
|
||||
@GetMapping(value = "anonymous/license/validate")
|
||||
public ResultHolder validateLicense() throws Exception {
|
||||
if (!need_validate_lic) {
|
||||
return ResultHolder.success(null);
|
||||
}
|
||||
/* License license = defaultLicenseService.readLicense();
|
||||
if(StringUtils.isEmpty(license.getF2cLicense())){
|
||||
throw new Exception("Invalid License.");
|
||||
}
|
||||
F2CLicenseResponse f2CLicenseResponse = new Gson().fromJson(license.getF2cLicense(), F2CLicenseResponse.class);*/
|
||||
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.validateLicense();
|
||||
switch (f2CLicenseResponse.getStatus()) {
|
||||
case valid:
|
||||
return ResultHolder.success(null);
|
||||
case expired:
|
||||
String expired = f2CLicenseResponse.getLicense().getExpired();
|
||||
throw new Exception("License has expired since " + expired + ", please update license.");
|
||||
case invalid:
|
||||
throw new Exception(f2CLicenseResponse.getMessage());
|
||||
default:
|
||||
throw new Exception("Invalid License.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6,8 +6,13 @@ import io.dataease.commons.constants.RoleConstants;
|
||||
import io.dataease.dto.BaseSystemConfigDTO;
|
||||
import io.dataease.dto.SystemParameterDTO;
|
||||
import io.dataease.notice.domain.MailInfo;
|
||||
import io.dataease.service.FileService;
|
||||
import io.dataease.service.system.SystemParameterService;
|
||||
import org.apache.shiro.authz.annotation.RequiresRoles;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@ -23,6 +28,9 @@ public class SystemParameterController {
|
||||
@Resource
|
||||
private SystemParameterService systemParameterService;
|
||||
|
||||
@Resource
|
||||
private FileService fileService;
|
||||
|
||||
@PostMapping("/edit/email")
|
||||
public void editMail(@RequestBody List<SystemParameter> systemParameter) {
|
||||
systemParameterService.editMail(systemParameter);
|
||||
@ -54,8 +62,16 @@ public class SystemParameterController {
|
||||
return systemParameterService.getSystemParameterInfo(ParamConstants.Classify.UI.getValue());
|
||||
}
|
||||
|
||||
@GetMapping(value="/ui/image/{imageId}", produces = {MediaType.IMAGE_JPEG_VALUE, MediaType.IMAGE_PNG_VALUE})
|
||||
public ResponseEntity<byte[]> image(@PathVariable("imageId") String imageId) {
|
||||
byte[] bytes = fileService.loadFileAsBytes(imageId);
|
||||
final HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.IMAGE_PNG);
|
||||
return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping(value="/save/ui", consumes = {"multipart/form-data"})
|
||||
public void saveUIInfo (@RequestPart("request") Map<String,List<SystemParameterDTO>> systemParameterMap,@RequestPart(value = "files") List<MultipartFile> bodyFiles) throws IOException {
|
||||
public void saveUIInfo (@RequestPart("request") Map<String,List<SystemParameterDTO>> systemParameterMap,@RequestPart(value = "files", required = false) List<MultipartFile> bodyFiles) throws IOException {
|
||||
systemParameterService.saveUIInfo(systemParameterMap,bodyFiles);
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import io.dataease.base.domain.DatasetGroup;
|
||||
import io.dataease.controller.request.dataset.DataSetGroupRequest;
|
||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||
import io.dataease.service.dataset.DataSetGroupService;
|
||||
import io.dataease.service.dataset.ExtractDataService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -18,7 +19,8 @@ import java.util.List;
|
||||
public class DataSetGroupController {
|
||||
@Resource
|
||||
private DataSetGroupService dataSetGroupService;
|
||||
|
||||
@Resource
|
||||
private ExtractDataService extractDataService;
|
||||
@PostMapping("/save")
|
||||
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) {
|
||||
return dataSetGroupService.save(datasetGroup);
|
||||
@ -30,7 +32,7 @@ public class DataSetGroupController {
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
public void tree(@PathVariable String id) {
|
||||
public void tree(@PathVariable String id) throws Exception{
|
||||
dataSetGroupService.delete(id);
|
||||
}
|
||||
|
||||
@ -38,4 +40,9 @@ public class DataSetGroupController {
|
||||
public DatasetGroup getScene(@PathVariable String id) {
|
||||
return dataSetGroupService.getScene(id);
|
||||
}
|
||||
|
||||
@PostMapping("/isKettleRunning")
|
||||
public boolean isKettleRunning(){
|
||||
return extractDataService.isKettleRunning();
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ public class DataSetTableController {
|
||||
}
|
||||
|
||||
@PostMapping("delete/{id}")
|
||||
public void delete(@PathVariable String id) {
|
||||
public void delete(@PathVariable String id) throws Exception {
|
||||
dataSetTableService.delete(id);
|
||||
}
|
||||
|
||||
@ -59,11 +59,6 @@ public class DataSetTableController {
|
||||
return dataSetTableService.getFieldsFromDE(dataSetTableRequest);
|
||||
}
|
||||
|
||||
@PostMapping("getData")
|
||||
public List<String[]> getData(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||
return dataSetTableService.getData(dataSetTableRequest);
|
||||
}
|
||||
|
||||
@PostMapping("getPreviewData/{page}/{pageSize}")
|
||||
public Map<String, Object> getPreviewData(@RequestBody DataSetTableRequest dataSetTableRequest, @PathVariable Integer page, @PathVariable Integer pageSize) throws Exception {
|
||||
return dataSetTableService.getPreviewData(dataSetTableRequest, page, pageSize);
|
||||
@ -74,6 +69,11 @@ public class DataSetTableController {
|
||||
return dataSetTableService.getSQLPreview(dataSetTableRequest);
|
||||
}
|
||||
|
||||
@PostMapping("customPreview")
|
||||
public Map<String, Object> customPreview(@RequestBody DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||
return dataSetTableService.getCustomPreview(dataSetTableRequest);
|
||||
}
|
||||
|
||||
@PostMapping("incrementalConfig")
|
||||
public DatasetTableIncrementalConfig incrementalConfig(@RequestBody DatasetTableIncrementalConfig datasetTableIncrementalConfig) throws Exception {
|
||||
return dataSetTableService.incrementalConfig(datasetTableIncrementalConfig);
|
||||
@ -93,4 +93,9 @@ public class DataSetTableController {
|
||||
public Map<String, Object> excelUpload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
return dataSetTableService.excelSaveAndParse(file);
|
||||
}
|
||||
|
||||
@PostMapping("checkDorisTableIsExists/{id}")
|
||||
public Boolean checkDorisTableIsExists(@PathVariable String id) throws Exception {
|
||||
return dataSetTableService.checkDorisTableIsExists(id);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package io.dataease.controller.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableTask;
|
||||
import io.dataease.controller.request.dataset.DataSetTaskRequest;
|
||||
import io.dataease.service.dataset.DataSetTableService;
|
||||
import io.dataease.service.dataset.DataSetTableTaskService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -16,10 +18,13 @@ import java.util.List;
|
||||
public class DataSetTableTaskController {
|
||||
@Resource
|
||||
private DataSetTableTaskService dataSetTableTaskService;
|
||||
@Resource
|
||||
private DataSetTableService dataSetTableService;
|
||||
|
||||
@PostMapping("save")
|
||||
public DatasetTableTask save(@RequestBody DatasetTableTask datasetTableTask) throws Exception {
|
||||
return dataSetTableTaskService.save(datasetTableTask);
|
||||
public DatasetTableTask save(@RequestBody DataSetTaskRequest dataSetTaskRequest) throws Exception {
|
||||
dataSetTableService.saveIncrementalConfig(dataSetTaskRequest.getDatasetTableIncrementalConfig());
|
||||
return dataSetTableTaskService.save(dataSetTaskRequest.getDatasetTableTask());
|
||||
}
|
||||
|
||||
@PostMapping("delete/{id}")
|
||||
|
||||
@ -1,8 +1,17 @@
|
||||
package io.dataease.controller.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.JavaBeanSerializer;
|
||||
import com.alibaba.fastjson.serializer.ObjectSerializer;
|
||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.commons.constants.I18nConstants;
|
||||
import io.dataease.controller.ResultHolder;
|
||||
import io.dataease.controller.handler.annotation.I18n;
|
||||
import io.dataease.controller.handler.annotation.NoResultHolder;
|
||||
import io.dataease.i18n.Translator;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
@ -13,6 +22,10 @@ import org.springframework.http.server.ServerHttpResponse;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 统一处理返回结果集
|
||||
*/
|
||||
@ -35,6 +48,12 @@ public class ResultResponseBodyAdvice implements ResponseBodyAdvice<Object> {
|
||||
return o;
|
||||
}
|
||||
|
||||
//if true, need to translate
|
||||
if (methodParameter.hasMethodAnnotation(I18n.class)) {
|
||||
I18n i18n = methodParameter.getMethodAnnotation(I18n.class);
|
||||
o = translate(o, i18n.value());
|
||||
}
|
||||
|
||||
if (!(o instanceof ResultHolder)) {
|
||||
if (o instanceof String) {
|
||||
return new Gson().toJson(ResultHolder.success(o));
|
||||
@ -44,4 +63,11 @@ public class ResultResponseBodyAdvice implements ResponseBodyAdvice<Object> {
|
||||
return o;
|
||||
}
|
||||
|
||||
|
||||
// i18n
|
||||
private Object translate(Object obj, String type) {
|
||||
return Translator.translateObject(obj);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package io.dataease.controller.handler.annotation;
|
||||
|
||||
|
||||
import io.dataease.commons.constants.I18nConstants;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Documented
|
||||
@Inherited
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface I18n {
|
||||
String value() default I18nConstants.LANG_COOKIE_NAME;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package io.dataease.controller.request.dataset;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableIncrementalConfig;
|
||||
import io.dataease.base.domain.DatasetTableTask;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Setter
|
||||
@Getter
|
||||
public class DataSetTaskRequest {
|
||||
private DatasetTableTask datasetTableTask;
|
||||
private DatasetTableIncrementalConfig datasetTableIncrementalConfig;
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package io.dataease.controller.sys;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.dataease.base.domain.MyPlugin;
|
||||
import io.dataease.commons.utils.PageUtils;
|
||||
import io.dataease.commons.utils.Pager;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.service.sys.PluginService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:插件管理")
|
||||
@RequestMapping("/api/plugin")
|
||||
public class SysPluginController {
|
||||
|
||||
@Autowired
|
||||
private PluginService pluginService;
|
||||
|
||||
@ApiOperation("查询已安装插件")
|
||||
@PostMapping("/pluginGrid/{goPage}/{pageSize}")
|
||||
public Pager<List<MyPlugin>> pluginGrid(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody BaseGridRequest request) {
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, pluginService.query(request));
|
||||
}
|
||||
|
||||
@PostMapping("upload")
|
||||
public Map<String, Object> localUpload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
return pluginService.localInstall(file);
|
||||
}
|
||||
}
|
||||
@ -3,6 +3,8 @@ package io.dataease.controller.sys;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.PageUtils;
|
||||
import io.dataease.commons.utils.Pager;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
@ -17,6 +19,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "系统:用户管理")
|
||||
@ -73,4 +76,29 @@ public class SysUserController {
|
||||
public void adminUpdatePwd(@RequestBody SysUserPwdRequest request){
|
||||
sysUserService.adminUpdatePwd(request);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("个人信息")
|
||||
@PostMapping("/personInfo")
|
||||
public CurrentUserDto personInfo() {
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
return user;
|
||||
}
|
||||
|
||||
@ApiOperation("更新个人信息")
|
||||
@PostMapping("/updatePersonInfo")
|
||||
public void updatePersonInfo(@RequestBody SysUserCreateRequest request){
|
||||
sysUserService.updatePersonInfo(request);
|
||||
}
|
||||
|
||||
@ApiOperation("设置语言")
|
||||
@PostMapping("/setLanguage/{language}")
|
||||
public void setLanguage(@PathVariable String language) {
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
Optional.ofNullable(language).ifPresent(currentLanguage -> {
|
||||
if (!currentLanguage.equals(user.getLanguage())) {
|
||||
sysUserService.setLanguage(user.getUserId(), currentLanguage);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
package io.dataease.datasource.constants;
|
||||
|
||||
public enum DatasourceTypes {
|
||||
mysql, sqlServer, excel
|
||||
mysql, sqlServer, excel, doris
|
||||
}
|
||||
|
||||
@ -20,6 +20,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
private static Map<String, ComboPooledDataSource> jdbcConnection = new HashMap<>();
|
||||
private static int initPoolSize = 5;
|
||||
private static int maxConnections = 200;
|
||||
|
||||
@Override
|
||||
public List<String[]> getData(DatasourceRequest datasourceRequest) throws Exception {
|
||||
List<String[]> list = new LinkedList<>();
|
||||
@ -33,7 +34,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
return list;
|
||||
@ -50,7 +51,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
@ -68,7 +69,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
@ -108,7 +109,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
@ -133,7 +134,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
@ -173,7 +174,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
return tables;
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR: " + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
con.close();
|
||||
}
|
||||
}
|
||||
@ -209,7 +210,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
return list;
|
||||
@ -227,7 +228,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
ps.close();
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR: " + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
con.close();
|
||||
}
|
||||
}
|
||||
@ -236,20 +237,21 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
public Long count(DatasourceRequest datasourceRequest) throws Exception {
|
||||
Connection con = null;
|
||||
try {
|
||||
con = getConnectionFromPool(datasourceRequest); Statement ps = con.createStatement();
|
||||
con = getConnectionFromPool(datasourceRequest);
|
||||
Statement ps = con.createStatement();
|
||||
ResultSet resultSet = ps.executeQuery(datasourceRequest.getQuery());
|
||||
while (resultSet.next()) {
|
||||
return resultSet.getLong(1);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR: " + e.getMessage(), e);
|
||||
}finally {
|
||||
} finally {
|
||||
con.close();
|
||||
}
|
||||
return 0L;
|
||||
}
|
||||
|
||||
private Connection getConnectionFromPool(DatasourceRequest datasourceRequest)throws Exception {
|
||||
private Connection getConnectionFromPool(DatasourceRequest datasourceRequest) throws Exception {
|
||||
ComboPooledDataSource dataSource = jdbcConnection.get(datasourceRequest.getDatasource().getId());
|
||||
if (dataSource == null) {
|
||||
initDataSource(datasourceRequest);
|
||||
@ -260,7 +262,7 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initDataSource(DatasourceRequest datasourceRequest)throws Exception{
|
||||
public void initDataSource(DatasourceRequest datasourceRequest) throws Exception {
|
||||
ComboPooledDataSource dataSource = jdbcConnection.get(datasourceRequest.getDatasource().getId());
|
||||
if (dataSource == null) {
|
||||
dataSource = new ComboPooledDataSource();
|
||||
@ -298,6 +300,13 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
driver = mysqlConfigration.getDriver();
|
||||
jdbcurl = mysqlConfigration.getJdbc();
|
||||
break;
|
||||
case doris:
|
||||
MysqlConfigration dorisConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfigration.class);
|
||||
username = dorisConfigration.getUsername();
|
||||
password = dorisConfigration.getPassword();
|
||||
driver = dorisConfigration.getDriver();
|
||||
jdbcurl = dorisConfigration.getJdbc();
|
||||
break;
|
||||
case sqlServer:
|
||||
SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfigration.class);
|
||||
username = sqlServerConfigration.getUsername();
|
||||
@ -319,26 +328,33 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
}
|
||||
|
||||
|
||||
private void setCredential(DatasourceRequest datasourceRequest, ComboPooledDataSource dataSource) throws PropertyVetoException {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(datasourceRequest.getDatasource().getType());
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
MysqlConfigration mysqlConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfigration.class);
|
||||
dataSource.setUser(mysqlConfigration.getUsername());
|
||||
dataSource.setDriverClass(mysqlConfigration.getDriver());
|
||||
dataSource.setPassword(mysqlConfigration.getPassword());
|
||||
dataSource.setJdbcUrl(mysqlConfigration.getJdbc());
|
||||
break;
|
||||
case sqlServer:
|
||||
SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfigration.class);
|
||||
dataSource.setUser(sqlServerConfigration.getUsername());
|
||||
dataSource.setDriverClass(sqlServerConfigration.getDriver());
|
||||
dataSource.setPassword(sqlServerConfigration.getPassword());
|
||||
dataSource.setJdbcUrl(sqlServerConfigration.getJdbc());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
private void setCredential(DatasourceRequest datasourceRequest, ComboPooledDataSource dataSource) throws PropertyVetoException {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(datasourceRequest.getDatasource().getType());
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
MysqlConfigration mysqlConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfigration.class);
|
||||
dataSource.setUser(mysqlConfigration.getUsername());
|
||||
dataSource.setDriverClass(mysqlConfigration.getDriver());
|
||||
dataSource.setPassword(mysqlConfigration.getPassword());
|
||||
dataSource.setJdbcUrl(mysqlConfigration.getJdbc());
|
||||
break;
|
||||
case doris:
|
||||
MysqlConfigration dorisConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfigration.class);
|
||||
dataSource.setUser(dorisConfigration.getUsername());
|
||||
dataSource.setDriverClass(dorisConfigration.getDriver());
|
||||
dataSource.setPassword(dorisConfigration.getPassword());
|
||||
dataSource.setJdbcUrl(dorisConfigration.getJdbc());
|
||||
break;
|
||||
case sqlServer:
|
||||
SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfigration.class);
|
||||
dataSource.setUser(sqlServerConfigration.getUsername());
|
||||
dataSource.setDriverClass(sqlServerConfigration.getDriver());
|
||||
dataSource.setPassword(sqlServerConfigration.getPassword());
|
||||
dataSource.setJdbcUrl(sqlServerConfigration.getJdbc());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private String getDatabase(DatasourceRequest datasourceRequest) {
|
||||
@ -347,6 +363,9 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
case mysql:
|
||||
MysqlConfigration mysqlConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfigration.class);
|
||||
return mysqlConfigration.getDataBase();
|
||||
case doris:
|
||||
MysqlConfigration dorisConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), MysqlConfigration.class);
|
||||
return dorisConfigration.getDataBase();
|
||||
case sqlServer:
|
||||
SqlServerConfigration sqlServerConfigration = new Gson().fromJson(datasourceRequest.getDatasource().getConfiguration(), SqlServerConfigration.class);
|
||||
return sqlServerConfigration.getDataBase();
|
||||
@ -360,6 +379,8 @@ public class JdbcProvider extends DatasourceProvider {
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
return "show tables;";
|
||||
case doris:
|
||||
return "show tables;";
|
||||
case sqlServer:
|
||||
return "SELECT TABLE_NAME FROM fit2cloud2.INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE';";
|
||||
default:
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
package io.dataease.datasource.provider;
|
||||
|
||||
import io.dataease.datasource.constants.DatasourceTypes;
|
||||
import io.dataease.provider.DDLProvider;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
|
||||
@Component
|
||||
public class ProviderFactory implements ApplicationContextAware {
|
||||
|
||||
@ -18,18 +19,46 @@ public class ProviderFactory implements ApplicationContextAware {
|
||||
this.context = applicationContext;
|
||||
}
|
||||
|
||||
public static DatasourceProvider getProvider(String type){
|
||||
public static DatasourceProvider getProvider(String type) {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(type);
|
||||
switch (datasourceType){
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
return context.getBean("jdbc", DatasourceProvider.class);
|
||||
case doris:
|
||||
return context.getBean("jdbc", DatasourceProvider.class);
|
||||
case sqlServer:
|
||||
return context.getBean("jdbc", DatasourceProvider.class);
|
||||
default:
|
||||
return context.getBean("jdbc", DatasourceProvider.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static QueryProvider getQueryProvider(String type) {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(type);
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
return context.getBean("mysqlQuery", QueryProvider.class);
|
||||
case doris:
|
||||
return context.getBean("dorisQuery", QueryProvider.class);
|
||||
case sqlServer:
|
||||
return context.getBean("mysqlQuery", QueryProvider.class);
|
||||
default:
|
||||
return context.getBean("mysqlQuery", QueryProvider.class);
|
||||
}
|
||||
}
|
||||
|
||||
public static DDLProvider getDDLProvider(String type) {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(type);
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
return context.getBean("mysqlDDL", DDLProvider.class);
|
||||
case doris:
|
||||
return context.getBean("dorisDDL", DDLProvider.class);
|
||||
case sqlServer:
|
||||
return context.getBean("mysqlDDL", DDLProvider.class);
|
||||
default:
|
||||
return context.getBean("mysqlDDL", DDLProvider.class);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ public class DatasourceService {
|
||||
dbTableDTO.setDatasetPath(null);
|
||||
for (DatasetTable datasetTable : datasetTables) {
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class);
|
||||
if (StringUtils.equals(name, dataTableInfoDTO.getTable())) {
|
||||
if (StringUtils.equals(name, dataTableInfoDTO.getTable()) && StringUtils.equals(datasetTable.getCreateBy(), AuthUtils.getUser().getUsername())) {
|
||||
dbTableDTO.setEnableCheck(false);
|
||||
|
||||
List<DatasetGroup> parents = dataSetGroupService.getParents(datasetTable.getSceneId());
|
||||
|
||||
@ -17,6 +17,8 @@ public class ChartViewFieldDTO implements Serializable {
|
||||
|
||||
private String originName;
|
||||
|
||||
private String dataeaseName;
|
||||
|
||||
private String name;
|
||||
|
||||
private String type;
|
||||
@ -34,4 +36,6 @@ public class ChartViewFieldDTO implements Serializable {
|
||||
private String sort;
|
||||
|
||||
private List<ChartViewFieldFilterDTO> filter;
|
||||
|
||||
private Integer deExtractType;
|
||||
}
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package io.dataease.dto.dataset;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/5/9 10:08 上午
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
public class DataTableInfoCustomUnion {
|
||||
private String tableId;
|
||||
private List<String> checkedFields;
|
||||
}
|
||||
@ -3,6 +3,8 @@ package io.dataease.dto.dataset;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/2/23 8:47 下午
|
||||
@ -13,4 +15,5 @@ public class DataTableInfoDTO {
|
||||
private String table;
|
||||
private String sql;
|
||||
private String data;// file path
|
||||
private List<DataTableInfoCustomUnion> list;
|
||||
}
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package io.dataease.exception;
|
||||
|
||||
public class DataEaseException extends RuntimeException {
|
||||
|
||||
private DataEaseException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
private DataEaseException(Throwable t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
public static void throwException(String message) {
|
||||
throw new DataEaseException(message);
|
||||
}
|
||||
|
||||
public static DataEaseException getException(String message) {
|
||||
throw new DataEaseException(message);
|
||||
}
|
||||
|
||||
public static void throwException(Throwable t) {
|
||||
throw new DataEaseException(t);
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,31 @@
|
||||
package io.dataease.i18n;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.serializer.JavaBeanSerializer;
|
||||
import com.alibaba.fastjson.serializer.ObjectSerializer;
|
||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import io.dataease.exception.DataEaseException;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.commons.text.StringSubstitutor;
|
||||
import org.springframework.context.MessageSource;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
public class Translator {
|
||||
private static MessageSource messageSource;
|
||||
private static final String JSON_SYMBOL = "\":";
|
||||
private static final HashSet<String> IGNORE_KEYS = new HashSet<>(Arrays.asList("id", "password", "passwd"));
|
||||
|
||||
|
||||
@Resource
|
||||
public void setMessageSource(MessageSource messageSource) {
|
||||
@ -17,6 +36,117 @@ public class Translator {
|
||||
* 单Key翻译
|
||||
*/
|
||||
public static String get(String key) {
|
||||
return messageSource.getMessage(key, null, "Not Support Key: " + key, LocaleContextHolder.getLocale());
|
||||
System.out.println(LocaleContextHolder.getLocale());
|
||||
return messageSource.getMessage(key, null, key, LocaleContextHolder.getLocale());
|
||||
}
|
||||
|
||||
private static Object translateRawString(String key, String rawString) {
|
||||
if (StringUtils.isBlank(rawString)) {
|
||||
return rawString;
|
||||
}
|
||||
for (String ignoreKey : IGNORE_KEYS) {
|
||||
if (StringUtils.containsIgnoreCase(key, ignoreKey)) {
|
||||
return rawString;
|
||||
}
|
||||
}
|
||||
|
||||
if (key != null) {
|
||||
String desc = get(rawString);
|
||||
if (StringUtils.isNotBlank(desc)) {
|
||||
return desc;
|
||||
}
|
||||
}
|
||||
return rawString;
|
||||
}
|
||||
|
||||
public static Object translateObject(Object javaObject) {
|
||||
if (javaObject == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
if (javaObject instanceof String) {
|
||||
String rawString = javaObject.toString();
|
||||
if (StringUtils.contains(rawString, JSON_SYMBOL)) {
|
||||
try {
|
||||
Object jsonObject = JSON.parse(rawString);
|
||||
Object a = translateObject(jsonObject);
|
||||
return JSON.toJSONString(a);
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("Failed to translate object: " + rawString, e);
|
||||
e.printStackTrace();
|
||||
LogUtil.warn("Failed to translate object " + rawString + ". Error: " + ExceptionUtils.getStackTrace(e));
|
||||
return translateRawString(null, rawString);
|
||||
}
|
||||
|
||||
} else {
|
||||
return translateRawString(null, rawString);
|
||||
}
|
||||
}
|
||||
if (javaObject instanceof Map) {
|
||||
Map<Object, Object> map = (Map<Object, Object>) javaObject;
|
||||
for (Map.Entry<Object, Object> entry : map.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
if (entry.getValue() instanceof String) {
|
||||
if (StringUtils.contains(entry.getValue().toString(), JSON_SYMBOL)) {
|
||||
map.put(entry.getKey(), translateObject(entry.getValue()));
|
||||
} else {
|
||||
map.put(entry.getKey(), translateRawString(entry.getKey().toString(), entry.getValue().toString()));
|
||||
}
|
||||
} else {
|
||||
translateObject(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (javaObject instanceof Collection) {
|
||||
Collection<Object> collection = (Collection<Object>) javaObject;
|
||||
for (Object item : collection) {
|
||||
translateObject(item);
|
||||
}
|
||||
}
|
||||
|
||||
if (javaObject.getClass().isArray()) {
|
||||
for (int i = 0; i < Array.getLength(javaObject); ++i) {
|
||||
Object item = Array.get(javaObject, i);
|
||||
Array.set(javaObject, i, translateObject(item));
|
||||
}
|
||||
}
|
||||
|
||||
ObjectSerializer serializer = SerializeConfig.globalInstance.getObjectWriter(javaObject.getClass());
|
||||
if (serializer instanceof JavaBeanSerializer) {
|
||||
JavaBeanSerializer javaBeanSerializer = (JavaBeanSerializer) serializer;
|
||||
|
||||
try {
|
||||
Map<String, Object> values = javaBeanSerializer.getFieldValuesMap(javaObject);
|
||||
for (Map.Entry<String, Object> entry : values.entrySet()) {
|
||||
if (entry.getValue() != null) {
|
||||
if (entry.getValue() instanceof String) {
|
||||
if (StringUtils.contains(entry.getValue().toString(), JSON_SYMBOL)) {
|
||||
BeanUtils.setFieldValueByName(javaObject, entry.getKey(), translateObject(entry.getValue()), String.class);
|
||||
} else {
|
||||
BeanUtils.setFieldValueByName(javaObject, entry.getKey(), translateRawString(entry.getKey(), entry.getValue().toString()), String.class);
|
||||
}
|
||||
} else {
|
||||
translateObject(entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
DataEaseException.throwException(e);
|
||||
}
|
||||
}
|
||||
|
||||
return javaObject;
|
||||
} catch (StackOverflowError stackOverflowError) {
|
||||
try {
|
||||
return JSON.parseObject(translateRawString(null, JSON.toJSONString(javaObject)).toString(), javaObject.getClass());
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("Failed to translate object " + javaObject.toString(), e);
|
||||
return javaObject;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package io.dataease.plugins.config;
|
||||
|
||||
import io.dataease.plugins.loader.ClassloaderResponsity;
|
||||
import io.dataease.plugins.loader.ModuleClassLoader;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class LoadjarUtil {
|
||||
|
||||
public List<?> loadJar(String jarPath){
|
||||
File jar = new File(jarPath);
|
||||
URI uri = jar.toURI();
|
||||
String moduleName = jarPath.substring(jarPath.lastIndexOf("/")+1,jarPath.lastIndexOf("."));
|
||||
try {
|
||||
|
||||
if(ClassloaderResponsity.getInstance().containsClassLoader(moduleName)){
|
||||
ClassloaderResponsity.getInstance().removeClassLoader(moduleName);
|
||||
}
|
||||
|
||||
ModuleClassLoader classLoader = new ModuleClassLoader(new URL[]{uri.toURL()}, Thread.currentThread().getContextClassLoader());
|
||||
SpringContextUtil.getBeanFactory().setBeanClassLoader(classLoader);
|
||||
Thread.currentThread().setContextClassLoader(classLoader);
|
||||
classLoader.initBean();
|
||||
ClassloaderResponsity.getInstance().addClassLoader(moduleName,classLoader);
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return SpringContextUtil.getAllBean();
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> deleteModule(String moduleName){
|
||||
if(ClassloaderResponsity.getInstance().containsClassLoader(moduleName)){
|
||||
ClassloaderResponsity.getInstance().removeClassLoader(moduleName);
|
||||
}
|
||||
return beans();
|
||||
}
|
||||
public List<Map<String, Object>> beans(){
|
||||
return SpringContextUtil.getAllBean();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,85 @@
|
||||
package io.dataease.plugins.config;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class SpringContextUtil implements ApplicationContextAware {
|
||||
|
||||
//获取bean工厂,用来实现动态注入bean
|
||||
//不能使用其他类加载器加载bean
|
||||
//否则会出现异常:类未找到,类未定义
|
||||
public static DefaultListableBeanFactory getBeanFactory(){
|
||||
return (DefaultListableBeanFactory) getApplicationContext().getAutowireCapableBeanFactory();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static List<Map<String, Object>> getAllBean() {
|
||||
|
||||
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
|
||||
|
||||
String[] beans = getApplicationContext()
|
||||
.getBeanDefinitionNames();
|
||||
|
||||
for (String beanName : beans) {
|
||||
Class<?> beanType = getApplicationContext()
|
||||
.getType(beanName);
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
map.put("BeanName", beanName);
|
||||
map.put("beanType", beanType);
|
||||
map.put("package", beanType.getPackage());
|
||||
list.add(map);
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 上下文对象实例
|
||||
*/
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取applicationContext
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static ApplicationContext getApplicationContext() {
|
||||
return applicationContext;
|
||||
}
|
||||
|
||||
|
||||
public static Object getBean(String name) {
|
||||
return getApplicationContext().getBean(name);
|
||||
}
|
||||
|
||||
public static <T> T getBean(Class<T> clazz) {
|
||||
return getApplicationContext().getBean(clazz);
|
||||
}
|
||||
|
||||
public static <T> T getBean(String name, Class<T> clazz) {
|
||||
return getApplicationContext().getBean(name, clazz);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package io.dataease.plugins.loader;
|
||||
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class ClassloaderResponsity {
|
||||
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(ClassloaderResponsity.class);
|
||||
|
||||
private ClassloaderResponsity(){}
|
||||
|
||||
|
||||
private Map<String,ModuleClassLoader> responsityMap = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
|
||||
public void addClassLoader(String moduleName,ModuleClassLoader moduleClassLoader){
|
||||
responsityMap.put(moduleName,moduleClassLoader);
|
||||
}
|
||||
|
||||
public boolean containsClassLoader(String key){
|
||||
return responsityMap.containsKey(key);
|
||||
}
|
||||
|
||||
public ModuleClassLoader getClassLoader(String key){
|
||||
return responsityMap.get(key);
|
||||
}
|
||||
|
||||
public void removeClassLoader(String moduleName){
|
||||
ModuleClassLoader moduleClassLoader = responsityMap.get(moduleName);
|
||||
try {
|
||||
List<String> registeredBean = moduleClassLoader.getRegisteredBean();
|
||||
|
||||
for (String beanName : registeredBean) {
|
||||
logger.info("删除bean:"+beanName);
|
||||
SpringContextUtil.getBeanFactory().removeBeanDefinition(beanName);
|
||||
}
|
||||
|
||||
moduleClassLoader.close();
|
||||
responsityMap.remove(moduleName);
|
||||
|
||||
} catch (IOException e) {
|
||||
logger.error("删除"+moduleName+"模块发生错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static class ClassloaderResponsityHodler{
|
||||
private static ClassloaderResponsity instamce = new ClassloaderResponsity();
|
||||
}
|
||||
|
||||
public static ClassloaderResponsity getInstance(){
|
||||
return ClassloaderResponsityHodler.instamce;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,189 @@
|
||||
package io.dataease.plugins.loader;
|
||||
|
||||
import io.dataease.plugins.config.SpringContextUtil;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Repository;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.*;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
public class ModuleClassLoader extends URLClassLoader {
|
||||
|
||||
//属于本类加载器加载的jar包
|
||||
private JarFile jarFile;
|
||||
|
||||
//保存已经加载过的Class对象
|
||||
private Map<String,Class> cacheClassMap = new HashMap<>();
|
||||
|
||||
//保存本类加载器加载的class字节码
|
||||
private Map<String,byte[]> classBytesMap = new HashMap<>();
|
||||
|
||||
//需要注册的spring bean的name集合
|
||||
private List<String> registeredBean = new ArrayList<>();
|
||||
|
||||
|
||||
//构造
|
||||
public ModuleClassLoader(URL[] urls, ClassLoader parent) {
|
||||
super(urls, parent);
|
||||
URL url = urls[0];
|
||||
String path = url.getPath();
|
||||
try {
|
||||
jarFile = new JarFile(path);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//初始化类加载器执行类加载
|
||||
init();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//重写loadClass方法
|
||||
//改写loadClass方式
|
||||
@Override
|
||||
public Class<?> loadClass(String name) throws ClassNotFoundException {
|
||||
if(findLoadedClass(name)==null){
|
||||
return super.loadClass(name);
|
||||
}else{
|
||||
return cacheClassMap.get(name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 方法描述 初始化类加载器,保存字节码
|
||||
* @method init
|
||||
*/
|
||||
private void init() {
|
||||
|
||||
//解析jar包每一项
|
||||
Enumeration<JarEntry> en = jarFile.entries();
|
||||
InputStream input = null;
|
||||
try{
|
||||
while (en.hasMoreElements()) {
|
||||
JarEntry je = en.nextElement();
|
||||
String name = je.getName();
|
||||
//这里添加了路径扫描限制
|
||||
if (name.endsWith(".class")) {
|
||||
String className = name.replace(".class", "").replaceAll("/", ".");
|
||||
input = jarFile.getInputStream(je);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
int bufferSize = 4096;
|
||||
byte[] buffer = new byte[bufferSize];
|
||||
int bytesNumRead = 0;
|
||||
while ((bytesNumRead = input.read(buffer)) != -1) {
|
||||
baos.write(buffer, 0, bytesNumRead);
|
||||
}
|
||||
byte[] classBytes = baos.toByteArray();
|
||||
classBytesMap.put(className,classBytes);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(input!=null){
|
||||
try {
|
||||
input.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//将jar中的每一个class字节码进行Class载入
|
||||
for (Map.Entry<String, byte[]> entry : classBytesMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Class<?> aClass = null;
|
||||
try {
|
||||
aClass = loadClass(key);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
cacheClassMap.put(key,aClass);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 方法描述 初始化spring bean
|
||||
* @method initBean
|
||||
*/
|
||||
public void initBean(){
|
||||
for (Map.Entry<String, Class> entry : cacheClassMap.entrySet()) {
|
||||
String className = entry.getKey();
|
||||
Class<?> cla = entry.getValue();
|
||||
if(isSpringBeanClass(cla)){
|
||||
BeanDefinitionBuilder beanDefinitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(cla);
|
||||
BeanDefinition beanDefinition = beanDefinitionBuilder.getRawBeanDefinition();
|
||||
//设置当前bean定义对象是单利的
|
||||
beanDefinition.setScope("singleton");
|
||||
|
||||
//将变量首字母置小写
|
||||
String beanName = StringUtils.uncapitalize(className);
|
||||
|
||||
beanName = beanName.substring(beanName.lastIndexOf(".")+1);
|
||||
beanName = StringUtils.uncapitalize(beanName);
|
||||
|
||||
SpringContextUtil.getBeanFactory().registerBeanDefinition(beanName,beanDefinition);
|
||||
registeredBean.add(beanName);
|
||||
System.out.println("注册bean:"+beanName);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取当前类加载器注册的bean
|
||||
//在移除当前类加载器的时候需要手动删除这些注册的bean
|
||||
public List<String> getRegisteredBean() {
|
||||
return registeredBean;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 方法描述 判断class对象是否带有spring的注解
|
||||
* @method isSpringBeanClass
|
||||
* @param cla jar中的每一个class
|
||||
* @return true 是spring bean false 不是spring bean
|
||||
*/
|
||||
public boolean isSpringBeanClass(Class<?> cla){
|
||||
if(cla==null){
|
||||
return false;
|
||||
}
|
||||
//是否是接口
|
||||
if(cla.isInterface()){
|
||||
return false;
|
||||
}
|
||||
|
||||
//是否是抽象类
|
||||
if( Modifier.isAbstract(cla.getModifiers())){
|
||||
return false;
|
||||
}
|
||||
|
||||
if(cla.getAnnotation(Component.class)!=null){
|
||||
return true;
|
||||
}
|
||||
if(cla.getAnnotation(Repository.class)!=null){
|
||||
return true;
|
||||
}
|
||||
if(cla.getAnnotation(Service.class)!=null){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
11
backend/src/main/java/io/dataease/provider/DDLProvider.java
Normal file
11
backend/src/main/java/io/dataease/provider/DDLProvider.java
Normal file
@ -0,0 +1,11 @@
|
||||
package io.dataease.provider;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/5/17 4:19 下午
|
||||
*/
|
||||
public abstract class DDLProvider {
|
||||
public abstract String createView(String name, String viewSQL);
|
||||
|
||||
public abstract String dropTableOrView(String name);
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package io.dataease.provider;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.controller.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.dto.chart.ChartViewFieldDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/5/17 2:42 下午
|
||||
*/
|
||||
public abstract class QueryProvider {
|
||||
public abstract Integer transFieldType(String field);
|
||||
|
||||
public abstract String createQueryCountSQL(String table);
|
||||
|
||||
public abstract String createQueryCountSQLAsTmp(String sql);
|
||||
|
||||
public abstract String createSQLPreview(String sql, String orderBy);
|
||||
|
||||
public abstract String createQuerySQL(String table, List<DatasetTableField> fields);
|
||||
|
||||
public abstract String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields);
|
||||
|
||||
public abstract String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize);
|
||||
|
||||
public abstract String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize);
|
||||
|
||||
public abstract String getSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList);
|
||||
|
||||
public abstract String getSQLAsTmp(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList);
|
||||
|
||||
public abstract String searchTable(String table);
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package io.dataease.provider.doris;
|
||||
|
||||
import io.dataease.provider.DDLProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/5/17 4:27 下午
|
||||
*/
|
||||
@Service("dorisDDL")
|
||||
public class DorisDDLProvider extends DDLProvider {
|
||||
@Override
|
||||
public String createView(String name, String viewSQL) {
|
||||
return "CREATE VIEW IF NOT EXISTS " + name + " AS (" + viewSQL + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dropTableOrView(String name) {
|
||||
return "DROP TABLE IF EXISTS " + name;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,294 @@
|
||||
package io.dataease.provider.doris;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.controller.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.dto.chart.ChartViewFieldDTO;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/5/17 4:11 下午
|
||||
*/
|
||||
@Service("dorisQuery")
|
||||
public class DorisQueryProvider extends QueryProvider {
|
||||
@Override
|
||||
public Integer transFieldType(String field) {
|
||||
switch (field) {
|
||||
case "CHAR":
|
||||
case "VARCHAR":
|
||||
case "TEXT":
|
||||
case "TINYTEXT":
|
||||
case "MEDIUMTEXT":
|
||||
case "LONGTEXT":
|
||||
case "ENUM":
|
||||
return 0;// 文本
|
||||
case "DATE":
|
||||
case "TIME":
|
||||
case "YEAR":
|
||||
case "DATETIME":
|
||||
case "TIMESTAMP":
|
||||
return 1;// 时间
|
||||
case "INT":
|
||||
case "SMALLINT":
|
||||
case "MEDIUMINT":
|
||||
case "INTEGER":
|
||||
case "BIGINT":
|
||||
return 2;// 整型
|
||||
case "FLOAT":
|
||||
case "DOUBLE":
|
||||
case "DECIMAL":
|
||||
return 3;// 浮点
|
||||
case "BIT":
|
||||
case "TINYINT":
|
||||
return 4;// 布尔
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueryCountSQL(String table) {
|
||||
return MessageFormat.format("SELECT count(*) FROM {0}", table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueryCountSQLAsTmp(String sql) {
|
||||
return createQueryCountSQL(" (" + sql + ") AS tmp ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createSQLPreview(String sql, String orderBy) {
|
||||
return "SELECT * FROM (" + sql + ") AS tmp ORDER BY " + orderBy + " LIMIT 0,1000";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields) {
|
||||
String[] array = fields.stream().map(f -> {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
// 如果原始类型为时间
|
||||
if (f.getDeExtractType() == 1) {
|
||||
if (f.getDeType() == 2 || f.getDeType() == 3) {
|
||||
stringBuilder.append("unix_timestamp(").append(f.getDataeaseName()).append(")*1000 as ").append(f.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append(f.getDataeaseName());
|
||||
}
|
||||
} else {
|
||||
if (f.getDeType() == 1) {
|
||||
stringBuilder.append("FROM_UNIXTIME(cast(").append(f.getDataeaseName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') as ").append(f.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append(f.getDataeaseName());
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}).toArray(String[]::new);
|
||||
|
||||
return MessageFormat.format("SELECT {0} FROM {1} ORDER BY " + (fields.size() > 0 ? fields.get(0).getDataeaseName() : "null"), StringUtils.join(array, ","), table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
|
||||
return createQuerySQL(" (" + sql + ") AS tmp ", fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
return createQuerySQL(table, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
return createQuerySQLAsTmp(sql, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) {
|
||||
// 字段汇总 排序等
|
||||
String[] field = yAxis.stream().map(y -> {
|
||||
StringBuilder f = new StringBuilder();
|
||||
if (StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*")) {
|
||||
f.append(y.getSummary()).append("(").append(y.getDataeaseName()).append(")");
|
||||
} else {
|
||||
f.append("ROUND(")
|
||||
.append(y.getSummary()).append("(")
|
||||
.append("CAST(").append(y.getDataeaseName()).append(" AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
|
||||
.append("),2").append(")");
|
||||
}
|
||||
f.append(" AS _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName());
|
||||
return f.toString();
|
||||
}).toArray(String[]::new);
|
||||
String[] groupField = xAxis.stream().map(x -> {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
// 如果原始类型为时间
|
||||
if (x.getDeExtractType() == 1) {
|
||||
if (x.getDeType() == 2 || x.getDeType() == 3) {
|
||||
stringBuilder.append("unix_timestamp(").append(x.getDataeaseName()).append(")*1000 as ").append(x.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append(x.getDataeaseName());
|
||||
}
|
||||
} else {
|
||||
if (x.getDeType() == 1) {
|
||||
stringBuilder.append("FROM_UNIXTIME(cast(").append(x.getDataeaseName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') as ").append(x.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append(x.getDataeaseName());
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}).toArray(String[]::new);
|
||||
String[] group = xAxis.stream().map(ChartViewFieldDTO::getDataeaseName).toArray(String[]::new);
|
||||
String[] xOrder = xAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
|
||||
.map(f -> f.getDataeaseName() + " " + f.getSort()).toArray(String[]::new);
|
||||
String[] yOrder = yAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
|
||||
.map(f -> "_" + f.getSummary() + "_" + (StringUtils.equalsIgnoreCase(f.getDataeaseName(), "*") ? "" : f.getDataeaseName()) + " " + f.getSort()).toArray(String[]::new);
|
||||
String[] order = Arrays.copyOf(xOrder, xOrder.length + yOrder.length);
|
||||
System.arraycopy(yOrder, 0, order, xOrder.length, yOrder.length);
|
||||
|
||||
String[] xFilter = xAxis.stream().filter(x -> CollectionUtils.isNotEmpty(x.getFilter()) && x.getFilter().size() > 0)
|
||||
.map(x -> {
|
||||
String[] s = x.getFilter().stream().map(f -> {
|
||||
StringBuilder filter = new StringBuilder();
|
||||
if (x.getDeType() == 1 && x.getDeExtractType() != 1) {
|
||||
filter.append(" AND FROM_UNIXTIME(cast(")
|
||||
.append(x.getDataeaseName())
|
||||
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
|
||||
} else {
|
||||
filter.append(" AND ").append(x.getDataeaseName());
|
||||
}
|
||||
filter.append(transMysqlFilterTerm(f.getTerm()));
|
||||
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
|
||||
filter.append("%").append(f.getValue()).append("%");
|
||||
} else {
|
||||
filter.append("'" + f.getValue() + "'");
|
||||
}
|
||||
return filter.toString();
|
||||
}).toArray(String[]::new);
|
||||
return StringUtils.join(s, " ");
|
||||
}).toArray(String[]::new);
|
||||
|
||||
String sql = MessageFormat.format("SELECT {0},{1} FROM {2} WHERE 1=1 {3} GROUP BY {4} ORDER BY null,{5}",
|
||||
StringUtils.join(groupField, ","),
|
||||
StringUtils.join(field, ","),
|
||||
table,
|
||||
xFilter.length > 0 ? StringUtils.join(xFilter, " ") : "" + transMysqlExtFilter(extFilterRequestList),// origin field filter and panel field filter
|
||||
StringUtils.join(group, ","),
|
||||
StringUtils.join(order, ","));
|
||||
if (sql.endsWith(",")) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
}
|
||||
// 如果是对结果字段过滤,则再包裹一层sql
|
||||
String[] resultFilter = yAxis.stream().filter(y -> CollectionUtils.isNotEmpty(y.getFilter()) && y.getFilter().size() > 0)
|
||||
.map(y -> {
|
||||
String[] s = y.getFilter().stream().map(f -> {
|
||||
StringBuilder filter = new StringBuilder();
|
||||
if (y.getDeType() == 1 && y.getDeExtractType() != 1) {
|
||||
filter.append(" AND FROM_UNIXTIME(cast(_")
|
||||
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName())
|
||||
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
|
||||
} else {
|
||||
filter.append(" AND _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName());
|
||||
}
|
||||
filter.append(transMysqlFilterTerm(f.getTerm()));
|
||||
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
|
||||
filter.append("%").append(f.getValue()).append("%");
|
||||
} else {
|
||||
filter.append("'" + f.getValue() + "'");
|
||||
}
|
||||
return filter.toString();
|
||||
}).toArray(String[]::new);
|
||||
return StringUtils.join(s, " ");
|
||||
}).toArray(String[]::new);
|
||||
if (resultFilter.length == 0) {
|
||||
return sql;
|
||||
} else {
|
||||
String filterSql = MessageFormat.format("SELECT * FROM {0} WHERE 1=1 {1}",
|
||||
"(" + sql + ") AS tmp",
|
||||
StringUtils.join(resultFilter, " "));
|
||||
return filterSql;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmp(String sql, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) {
|
||||
return getSQL(" (" + sql + ") AS tmp ", xAxis, yAxis, extFilterRequestList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchTable(String table) {
|
||||
return "SELECT table_name FROM information_schema.TABLES WHERE table_name ='" + table + "'";
|
||||
}
|
||||
|
||||
public String transMysqlFilterTerm(String term) {
|
||||
switch (term) {
|
||||
case "eq":
|
||||
return " = ";
|
||||
case "not_eq":
|
||||
return " <> ";
|
||||
case "lt":
|
||||
return " < ";
|
||||
case "le":
|
||||
return " <= ";
|
||||
case "gt":
|
||||
return " > ";
|
||||
case "ge":
|
||||
return " >= ";
|
||||
case "in":
|
||||
return " IN ";
|
||||
case "not in":
|
||||
return " NOT IN ";
|
||||
case "like":
|
||||
return " LIKE ";
|
||||
case "not like":
|
||||
return " NOT LIKE ";
|
||||
case "null":
|
||||
return " IS NULL ";
|
||||
case "not_null":
|
||||
return " IS NOT NULL ";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String transMysqlExtFilter(List<ChartExtFilterRequest> requestList) {
|
||||
if (CollectionUtils.isEmpty(requestList)) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder filter = new StringBuilder();
|
||||
for (ChartExtFilterRequest request : requestList) {
|
||||
List<String> value = request.getValue();
|
||||
if (CollectionUtils.isEmpty(value)) {
|
||||
continue;
|
||||
}
|
||||
DatasetTableField field = request.getDatasetTableField();
|
||||
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
|
||||
filter.append(" AND FROM_UNIXTIME(cast(")
|
||||
.append(field.getDataeaseName())
|
||||
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
|
||||
} else {
|
||||
filter.append(" AND ").append(field.getDataeaseName());
|
||||
}
|
||||
filter.append(" ")
|
||||
.append(transMysqlFilterTerm(request.getOperator()))
|
||||
.append(" ");
|
||||
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(value, "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
|
||||
filter.append("'%").append(value.get(0)).append("%'");
|
||||
} else {
|
||||
filter.append("'").append(value.get(0)).append("'");
|
||||
}
|
||||
}
|
||||
return filter.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package io.dataease.provider.mysql;
|
||||
|
||||
import io.dataease.provider.DDLProvider;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/5/17 4:27 下午
|
||||
*/
|
||||
@Service("mysqlDDL")
|
||||
public class MysqlDDLProvider extends DDLProvider {
|
||||
@Override
|
||||
public String createView(String name, String viewSQL) {
|
||||
return "CREATE VIEW IF NOT EXISTS " + name + " AS (" + viewSQL + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String dropTableOrView(String name) {
|
||||
return "DROP TABLE IF EXISTS " + name;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,308 @@
|
||||
package io.dataease.provider.mysql;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.controller.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.dto.chart.ChartViewFieldDTO;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author gin
|
||||
* @Date 2021/5/17 2:43 下午
|
||||
*/
|
||||
@Service("mysqlQuery")
|
||||
public class MysqlQueryProvider extends QueryProvider {
|
||||
@Override
|
||||
public Integer transFieldType(String field) {
|
||||
switch (field) {
|
||||
case "CHAR":
|
||||
case "VARCHAR":
|
||||
case "TEXT":
|
||||
case "TINYTEXT":
|
||||
case "MEDIUMTEXT":
|
||||
case "LONGTEXT":
|
||||
case "ENUM":
|
||||
return 0;// 文本
|
||||
case "DATE":
|
||||
case "TIME":
|
||||
case "YEAR":
|
||||
case "DATETIME":
|
||||
case "TIMESTAMP":
|
||||
return 1;// 时间
|
||||
case "INT":
|
||||
case "SMALLINT":
|
||||
case "MEDIUMINT":
|
||||
case "INTEGER":
|
||||
case "BIGINT":
|
||||
return 2;// 整型
|
||||
case "FLOAT":
|
||||
case "DOUBLE":
|
||||
case "DECIMAL":
|
||||
return 3;// 浮点
|
||||
case "BIT":
|
||||
case "TINYINT":
|
||||
return 4;// 布尔
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueryCountSQL(String table) {
|
||||
return MessageFormat.format("SELECT count(*) FROM {0}", table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQueryCountSQLAsTmp(String sql) {
|
||||
return createQueryCountSQL(" (" + sqlFix(sql) + ") AS tmp ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createSQLPreview(String sql, String orderBy) {
|
||||
return "SELECT * FROM (" + sqlFix(sql) + ") AS tmp ORDER BY " + orderBy + " LIMIT 0,1000";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQL(String table, List<DatasetTableField> fields) {
|
||||
String[] array = fields.stream().map(f -> {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
// 如果原始类型为时间
|
||||
if (f.getDeExtractType() == 1) {
|
||||
if (f.getDeType() == 2 || f.getDeType() == 3) {
|
||||
stringBuilder.append("unix_timestamp(").append(f.getDataeaseName()).append(")*1000 as ").append(f.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append(f.getDataeaseName());
|
||||
}
|
||||
} else {
|
||||
if (f.getDeType() == 1) {
|
||||
stringBuilder.append("FROM_UNIXTIME(cast(").append(f.getDataeaseName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') as ").append(f.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append(f.getDataeaseName());
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}).toArray(String[]::new);
|
||||
|
||||
return MessageFormat.format("SELECT {0} FROM {1} ORDER BY " + (fields.size() > 0 ? fields.get(0).getDataeaseName() : "null"), StringUtils.join(array, ","), table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
|
||||
return createQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLWithPage(String table, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
return createQuerySQL(table, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String createQuerySQLAsTmpWithPage(String sql, List<DatasetTableField> fields, Integer page, Integer pageSize, Integer realSize) {
|
||||
return createQuerySQLAsTmp(sql, fields) + " LIMIT " + (page - 1) * pageSize + "," + realSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) {
|
||||
// 字段汇总 排序等
|
||||
String[] field = yAxis.stream().map(y -> {
|
||||
StringBuilder f = new StringBuilder();
|
||||
if (StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*")) {
|
||||
f.append(y.getSummary()).append("(").append(y.getDataeaseName()).append(")");
|
||||
} else {
|
||||
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
|
||||
f.append("CAST(")
|
||||
.append(y.getSummary()).append("(")
|
||||
.append("CAST(").append(y.getDataeaseName()).append(" AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
|
||||
.append(") AS DECIMAL(20,2)").append(")");
|
||||
} else {
|
||||
f.append(y.getSummary()).append("(")
|
||||
.append("CAST(").append(y.getDataeaseName()).append(" AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
|
||||
.append(")");
|
||||
}
|
||||
}
|
||||
f.append(" AS _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName());
|
||||
return f.toString();
|
||||
}).toArray(String[]::new);
|
||||
String[] groupField = xAxis.stream().map(x -> {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
// 如果原始类型为时间
|
||||
if (x.getDeExtractType() == 1) {
|
||||
if (x.getDeType() == 2 || x.getDeType() == 3) {
|
||||
stringBuilder.append("unix_timestamp(").append(x.getDataeaseName()).append(")*1000 as ").append(x.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append(x.getDataeaseName());
|
||||
}
|
||||
} else {
|
||||
if (x.getDeType() == 1) {
|
||||
stringBuilder.append("FROM_UNIXTIME(cast(").append(x.getDataeaseName()).append(" as decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') as ").append(x.getDataeaseName());
|
||||
} else {
|
||||
stringBuilder.append(x.getDataeaseName());
|
||||
}
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}).toArray(String[]::new);
|
||||
String[] group = xAxis.stream().map(ChartViewFieldDTO::getDataeaseName).toArray(String[]::new);
|
||||
String[] xOrder = xAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
|
||||
.map(f -> f.getDataeaseName() + " " + f.getSort()).toArray(String[]::new);
|
||||
String[] yOrder = yAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
|
||||
.map(f -> "_" + f.getSummary() + "_" + (StringUtils.equalsIgnoreCase(f.getDataeaseName(), "*") ? "" : f.getDataeaseName()) + " " + f.getSort()).toArray(String[]::new);
|
||||
String[] order = Arrays.copyOf(xOrder, xOrder.length + yOrder.length);
|
||||
System.arraycopy(yOrder, 0, order, xOrder.length, yOrder.length);
|
||||
|
||||
String[] xFilter = xAxis.stream().filter(x -> CollectionUtils.isNotEmpty(x.getFilter()) && x.getFilter().size() > 0)
|
||||
.map(x -> {
|
||||
String[] s = x.getFilter().stream().map(f -> {
|
||||
StringBuilder filter = new StringBuilder();
|
||||
if (x.getDeType() == 1 && x.getDeExtractType() != 1) {
|
||||
filter.append(" AND FROM_UNIXTIME(cast(")
|
||||
.append(x.getDataeaseName())
|
||||
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
|
||||
} else {
|
||||
filter.append(" AND ").append(x.getDataeaseName());
|
||||
}
|
||||
filter.append(transMysqlFilterTerm(f.getTerm()));
|
||||
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
|
||||
filter.append("%").append(f.getValue()).append("%");
|
||||
} else {
|
||||
filter.append("'").append(f.getValue()).append("'");
|
||||
}
|
||||
return filter.toString();
|
||||
}).toArray(String[]::new);
|
||||
return StringUtils.join(s, " ");
|
||||
}).toArray(String[]::new);
|
||||
|
||||
String sql = MessageFormat.format("SELECT {0},{1} FROM {2} WHERE 1=1 {3} GROUP BY {4} ORDER BY null,{5}",
|
||||
StringUtils.join(groupField, ","),
|
||||
StringUtils.join(field, ","),
|
||||
table,
|
||||
xFilter.length > 0 ? StringUtils.join(xFilter, " ") : "" + transMysqlExtFilter(extFilterRequestList),// origin field filter and panel field filter
|
||||
StringUtils.join(group, ","),
|
||||
StringUtils.join(order, ","));
|
||||
if (sql.endsWith(",")) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
}
|
||||
// 如果是对结果字段过滤,则再包裹一层sql
|
||||
String[] resultFilter = yAxis.stream().filter(y -> CollectionUtils.isNotEmpty(y.getFilter()) && y.getFilter().size() > 0)
|
||||
.map(y -> {
|
||||
String[] s = y.getFilter().stream().map(f -> {
|
||||
StringBuilder filter = new StringBuilder();
|
||||
// 原始类型不是时间,在de中被转成时间的字段做处理
|
||||
if (y.getDeType() == 1 && y.getDeExtractType() != 1) {
|
||||
filter.append(" AND FROM_UNIXTIME(cast(_")
|
||||
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName())
|
||||
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
|
||||
} else {
|
||||
filter.append(" AND _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getDataeaseName(), "*") ? "" : y.getDataeaseName());
|
||||
}
|
||||
filter.append(transMysqlFilterTerm(f.getTerm()));
|
||||
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
|
||||
filter.append("%").append(f.getValue()).append("%");
|
||||
} else {
|
||||
filter.append("'").append(f.getValue()).append("'");
|
||||
}
|
||||
return filter.toString();
|
||||
}).toArray(String[]::new);
|
||||
return StringUtils.join(s, " ");
|
||||
}).toArray(String[]::new);
|
||||
if (resultFilter.length == 0) {
|
||||
return sql;
|
||||
} else {
|
||||
String filterSql = MessageFormat.format("SELECT * FROM {0} WHERE 1=1 {1}",
|
||||
"(" + sql + ") AS tmp",
|
||||
StringUtils.join(resultFilter, " "));
|
||||
return filterSql;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSQLAsTmp(String sql, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) {
|
||||
return getSQL(" (" + sqlFix(sql) + ") AS tmp ", xAxis, yAxis, extFilterRequestList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String searchTable(String table) {
|
||||
return "SELECT table_name FROM information_schema.TABLES WHERE table_name ='" + table + "'";
|
||||
}
|
||||
|
||||
public String transMysqlFilterTerm(String term) {
|
||||
switch (term) {
|
||||
case "eq":
|
||||
return " = ";
|
||||
case "not_eq":
|
||||
return " <> ";
|
||||
case "lt":
|
||||
return " < ";
|
||||
case "le":
|
||||
return " <= ";
|
||||
case "gt":
|
||||
return " > ";
|
||||
case "ge":
|
||||
return " >= ";
|
||||
case "in":
|
||||
return " IN ";
|
||||
case "not in":
|
||||
return " NOT IN ";
|
||||
case "like":
|
||||
return " LIKE ";
|
||||
case "not like":
|
||||
return " NOT LIKE ";
|
||||
case "null":
|
||||
return " IS NULL ";
|
||||
case "not_null":
|
||||
return " IS NOT NULL ";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String transMysqlExtFilter(List<ChartExtFilterRequest> requestList) {
|
||||
if (CollectionUtils.isEmpty(requestList)) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder filter = new StringBuilder();
|
||||
for (ChartExtFilterRequest request : requestList) {
|
||||
List<String> value = request.getValue();
|
||||
if (CollectionUtils.isEmpty(value)) {
|
||||
continue;
|
||||
}
|
||||
DatasetTableField field = request.getDatasetTableField();
|
||||
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
|
||||
filter.append(" AND FROM_UNIXTIME(cast(")
|
||||
.append(field.getDataeaseName())
|
||||
.append(" AS decimal(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
|
||||
} else {
|
||||
filter.append(" AND ").append(field.getDataeaseName());
|
||||
}
|
||||
filter.append(" ")
|
||||
.append(transMysqlFilterTerm(request.getOperator()))
|
||||
.append(" ");
|
||||
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(value, "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
|
||||
filter.append("'%").append(value.get(0)).append("%'");
|
||||
} else {
|
||||
filter.append("'").append(value.get(0)).append("'");
|
||||
}
|
||||
}
|
||||
return filter.toString();
|
||||
}
|
||||
|
||||
private String sqlFix(String sql) {
|
||||
if (sql.lastIndexOf(";") == (sql.length() - 1)) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
}
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
54
backend/src/main/java/io/dataease/service/AboutService.java
Normal file
54
backend/src/main/java/io/dataease/service/AboutService.java
Normal file
@ -0,0 +1,54 @@
|
||||
package io.dataease.service;
|
||||
|
||||
import io.dataease.commons.license.DefaultLicenseService;
|
||||
import io.dataease.commons.license.F2CLicenseResponse;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.commons.utils.LogUtil;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.util.Optional;
|
||||
|
||||
@Service
|
||||
public class AboutService {
|
||||
private static final String BUILD_VERSION = "/opt/fit2cloud/conf/version";
|
||||
private static final String product = "dataease";
|
||||
|
||||
@Resource
|
||||
private DefaultLicenseService defaultLicenseService;
|
||||
|
||||
public F2CLicenseResponse updateLicense(String licenseKey) {
|
||||
F2CLicenseResponse f2CLicenseResponse = defaultLicenseService.updateLicense(product, licenseKey);
|
||||
return f2CLicenseResponse;
|
||||
}
|
||||
|
||||
public F2CLicenseResponse validateLicense(String licenseKey) {
|
||||
if (StringUtils.isNotBlank(licenseKey)) {
|
||||
return defaultLicenseService.validateLicense(product, licenseKey);
|
||||
} else {
|
||||
return defaultLicenseService.validateLicense();
|
||||
}
|
||||
}
|
||||
|
||||
public String getBuildVersion() {
|
||||
try {
|
||||
File file = new File(BUILD_VERSION);
|
||||
if (file.exists()) {
|
||||
String version = FileUtils.readFileToString(file, "UTF-8");
|
||||
if (StringUtils.isNotBlank(version)) {
|
||||
return version;
|
||||
}
|
||||
}
|
||||
String property = CommonBeanFactory.getBean(Environment.class).getProperty("cmp.version");
|
||||
String result = Optional.ofNullable(property).orElse("V1.0");
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
LogUtil.error("failed to get build version.", e);
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,5 @@
|
||||
package io.dataease.service.chart;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import io.dataease.base.domain.*;
|
||||
@ -12,7 +11,6 @@ import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.controller.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.chart.ChartViewRequest;
|
||||
import io.dataease.datasource.constants.DatasourceTypes;
|
||||
import io.dataease.datasource.provider.DatasourceProvider;
|
||||
import io.dataease.datasource.provider.ProviderFactory;
|
||||
import io.dataease.datasource.request.DatasourceRequest;
|
||||
@ -21,6 +19,7 @@ import io.dataease.dto.chart.ChartViewDTO;
|
||||
import io.dataease.dto.chart.ChartViewFieldDTO;
|
||||
import io.dataease.dto.chart.Series;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
import io.dataease.service.dataset.DataSetTableFieldsService;
|
||||
import io.dataease.service.dataset.DataSetTableService;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
@ -31,7 +30,6 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -48,8 +46,6 @@ public class ChartViewService {
|
||||
private DataSetTableService dataSetTableService;
|
||||
@Resource
|
||||
private DatasourceService datasourceService;
|
||||
// @Resource
|
||||
// private SparkCalc sparkCalc;
|
||||
@Resource
|
||||
private DataSetTableFieldsService dataSetTableFieldsService;
|
||||
|
||||
@ -99,10 +95,6 @@ public class ChartViewService {
|
||||
BeanUtils.copyBean(dto, view);
|
||||
return dto;
|
||||
}
|
||||
// List<String> xIds = xAxis.stream().map(DatasetTableField::getId).collect(Collectors.toList());
|
||||
// List<String> yIds = yAxis.stream().map(DatasetTableField::getId).collect(Collectors.toList());
|
||||
// List<DatasetTableField> xList = dataSetTableFieldsService.getListByIds(xIds);
|
||||
// List<DatasetTableField> yList = dataSetTableFieldsService.getListByIds(yIds);
|
||||
|
||||
// 过滤来自仪表盘的条件
|
||||
List<ChartExtFilterRequest> extFilterList = new ArrayList<>();
|
||||
@ -132,26 +124,24 @@ public class ChartViewService {
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(table.getInfo(), DataTableInfoDTO.class);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
if (StringUtils.equalsIgnoreCase(table.getType(), "db")) {
|
||||
datasourceRequest.setTable(dataTableInfoDTO.getTable());
|
||||
datasourceRequest.setQuery(getSQL(ds.getType(), dataTableInfoDTO.getTable(), xAxis, yAxis, extFilterList));
|
||||
datasourceRequest.setQuery(qp.getSQL(dataTableInfoDTO.getTable(), xAxis, yAxis, extFilterList));
|
||||
} else if (StringUtils.equalsIgnoreCase(table.getType(), "sql")) {
|
||||
datasourceRequest.setQuery(getSQL(ds.getType(), " (" + dataTableInfoDTO.getSql() + ") AS tmp ", xAxis, yAxis, extFilterList));
|
||||
datasourceRequest.setQuery(qp.getSQLAsTmp(dataTableInfoDTO.getSql(), xAxis, yAxis, extFilterList));
|
||||
}
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
} else if (table.getMode() == 1) {// 抽取
|
||||
// 获取数据集de字段
|
||||
// List<DatasetTableField> fields = dataSetTableFieldsService.getFieldsByTableId(table.getId());
|
||||
// data = sparkCalc.getData(table.getId(), fields, xAxis, yAxis, "tmp_" + view.getId().split("-")[0], extFilterList);
|
||||
|
||||
// 连接doris,构建doris数据源查询
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String tableName = "ds_" + table.getId().replaceAll("-", "_");
|
||||
datasourceRequest.setTable(tableName);
|
||||
datasourceRequest.setQuery(getSQL(ds.getType(), tableName, xAxis, yAxis, extFilterList));
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.getSQL(tableName, xAxis, yAxis, extFilterList));
|
||||
data = datasourceProvider.getData(datasourceRequest);
|
||||
}
|
||||
|
||||
@ -194,9 +184,9 @@ public class ChartViewService {
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
ChartViewFieldDTO chartViewFieldDTO = fields.get(i);
|
||||
if (chartViewFieldDTO.getDeType() == 0 || chartViewFieldDTO.getDeType() == 1) {
|
||||
d.put(fields.get(i).getOriginName(), ele[i]);
|
||||
d.put(fields.get(i).getDataeaseName(), StringUtils.isEmpty(ele[i]) ? "" : ele[i]);
|
||||
} else if (chartViewFieldDTO.getDeType() == 2 || chartViewFieldDTO.getDeType() == 3) {
|
||||
d.put(fields.get(i).getOriginName(), new BigDecimal(ele[i]).setScale(2, RoundingMode.HALF_UP));
|
||||
d.put(fields.get(i).getDataeaseName(), new BigDecimal(StringUtils.isEmpty(ele[i]) ? "0" : ele[i]).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
}
|
||||
tableRow.add(d);
|
||||
@ -214,142 +204,6 @@ public class ChartViewService {
|
||||
return dto;
|
||||
}
|
||||
|
||||
public String transMysqlExtFilter(List<ChartExtFilterRequest> requestList) {
|
||||
if (CollectionUtils.isEmpty(requestList)) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder filter = new StringBuilder();
|
||||
for (ChartExtFilterRequest request : requestList) {
|
||||
List<String> value = request.getValue();
|
||||
if (CollectionUtils.isEmpty(value)) {
|
||||
continue;
|
||||
}
|
||||
DatasetTableField field = request.getDatasetTableField();
|
||||
filter.append(" AND ")
|
||||
.append(field.getOriginName())
|
||||
.append(" ")
|
||||
.append(transMysqlFilterTerm(request.getOperator()))
|
||||
.append(" ");
|
||||
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(value, "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
|
||||
filter.append("'%").append(value.get(0)).append("%'");
|
||||
} else {
|
||||
filter.append("'").append(value.get(0)).append("'");
|
||||
}
|
||||
}
|
||||
return filter.toString();
|
||||
}
|
||||
|
||||
public String getSQL(String type, String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(type);
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
return transMysqlSQL(table, xAxis, yAxis, extFilterRequestList);
|
||||
case sqlServer:
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String transMysqlSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartExtFilterRequest> extFilterRequestList) {
|
||||
// 字段汇总 排序等
|
||||
String[] field = yAxis.stream().map(y -> "CAST(" + y.getSummary() + "(" + y.getOriginName() + ") AS DECIMAL(20,2)) AS _" + y.getSummary() + "_" + (StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())).toArray(String[]::new);
|
||||
String[] group = xAxis.stream().map(ChartViewFieldDTO::getOriginName).toArray(String[]::new);
|
||||
String[] xOrder = xAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
|
||||
.map(f -> f.getOriginName() + " " + f.getSort()).toArray(String[]::new);
|
||||
String[] yOrder = yAxis.stream().filter(f -> StringUtils.isNotEmpty(f.getSort()) && !StringUtils.equalsIgnoreCase(f.getSort(), "none"))
|
||||
.map(f -> "_" + f.getSummary() + "_" + (StringUtils.equalsIgnoreCase(f.getOriginName(), "*") ? "" : f.getOriginName()) + " " + f.getSort()).toArray(String[]::new);
|
||||
String[] order = Arrays.copyOf(xOrder, xOrder.length + yOrder.length);
|
||||
System.arraycopy(yOrder, 0, order, xOrder.length, yOrder.length);
|
||||
|
||||
String[] xFilter = xAxis.stream().filter(x -> CollectionUtils.isNotEmpty(x.getFilter()) && x.getFilter().size() > 0)
|
||||
.map(x -> {
|
||||
String[] s = x.getFilter().stream().map(f -> {
|
||||
StringBuilder filter = new StringBuilder();
|
||||
filter.append(" AND ").append(x.getOriginName()).append(transMysqlFilterTerm(f.getTerm()));
|
||||
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
|
||||
filter.append("%").append(f.getValue()).append("%");
|
||||
} else {
|
||||
filter.append(f.getValue());
|
||||
}
|
||||
return filter.toString();
|
||||
}).toArray(String[]::new);
|
||||
return StringUtils.join(s, " ");
|
||||
}).toArray(String[]::new);
|
||||
|
||||
String sql = MessageFormat.format("SELECT {0},{1} FROM {2} WHERE 1=1 {3} GROUP BY {4} ORDER BY null,{5}",
|
||||
StringUtils.join(group, ","),
|
||||
StringUtils.join(field, ","),
|
||||
table,
|
||||
xFilter.length > 0 ? StringUtils.join(xFilter, " ") : "" + transMysqlExtFilter(extFilterRequestList),// origin field filter and panel field filter
|
||||
StringUtils.join(group, ","),
|
||||
StringUtils.join(order, ","));
|
||||
if (sql.endsWith(",")) {
|
||||
sql = sql.substring(0, sql.length() - 1);
|
||||
}
|
||||
// 如果是对结果字段过滤,则再包裹一层sql
|
||||
String[] resultFilter = yAxis.stream().filter(y -> CollectionUtils.isNotEmpty(y.getFilter()) && y.getFilter().size() > 0)
|
||||
.map(y -> {
|
||||
String[] s = y.getFilter().stream().map(f -> {
|
||||
StringBuilder filter = new StringBuilder();
|
||||
filter.append(" AND _").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append(transMysqlFilterTerm(f.getTerm()));
|
||||
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
|
||||
filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')");
|
||||
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
|
||||
filter.append("%").append(f.getValue()).append("%");
|
||||
} else {
|
||||
filter.append(f.getValue());
|
||||
}
|
||||
return filter.toString();
|
||||
}).toArray(String[]::new);
|
||||
return StringUtils.join(s, " ");
|
||||
}).toArray(String[]::new);
|
||||
if (resultFilter.length == 0) {
|
||||
return sql;
|
||||
} else {
|
||||
String filterSql = MessageFormat.format("SELECT * FROM {0} WHERE 1=1 {1}",
|
||||
"(" + sql + ") AS tmp",
|
||||
StringUtils.join(resultFilter, " "));
|
||||
return filterSql;
|
||||
}
|
||||
}
|
||||
|
||||
public String transMysqlFilterTerm(String term) {
|
||||
switch (term) {
|
||||
case "eq":
|
||||
return " = ";
|
||||
case "not_eq":
|
||||
return " <> ";
|
||||
case "lt":
|
||||
return " < ";
|
||||
case "le":
|
||||
return " <= ";
|
||||
case "gt":
|
||||
return " > ";
|
||||
case "ge":
|
||||
return " >= ";
|
||||
case "in":
|
||||
return " IN ";
|
||||
case "not in":
|
||||
return " NOT IN ";
|
||||
case "like":
|
||||
return " LIKE ";
|
||||
case "not like":
|
||||
return " NOT LIKE ";
|
||||
case "null":
|
||||
return " IS NULL ";
|
||||
case "not_null":
|
||||
return " IS NOT NULL ";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private void checkName(ChartViewWithBLOBs chartView) {
|
||||
if (StringUtils.isEmpty(chartView.getId())) {
|
||||
return;
|
||||
|
||||
@ -51,7 +51,7 @@ public class DataSetGroupService {
|
||||
return dataSetGroupDTO;
|
||||
}
|
||||
|
||||
public void delete(String id) {
|
||||
public void delete(String id) throws Exception{
|
||||
DataSetGroupRequest datasetGroup = new DataSetGroupRequest();
|
||||
datasetGroup.setId(id);
|
||||
List<DataSetGroupDTO> tree = tree(datasetGroup);
|
||||
@ -68,7 +68,7 @@ public class DataSetGroupService {
|
||||
return datasetGroupMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void deleteTableAndField(List<String> sceneIds) {
|
||||
public void deleteTableAndField(List<String> sceneIds) throws Exception{
|
||||
for (String sceneId : sceneIds) {
|
||||
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
||||
dataSetTableRequest.setSceneId(sceneId);
|
||||
|
||||
@ -9,7 +9,6 @@ import io.dataease.base.mapper.DatasourceMapper;
|
||||
import io.dataease.base.mapper.ext.ExtDataSetTableMapper;
|
||||
import io.dataease.commons.utils.*;
|
||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||
import io.dataease.datasource.constants.DatasourceTypes;
|
||||
import io.dataease.datasource.dto.TableFiled;
|
||||
import io.dataease.datasource.provider.DatasourceProvider;
|
||||
import io.dataease.datasource.provider.JdbcProvider;
|
||||
@ -17,7 +16,11 @@ import io.dataease.datasource.provider.ProviderFactory;
|
||||
import io.dataease.datasource.request.DatasourceRequest;
|
||||
import io.dataease.dto.dataset.DataSetPreviewPage;
|
||||
import io.dataease.dto.dataset.DataSetTableDTO;
|
||||
import io.dataease.dto.dataset.DataSetTableUnionDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoCustomUnion;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.provider.DDLProvider;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@ -63,6 +66,8 @@ public class DataSetTableService {
|
||||
private ExtDataSetTableMapper extDataSetTableMapper;
|
||||
@Resource
|
||||
private DatasetTableIncrementalConfigMapper datasetTableIncrementalConfigMapper;
|
||||
@Resource
|
||||
private DataSetTableUnionService dataSetTableUnionService;
|
||||
@Value("${upload.file.path}")
|
||||
private String path;
|
||||
|
||||
@ -74,6 +79,11 @@ public class DataSetTableService {
|
||||
|
||||
public DatasetTable save(DatasetTable datasetTable) throws Exception {
|
||||
checkName(datasetTable);
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
|
||||
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
||||
BeanUtils.copyBean(dataSetTableRequest, datasetTable);
|
||||
getSQLPreview(dataSetTableRequest);
|
||||
}
|
||||
if (StringUtils.isEmpty(datasetTable.getId())) {
|
||||
datasetTable.setId(UUID.randomUUID().toString());
|
||||
datasetTable.setCreateBy(AuthUtils.getUser().getUsername());
|
||||
@ -87,15 +97,17 @@ public class DataSetTableService {
|
||||
// 添加表成功后,获取当前表字段和类型,抽象到dataease数据库
|
||||
if (insert == 1) {
|
||||
saveTableField(datasetTable);
|
||||
commonThreadPool.addTask(()->{
|
||||
extractDataService.extractData(datasetTable.getId(), null, "all_scope");
|
||||
});
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
|
||||
commonThreadPool.addTask(() -> {
|
||||
extractDataService.extractData(datasetTable.getId(), null, "all_scope");
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int update = datasetTableMapper.updateByPrimaryKeySelective(datasetTable);
|
||||
// sql 更新
|
||||
if (update == 1) {
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql")) {
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "sql") || StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||
// 删除所有字段,重新抽象
|
||||
dataSetTableFieldsService.deleteByTableId(datasetTable.getId());
|
||||
saveTableField(datasetTable);
|
||||
@ -105,11 +117,25 @@ public class DataSetTableService {
|
||||
return datasetTable;
|
||||
}
|
||||
|
||||
public void delete(String id) {
|
||||
public void delete(String id) throws Exception {
|
||||
datasetTableMapper.deleteByPrimaryKey(id);
|
||||
dataSetTableFieldsService.deleteByTableId(id);
|
||||
// 删除同步任务
|
||||
dataSetTableTaskService.deleteByTableId(id);
|
||||
deleteDorisTable(id);
|
||||
}
|
||||
|
||||
private void deleteDorisTable(String datasetId) throws Exception {
|
||||
String dorisTableName = DorisTableUtils.dorisName(datasetId);
|
||||
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(dorisDatasource);
|
||||
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(dorisDatasource.getType());
|
||||
datasourceRequest.setQuery(ddlProvider.dropTableOrView(dorisTableName));
|
||||
jdbcProvider.exec(datasourceRequest);
|
||||
datasourceRequest.setQuery(ddlProvider.dropTableOrView(DorisTableUtils.dorisTmpName(dorisTableName)));
|
||||
jdbcProvider.exec(datasourceRequest);
|
||||
}
|
||||
|
||||
public List<DataSetTableDTO> list(DataSetTableRequest dataSetTableRequest) {
|
||||
@ -152,6 +178,7 @@ public class DataSetTableService {
|
||||
.tableId(dataSetTableRequest.getId())
|
||||
.originName("*")
|
||||
.name("记录数*")
|
||||
.dataeaseName("*")
|
||||
.type("INT")
|
||||
.checked(true)
|
||||
.columnIndex(999)
|
||||
@ -166,23 +193,6 @@ public class DataSetTableService {
|
||||
return map;
|
||||
}
|
||||
|
||||
public List<String[]> getData(DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||
Datasource ds = datasourceMapper.selectByPrimaryKey(dataSetTableRequest.getDataSourceId());
|
||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class).getTable();
|
||||
|
||||
DatasetTableField datasetTableField = DatasetTableField.builder().build();
|
||||
datasetTableField.setTableId(dataSetTableRequest.getId());
|
||||
datasetTableField.setChecked(Boolean.TRUE);
|
||||
List<DatasetTableField> fields = dataSetTableFieldsService.list(datasetTableField);
|
||||
String[] fieldArray = fields.stream().map(DatasetTableField::getOriginName).toArray(String[]::new);
|
||||
datasourceRequest.setQuery(createQuerySQL(ds.getType(), table, fieldArray));
|
||||
|
||||
return datasourceProvider.getData(datasourceRequest);
|
||||
}
|
||||
|
||||
public Map<String, Object> getPreviewData(DataSetTableRequest dataSetTableRequest, Integer page, Integer pageSize) throws Exception {
|
||||
DatasetTableField datasetTableField = DatasetTableField.builder().build();
|
||||
datasetTableField.setTableId(dataSetTableRequest.getId());
|
||||
@ -209,15 +219,15 @@ public class DataSetTableService {
|
||||
datasourceRequest.setDatasource(ds);
|
||||
|
||||
String table = dataTableInfoDTO.getTable();
|
||||
datasourceRequest.setQuery(createQuerySQL(ds.getType(), table, fieldArray) + " LIMIT " + (page - 1) * pageSize + "," + realSize);
|
||||
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
try {
|
||||
data.addAll(datasourceProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(createQueryCountSQL(ds.getType(), table));
|
||||
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
|
||||
dataSetPreviewPage.setTotal(Integer.valueOf(datasourceProvider.getData(datasourceRequest).get(0)[0]));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -229,27 +239,27 @@ public class DataSetTableService {
|
||||
datasourceRequest.setDatasource(ds);
|
||||
|
||||
String sql = dataTableInfoDTO.getSql();
|
||||
datasourceRequest.setQuery(createQuerySQL(ds.getType(), " (" + sql + ") AS tmp ", fieldArray) + " LIMIT " + (page - 1) * pageSize + "," + realSize);
|
||||
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLAsTmpWithPage(sql, fields, page, pageSize, realSize));
|
||||
try {
|
||||
data.addAll(datasourceProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
datasourceRequest.setQuery(createQueryCountSQL(ds.getType(), " (" + sql + ") AS tmp "));
|
||||
datasourceRequest.setQuery(qp.createQueryCountSQLAsTmp(sql));
|
||||
dataSetPreviewPage.setTotal(Integer.valueOf(datasourceProvider.getData(datasourceRequest).get(0)[0]));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);;
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
datasourceRequest.setQuery(createQuerySQL(ds.getType(), table, fieldArray) + " LIMIT " + (page - 1) * pageSize + "," + realSize);
|
||||
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
@ -257,13 +267,31 @@ public class DataSetTableService {
|
||||
}
|
||||
|
||||
try {
|
||||
datasourceRequest.setQuery(createQueryCountSQL(ds.getType(), table));
|
||||
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
|
||||
dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0]));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createQuerySQLWithPage(table, fields, page, pageSize, realSize));
|
||||
try {
|
||||
data.addAll(jdbcProvider.getData(datasourceRequest));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
datasourceRequest.setQuery(qp.createQueryCountSQL(table));
|
||||
dataSetPreviewPage.setTotal(Integer.valueOf(jdbcProvider.getData(datasourceRequest).get(0)[0]));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
List<Map<String, Object>> jsonArray = new ArrayList<>();
|
||||
@ -291,7 +319,12 @@ public class DataSetTableService {
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String sql = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class).getSql();
|
||||
datasourceRequest.setQuery("SELECT * FROM (" + sql + ") AS tmp LIMIT 0,1000");
|
||||
// 使用输入的sql先预执行一次,并拿到所有字段
|
||||
datasourceRequest.setQuery(sql);
|
||||
List<TableFiled> previewFields = datasourceProvider.fetchResultField(datasourceRequest);
|
||||
// 正式执行
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createSQLPreview(sql, previewFields.get(0).getFieldName()));
|
||||
Map<String, List> result = datasourceProvider.fetchResultAndField(datasourceRequest);
|
||||
List<String[]> data = result.get("dataList");
|
||||
List<TableFiled> fields = result.get("fieldList");
|
||||
@ -315,6 +348,113 @@ public class DataSetTableService {
|
||||
return map;
|
||||
}
|
||||
|
||||
public Map<String, Object> getCustomPreview(DataSetTableRequest dataSetTableRequest) throws Exception {
|
||||
Datasource ds = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
// String table = DorisTableUtils.dorisName(dataSetTableRequest.getId());
|
||||
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class);
|
||||
List<DataSetTableUnionDTO> list = dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId());
|
||||
String sql = getCustomSQL(dataTableInfoDTO, list);
|
||||
// 使用输入的sql先预执行一次,并拿到所有字段
|
||||
datasourceRequest.setQuery(sql);
|
||||
List<TableFiled> previewFields = jdbcProvider.fetchResultField(datasourceRequest);
|
||||
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
datasourceRequest.setQuery(qp.createSQLPreview(sql, previewFields.get(0).getFieldName()));
|
||||
Map<String, List> result = jdbcProvider.fetchResultAndField(datasourceRequest);
|
||||
List<String[]> data = result.get("dataList");
|
||||
List<TableFiled> fields = result.get("fieldList");
|
||||
String[] fieldArray = fields.stream().map(TableFiled::getFieldName).toArray(String[]::new);
|
||||
|
||||
List<Map<String, Object>> jsonArray = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(data)) {
|
||||
jsonArray = data.stream().map(ele -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (int i = 0; i < ele.length; i++) {
|
||||
map.put(fieldArray[i], ele[i]);
|
||||
}
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 获取每个字段在当前de数据库中的name,作为sql查询后的remarks返回前端展示
|
||||
List<DatasetTableField> checkedFieldList = new ArrayList<>();
|
||||
dataTableInfoDTO.getList().forEach(ele -> {
|
||||
checkedFieldList.addAll(dataSetTableFieldsService.getListByIds(ele.getCheckedFields()));
|
||||
});
|
||||
for (DatasetTableField datasetTableField : checkedFieldList) {
|
||||
for (TableFiled tableFiled : fields) {
|
||||
if (StringUtils.equalsIgnoreCase(tableFiled.getFieldName(), DorisTableUtils.dorisFieldName(datasetTableField.getTableId() + "_" + datasetTableField.getDataeaseName()))) {
|
||||
tableFiled.setRemarks(datasetTableField.getName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("fields", fields);
|
||||
map.put("data", jsonArray);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
// 自助数据集从doris里预览数据
|
||||
private String getCustomSQL(DataTableInfoDTO dataTableInfoDTO, List<DataSetTableUnionDTO> list) {
|
||||
Map<String, String[]> customInfo = new TreeMap<>();
|
||||
dataTableInfoDTO.getList().forEach(ele -> {
|
||||
String table = DorisTableUtils.dorisName(ele.getTableId());
|
||||
List<DatasetTableField> fields = dataSetTableFieldsService.getListByIds(ele.getCheckedFields());
|
||||
String[] array = fields.stream().map(f -> table + "." + f.getDataeaseName() + " AS " + DorisTableUtils.dorisFieldName(ele.getTableId() + "_" + f.getDataeaseName())).toArray(String[]::new);
|
||||
customInfo.put(table, array);
|
||||
});
|
||||
DataTableInfoCustomUnion first = dataTableInfoDTO.getList().get(0);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
StringBuilder field = new StringBuilder();
|
||||
Iterator<Map.Entry<String, String[]>> iterator = customInfo.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<String, String[]> next = iterator.next();
|
||||
field.append(StringUtils.join(next.getValue(), ",")).append(",");
|
||||
}
|
||||
String f = field.substring(0, field.length() - 1);
|
||||
|
||||
StringBuilder join = new StringBuilder();
|
||||
for (DataTableInfoCustomUnion dataTableInfoCustomUnion : dataTableInfoDTO.getList()) {
|
||||
for (DataSetTableUnionDTO dto : list) {
|
||||
// 被关联表和自助数据集的表相等
|
||||
if (StringUtils.equals(dto.getTargetTableId(), dataTableInfoCustomUnion.getTableId())) {
|
||||
DatasetTableField sourceField = dataSetTableFieldsService.get(dto.getSourceTableFieldId());
|
||||
DatasetTableField targetField = dataSetTableFieldsService.get(dto.getTargetTableFieldId());
|
||||
join.append(convertUnionTypeToSQL(dto.getSourceUnionRelation()))
|
||||
.append(DorisTableUtils.dorisName(dto.getTargetTableId()))
|
||||
.append(" ON ")
|
||||
.append(DorisTableUtils.dorisName(dto.getSourceTableId())).append(".").append(sourceField.getDataeaseName())
|
||||
.append(" = ")
|
||||
.append(DorisTableUtils.dorisName(dto.getTargetTableId())).append(".").append(targetField.getDataeaseName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return MessageFormat.format("SELECT {0} FROM {1}", f, DorisTableUtils.dorisName(first.getTableId())) + join.toString();
|
||||
} else {
|
||||
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(customInfo.get(DorisTableUtils.dorisName(first.getTableId())), ","), DorisTableUtils.dorisName(first.getTableId()));
|
||||
}
|
||||
}
|
||||
|
||||
private String convertUnionTypeToSQL(String unionType) {
|
||||
switch (unionType) {
|
||||
case "1:1":
|
||||
return " INNER JOIN ";
|
||||
case "1:N":
|
||||
return " LEFT JOIN ";
|
||||
case "N:1":
|
||||
return " RIGHT JOIN ";
|
||||
default:
|
||||
return " INNER JOIN ";
|
||||
}
|
||||
}
|
||||
|
||||
public void saveTableField(DatasetTable datasetTable) throws Exception {
|
||||
Datasource ds = datasourceMapper.selectByPrimaryKey(datasetTable.getDataSourceId());
|
||||
DataSetTableRequest dataSetTableRequest = new DataSetTableRequest();
|
||||
@ -334,15 +474,34 @@ public class DataSetTableService {
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class);
|
||||
String path = dataTableInfoDTO.getData();
|
||||
File file = new File(path);
|
||||
// save field
|
||||
Map<String, Object> map = parseExcel(path.substring(path.lastIndexOf("/") + 1), new FileInputStream(file), false);
|
||||
fields = (List<TableFiled>) map.get("fields");
|
||||
List<Map<String, Object>> data = (List<Map<String, Object>>) map.get("data");
|
||||
// save data
|
||||
} else if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "custom")) {
|
||||
// save field
|
||||
|
||||
// save data
|
||||
DataTableInfoDTO dataTableInfoDTO = new Gson().fromJson(dataSetTableRequest.getInfo(), DataTableInfoDTO.class);
|
||||
List<DataTableInfoCustomUnion> list = dataTableInfoDTO.getList();
|
||||
List<DatasetTableField> fieldList = new ArrayList<>();
|
||||
list.forEach(ele -> {
|
||||
List<DatasetTableField> listByIds = dataSetTableFieldsService.getListByIds(ele.getCheckedFields());
|
||||
listByIds.forEach(f -> {
|
||||
f.setDataeaseName(DorisTableUtils.dorisFieldName(ele.getTableId() + "_" + f.getDataeaseName()));
|
||||
});
|
||||
fieldList.addAll(listByIds);
|
||||
});
|
||||
for (int i = 0; i < fieldList.size(); i++) {
|
||||
DatasetTableField datasetTableField = fieldList.get(i);
|
||||
datasetTableField.setId(null);
|
||||
datasetTableField.setTableId(datasetTable.getId());
|
||||
datasetTableField.setColumnIndex(i);
|
||||
}
|
||||
dataSetTableFieldsService.batchEdit(fieldList);
|
||||
// custom 创建doris视图
|
||||
createDorisView(DorisTableUtils.dorisName(datasetTable.getId()), getCustomSQL(dataTableInfoDTO, dataSetTableUnionService.listByTableId(dataTableInfoDTO.getList().get(0).getTableId())));
|
||||
return;
|
||||
}
|
||||
QueryProvider qp = null;
|
||||
if(!ObjectUtils.isEmpty(ds)) {
|
||||
qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(fields)) {
|
||||
for (int i = 0; i < fields.size(); i++) {
|
||||
@ -351,16 +510,19 @@ public class DataSetTableService {
|
||||
datasetTableField.setTableId(datasetTable.getId());
|
||||
datasetTableField.setOriginName(filed.getFieldName());
|
||||
datasetTableField.setName(filed.getRemarks());
|
||||
if(StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")){
|
||||
datasetTableField.setDataeaseName("C_" + Md5Utils.md5(filed.getFieldName()));
|
||||
}else {
|
||||
if (StringUtils.equalsIgnoreCase(datasetTable.getType(), "excel")) {
|
||||
datasetTableField.setDataeaseName(DorisTableUtils.excelColumnName(filed.getFieldName()));
|
||||
} else {
|
||||
datasetTableField.setDataeaseName(filed.getFieldName());
|
||||
}
|
||||
datasetTableField.setType(filed.getFieldType());
|
||||
if (ObjectUtils.isEmpty(ds)) {
|
||||
datasetTableField.setDeType(transFieldType(filed.getFieldType()));
|
||||
datasetTableField.setDeExtractType(transFieldType(filed.getFieldType()));
|
||||
} else {
|
||||
datasetTableField.setDeType(transFieldType(ds.getType(), filed.getFieldType()));
|
||||
Integer fieldType = qp.transFieldType(filed.getFieldType());
|
||||
datasetTableField.setDeType(fieldType == 4 ? 2 : fieldType);
|
||||
datasetTableField.setDeExtractType(fieldType);
|
||||
}
|
||||
datasetTableField.setSize(filed.getFieldSize());
|
||||
datasetTableField.setChecked(true);
|
||||
@ -371,28 +533,17 @@ public class DataSetTableService {
|
||||
}
|
||||
}
|
||||
|
||||
public String createQueryCountSQL(String type, String table) {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(type);
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
return MessageFormat.format("SELECT count(*) FROM {0}", table);
|
||||
case sqlServer:
|
||||
return MessageFormat.format("SELECT count(*) FROM {0}", table);
|
||||
default:
|
||||
return MessageFormat.format("SELECT count(*) FROM {0}", table);
|
||||
}
|
||||
}
|
||||
|
||||
public String createQuerySQL(String type, String table, String[] fields) {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(type);
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(fields, ","), table);
|
||||
case sqlServer:
|
||||
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(fields, ","), table);
|
||||
default:
|
||||
return MessageFormat.format("SELECT {0} FROM {1}", StringUtils.join(fields, ","), table);
|
||||
}
|
||||
private void createDorisView(String dorisTableName, String customSql) throws Exception {
|
||||
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(dorisDatasource);
|
||||
DDLProvider ddlProvider = ProviderFactory.getDDLProvider(dorisDatasource.getType());
|
||||
// 先删除表
|
||||
datasourceRequest.setQuery(ddlProvider.dropTableOrView(dorisTableName));
|
||||
jdbcProvider.exec(datasourceRequest);
|
||||
datasourceRequest.setQuery(ddlProvider.createView(dorisTableName, customSql));
|
||||
jdbcProvider.exec(datasourceRequest);
|
||||
}
|
||||
|
||||
public Integer transFieldType(String field) {
|
||||
@ -410,50 +561,6 @@ public class DataSetTableService {
|
||||
}
|
||||
}
|
||||
|
||||
public Integer transFieldType(String type, String field) {
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(type);
|
||||
switch (datasourceType) {
|
||||
case mysql:
|
||||
return transMysqlField(field);
|
||||
case sqlServer:
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer transMysqlField(String field) {
|
||||
switch (field) {
|
||||
case "CHAR":
|
||||
case "VARCHAR":
|
||||
case "TEXT":
|
||||
case "TINYTEXT":
|
||||
case "MEDIUMTEXT":
|
||||
case "LONGTEXT":
|
||||
case "ENUM":
|
||||
return 0;// 文本
|
||||
case "DATE":
|
||||
case "TIME":
|
||||
case "YEAR":
|
||||
case "DATETIME":
|
||||
case "TIMESTAMP":
|
||||
return 1;// 时间
|
||||
case "INT":
|
||||
case "BIT":
|
||||
case "TINYINT":
|
||||
case "SMALLINT":
|
||||
case "MEDIUMINT":
|
||||
case "INTEGER":
|
||||
case "BIGINT":
|
||||
return 2;// 整型
|
||||
case "FLOAT":
|
||||
case "DOUBLE":
|
||||
case "DECIMAL":
|
||||
return 3;// 浮点
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public DatasetTableIncrementalConfig incrementalConfig(DatasetTableIncrementalConfig datasetTableIncrementalConfig) {
|
||||
if (StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())) {
|
||||
return new DatasetTableIncrementalConfig();
|
||||
@ -476,13 +583,14 @@ public class DataSetTableService {
|
||||
|
||||
|
||||
public void saveIncrementalConfig(DatasetTableIncrementalConfig datasetTableIncrementalConfig) {
|
||||
if (datasetTableIncrementalConfig == null || StringUtils.isEmpty(datasetTableIncrementalConfig.getTableId())) {
|
||||
return;
|
||||
}
|
||||
if (StringUtils.isEmpty(datasetTableIncrementalConfig.getId())) {
|
||||
datasetTableIncrementalConfig.setId(UUID.randomUUID().toString());
|
||||
datasetTableIncrementalConfigMapper.insertSelective(datasetTableIncrementalConfig);
|
||||
} else {
|
||||
DatasetTableIncrementalConfigExample example = new DatasetTableIncrementalConfigExample();
|
||||
example.createCriteria().andTableIdEqualTo(datasetTableIncrementalConfig.getTableId());
|
||||
datasetTableIncrementalConfigMapper.updateByExample(datasetTableIncrementalConfig, example);
|
||||
datasetTableIncrementalConfigMapper.updateByPrimaryKey(datasetTableIncrementalConfig);
|
||||
}
|
||||
}
|
||||
|
||||
@ -556,6 +664,9 @@ public class DataSetTableService {
|
||||
tableFiled.setFieldName(readCell(row.getCell(j)));
|
||||
tableFiled.setRemarks(readCell(row.getCell(j)));
|
||||
tableFiled.setFieldType("TEXT");
|
||||
if(StringUtils.isEmpty(tableFiled.getFieldName())){
|
||||
continue;
|
||||
}
|
||||
fields.add(tableFiled);
|
||||
} else {
|
||||
r[j] = readCell(row.getCell(j));
|
||||
@ -674,4 +785,15 @@ public class DataSetTableService {
|
||||
fileOutputStream.close();
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public Boolean checkDorisTableIsExists(String id) throws Exception {
|
||||
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(dorisDatasource);
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(dorisDatasource.getType());
|
||||
datasourceRequest.setQuery(qp.searchTable(DorisTableUtils.dorisName(id)));
|
||||
List<String[]> data = jdbcProvider.getData(datasourceRequest);
|
||||
return CollectionUtils.isNotEmpty(data);
|
||||
}
|
||||
}
|
||||
|
||||
@ -39,12 +39,6 @@ public class DataSetTableTaskLogService {
|
||||
}
|
||||
|
||||
public List<DataSetTaskLogDTO> list(DatasetTableTaskLog request) {
|
||||
DatasetTableTaskLogExample datasetTableTaskLogExample = new DatasetTableTaskLogExample();
|
||||
DatasetTableTaskLogExample.Criteria criteria = datasetTableTaskLogExample.createCriteria();
|
||||
if (StringUtils.isNotEmpty(request.getTableId())) {
|
||||
criteria.andTableIdEqualTo(request.getTableId());
|
||||
}
|
||||
datasetTableTaskLogExample.setOrderByClause("create_time desc");
|
||||
return extDataSetTaskMapper.list(request);
|
||||
}
|
||||
|
||||
|
||||
@ -19,12 +19,20 @@ import io.dataease.datasource.provider.ProviderFactory;
|
||||
import io.dataease.datasource.request.DatasourceRequest;
|
||||
import io.dataease.dto.dataset.DataSetTaskLogDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.pentaho.di.cluster.SlaveServer;
|
||||
import org.pentaho.di.core.database.DatabaseMeta;
|
||||
import org.pentaho.di.core.row.ValueMetaInterface;
|
||||
import org.pentaho.di.core.util.HttpClientManager;
|
||||
import org.pentaho.di.core.util.Utils;
|
||||
import org.pentaho.di.job.Job;
|
||||
import org.pentaho.di.job.JobExecutionConfiguration;
|
||||
import org.pentaho.di.job.JobHopMeta;
|
||||
@ -53,7 +61,10 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.naming.AuthenticationException;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@ -99,13 +110,17 @@ public class ExtractDataService {
|
||||
private static String shellScript = "curl --location-trusted -u %s:%s -H \"label:%s\" -H \"column_separator:%s\" -H \"columns:%s\" -H \"merge_type: %s\" -T %s -XPUT http://%s:%s/api/%s/%s/_stream_load\n" +
|
||||
"rm -rf %s\n";
|
||||
|
||||
private String createDorisTablColumnSql( List<DatasetTableField> datasetTableFields){
|
||||
private String createDorisTablColumnSql(List<DatasetTableField> datasetTableFields) {
|
||||
String Column_Fields = "dataease_uuid varchar(50), `";
|
||||
for (DatasetTableField datasetTableField : datasetTableFields) {
|
||||
Column_Fields = Column_Fields + datasetTableField.getDataeaseName() + "` ";
|
||||
switch (datasetTableField.getDeType()){
|
||||
switch (datasetTableField.getDeExtractType()) {
|
||||
case 0:
|
||||
Column_Fields = Column_Fields + "varchar(lenth)".replace("lenth", String.valueOf(datasetTableField.getSize())) + ",`";
|
||||
if (datasetTableField.getSize() > 65533) {
|
||||
Column_Fields = Column_Fields + "String" + ",`";
|
||||
} else {
|
||||
Column_Fields = Column_Fields + "varchar(lenth)".replace("lenth", String.valueOf(datasetTableField.getSize())) + ",`";
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
Column_Fields = Column_Fields + "varchar(lenth)".replace("lenth", String.valueOf(datasetTableField.getSize())) + ",`";
|
||||
@ -116,28 +131,33 @@ public class ExtractDataService {
|
||||
case 3:
|
||||
Column_Fields = Column_Fields + "DOUBLE" + ",`";
|
||||
break;
|
||||
case 4:
|
||||
Column_Fields = Column_Fields + "TINYINT(lenth)".replace("lenth", String.valueOf(datasetTableField.getSize())) + ",`";
|
||||
break;
|
||||
default:
|
||||
Column_Fields = Column_Fields + "varchar(lenth)".replace("lenth", String.valueOf(datasetTableField.getSize())) + ",";
|
||||
Column_Fields = Column_Fields + "varchar(lenth)".replace("lenth", String.valueOf(datasetTableField.getSize())) + ",`";
|
||||
break;
|
||||
}
|
||||
}
|
||||
Column_Fields = Column_Fields.substring(0, Column_Fields.length() -2);
|
||||
Column_Fields = "(" + Column_Fields + ")\n";
|
||||
Column_Fields = Column_Fields.substring(0, Column_Fields.length() - 2);
|
||||
Column_Fields = "(" + Column_Fields + ")\n";
|
||||
return Column_Fields;
|
||||
}
|
||||
|
||||
private void createDorisTable(String dorisTableName, String dorisTablColumnSql) throws Exception{
|
||||
Datasource dorisDatasource = (Datasource)CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);;
|
||||
private void createDorisTable(String dorisTableName, String dorisTablColumnSql) throws Exception {
|
||||
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
;
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(dorisDatasource);
|
||||
datasourceRequest.setQuery(creatTableSql.replace("TABLE_NAME", dorisTableName).replace("Column_Fields", dorisTablColumnSql));
|
||||
jdbcProvider.exec(datasourceRequest);
|
||||
}
|
||||
|
||||
private void replaceTable (String dorisTableName) throws Exception{
|
||||
Datasource dorisDatasource = (Datasource)CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);;
|
||||
private void replaceTable(String dorisTableName) throws Exception {
|
||||
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
JdbcProvider jdbcProvider = CommonBeanFactory.getBean(JdbcProvider.class);
|
||||
;
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(dorisDatasource);
|
||||
datasourceRequest.setQuery("ALTER TABLE DORIS_TABLE REPLACE WITH TABLE DORIS_TMP_TABLE PROPERTIES('swap' = 'false');".replace("DORIS_TABLE", dorisTableName).replace("DORIS_TMP_TABLE", DorisTableUtils.dorisTmpName(dorisTableName)));
|
||||
@ -151,9 +171,9 @@ public class ExtractDataService {
|
||||
Datasource datasource = new Datasource();
|
||||
try {
|
||||
datasetTable = dataSetTableService.get(datasetTableId);
|
||||
if(StringUtils.isNotEmpty(datasetTable.getDataSourceId())){
|
||||
if (StringUtils.isNotEmpty(datasetTable.getDataSourceId())) {
|
||||
datasource = datasourceMapper.selectByPrimaryKey(datasetTable.getDataSourceId());
|
||||
}else {
|
||||
} else {
|
||||
datasource.setType(datasetTable.getType());
|
||||
}
|
||||
|
||||
@ -167,11 +187,8 @@ public class ExtractDataService {
|
||||
}
|
||||
return o1.getColumnIndex().compareTo(o2.getColumnIndex());
|
||||
});
|
||||
for (DatasetTableField datasetTableField : datasetTableFields) {
|
||||
System.out.println(new Gson().toJson(datasetTableField));
|
||||
}
|
||||
|
||||
String dorisTablColumnSql = createDorisTablColumnSql(datasetTableFields);
|
||||
System.out.println(dorisTablColumnSql);
|
||||
switch (updateType) {
|
||||
// 全量更新
|
||||
case all_scope:
|
||||
@ -227,9 +244,9 @@ public class ExtractDataService {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
LogUtil.error("ExtractData error, dataaset: " + datasetTableId);
|
||||
LogUtil.error(e.getMessage(), e);
|
||||
LogUtil.error("Extract data error: " + datasetTableId, e);
|
||||
datasetTableTaskLog.setStatus(JobStatus.Error.name());
|
||||
datasetTableTaskLog.setInfo(ExceptionUtils.getStackTrace(e));
|
||||
datasetTableTaskLog.setEndTime(System.currentTimeMillis());
|
||||
dataSetTableTaskLogService.save(datasetTableTaskLog);
|
||||
} finally {
|
||||
@ -274,10 +291,10 @@ public class ExtractDataService {
|
||||
String lastCarteObjectId = Job.sendToSlaveServer(jobMeta, jobExecutionConfiguration, repository, null);
|
||||
SlaveServerJobStatus jobStatus = null;
|
||||
boolean executing = true;
|
||||
while(executing) {
|
||||
while (executing) {
|
||||
jobStatus = remoteSlaveServer.getJobStatus(jobMeta.getName(), lastCarteObjectId, 0);
|
||||
executing = jobStatus.isRunning() || jobStatus.isWaiting();
|
||||
if(!executing)
|
||||
if (!executing)
|
||||
break;
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
@ -306,7 +323,7 @@ public class ExtractDataService {
|
||||
String dorisOutputTable = null;
|
||||
String jobName = null;
|
||||
String script = null;
|
||||
Datasource dorisDatasource = (Datasource)CommonBeanFactory.getBean("DorisDatasource");
|
||||
Datasource dorisDatasource = (Datasource) CommonBeanFactory.getBean("DorisDatasource");
|
||||
DorisConfigration dorisConfigration = new Gson().fromJson(dorisDatasource.getConfiguration(), DorisConfigration.class);
|
||||
String columns = columnFeilds + ",dataease_uuid";
|
||||
String transName = null;
|
||||
@ -315,18 +332,18 @@ public class ExtractDataService {
|
||||
transName = "trans_" + datasetTable.getId();
|
||||
dorisOutputTable = DorisTableUtils.dorisTmpName(DorisTableUtils.dorisName(datasetTable.getId()));
|
||||
jobName = "job_" + datasetTable.getId();
|
||||
script = String.format(shellScript, dorisConfigration.getUsername(), dorisConfigration.getPassword(), String.valueOf(System.currentTimeMillis()), separator, columns, "APPEND",root_path + dorisOutputTable + "." + extention, dorisConfigration.getHost(),dorisConfigration.getHttpPort(), dorisConfigration.getDataBase(), dorisOutputTable, root_path + dorisOutputTable + "." + extention);
|
||||
script = String.format(shellScript, dorisConfigration.getUsername(), dorisConfigration.getPassword(), String.valueOf(System.currentTimeMillis()), separator, columns, "APPEND", root_path + dorisOutputTable + "." + extention, dorisConfigration.getHost(), dorisConfigration.getHttpPort(), dorisConfigration.getDataBase(), dorisOutputTable, root_path + dorisOutputTable + "." + extention);
|
||||
break;
|
||||
case "incremental_add":
|
||||
transName = "trans_add_" + datasetTable.getId();
|
||||
dorisOutputTable = DorisTableUtils.dorisName(datasetTable.getId());
|
||||
jobName = "job_add_" + datasetTable.getId();
|
||||
script = String.format(shellScript, dorisConfigration.getUsername(), dorisConfigration.getPassword(), String.valueOf(System.currentTimeMillis()), separator, columns, "APPEND", root_path + dorisOutputTable + "." + extention, dorisConfigration.getHost(),dorisConfigration.getHttpPort(), dorisConfigration.getDataBase(), dorisOutputTable, root_path + dorisOutputTable + "." + extention);
|
||||
script = String.format(shellScript, dorisConfigration.getUsername(), dorisConfigration.getPassword(), String.valueOf(System.currentTimeMillis()), separator, columns, "APPEND", root_path + dorisOutputTable + "." + extention, dorisConfigration.getHost(), dorisConfigration.getHttpPort(), dorisConfigration.getDataBase(), dorisOutputTable, root_path + dorisOutputTable + "." + extention);
|
||||
break;
|
||||
case "incremental_delete":
|
||||
transName = "trans_delete_" + datasetTable.getId();
|
||||
dorisOutputTable = DorisTableUtils.dorisDeleteName(DorisTableUtils.dorisName(datasetTable.getId()));
|
||||
script = String.format(shellScript, dorisConfigration.getUsername(), dorisConfigration.getPassword(), String.valueOf(System.currentTimeMillis()), separator, columns, "DELETE", root_path + dorisOutputTable + "." + extention, dorisConfigration.getHost(),dorisConfigration.getHttpPort(), dorisConfigration.getDataBase(), DorisTableUtils.dorisName(datasetTable.getId()), root_path + dorisOutputTable + "." + extention);
|
||||
script = String.format(shellScript, dorisConfigration.getUsername(), dorisConfigration.getPassword(), String.valueOf(System.currentTimeMillis()), separator, columns, "DELETE", root_path + dorisOutputTable + "." + extention, dorisConfigration.getHost(), dorisConfigration.getHttpPort(), dorisConfigration.getDataBase(), DorisTableUtils.dorisName(datasetTable.getId()), root_path + dorisOutputTable + "." + extention);
|
||||
jobName = "job_delete_" + datasetTable.getId();
|
||||
break;
|
||||
default:
|
||||
@ -388,14 +405,14 @@ public class ExtractDataService {
|
||||
FileUtils.writeStringToFile(file, jobXml, "UTF-8");
|
||||
}
|
||||
|
||||
private String fetchSqlField(String sql, Datasource ds)throws Exception{
|
||||
private String fetchSqlField(String sql, Datasource ds) throws Exception {
|
||||
String tmpSql = sql;
|
||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
if(tmpSql.trim().endsWith(";")){
|
||||
tmpSql = tmpSql.substring(0, tmpSql.length() -1 ) + " limit 0";
|
||||
}else {
|
||||
if (tmpSql.trim().endsWith(";")) {
|
||||
tmpSql = tmpSql.substring(0, tmpSql.length() - 1) + " limit 0";
|
||||
} else {
|
||||
tmpSql = tmpSql + " limit 0";
|
||||
}
|
||||
datasourceRequest.setQuery(tmpSql);
|
||||
@ -419,9 +436,10 @@ public class ExtractDataService {
|
||||
MysqlConfigration mysqlConfigration = new Gson().fromJson(datasource.getConfiguration(), MysqlConfigration.class);
|
||||
dataMeta = new DatabaseMeta("db", "MYSQL", "Native", mysqlConfigration.getHost(), mysqlConfigration.getDataBase(), mysqlConfigration.getPort().toString(), mysqlConfigration.getUsername(), mysqlConfigration.getPassword());
|
||||
transMeta.addDatabase(dataMeta);
|
||||
if(extractType.equalsIgnoreCase("all_scope")){
|
||||
if (extractType.equalsIgnoreCase("all_scope")) {
|
||||
String tableName = new Gson().fromJson(datasetTable.getInfo(), DataTableInfoDTO.class).getTable();
|
||||
selectSQL = dataSetTableService.createQuerySQL(datasource.getType(), tableName, datasetTableFields.stream().map(DatasetTableField::getDataeaseName).toArray(String[]::new));
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(datasource.getType());
|
||||
selectSQL = qp.createQuerySQL(tableName, datasetTableFields);
|
||||
}
|
||||
inputStep = inputStep(transMeta, selectSQL);
|
||||
break;
|
||||
@ -467,7 +485,7 @@ public class ExtractDataService {
|
||||
FileUtils.writeStringToFile(file, transXml, "UTF-8");
|
||||
}
|
||||
|
||||
private StepMeta inputStep(TransMeta transMeta, String selectSQL){
|
||||
private StepMeta inputStep(TransMeta transMeta, String selectSQL) {
|
||||
TableInputMeta tableInput = new TableInputMeta();
|
||||
DatabaseMeta database = transMeta.findDatabase("db");
|
||||
tableInput.setDatabaseMeta(database);
|
||||
@ -478,14 +496,15 @@ public class ExtractDataService {
|
||||
return fromStep;
|
||||
}
|
||||
|
||||
private StepMeta excelInputStep(String filePath, List<DatasetTableField> datasetTableFields){
|
||||
private StepMeta excelInputStep(String filePath, List<DatasetTableField> datasetTableFields) {
|
||||
ExcelInputMeta excelInputMeta = new ExcelInputMeta();
|
||||
excelInputMeta.setSpreadSheetType(SpreadSheetType.SAX_POI);
|
||||
excelInputMeta.setPassword("Encrypted");
|
||||
excelInputMeta.setFileName(new String[]{filePath});
|
||||
excelInputMeta.setStartsWithHeader(true);
|
||||
excelInputMeta.setIgnoreEmptyRows(true);
|
||||
ExcelInputField[] fields = new ExcelInputField[datasetTableFields.size()];
|
||||
for (int i=0; i<datasetTableFields.size();i++) {
|
||||
for (int i = 0; i < datasetTableFields.size(); i++) {
|
||||
ExcelInputField field = new ExcelInputField();
|
||||
field.setName(datasetTableFields.get(i).getOriginName());
|
||||
field.setType("String");
|
||||
@ -499,7 +518,7 @@ public class ExtractDataService {
|
||||
return fromStep;
|
||||
}
|
||||
|
||||
private StepMeta outputStep(String dorisOutputTable){
|
||||
private StepMeta outputStep(String dorisOutputTable) {
|
||||
TextFileOutputMeta textFileOutputMeta = new TextFileOutputMeta();
|
||||
textFileOutputMeta.setEncoding("UTF-8");
|
||||
textFileOutputMeta.setHeaderEnabled(false);
|
||||
@ -513,7 +532,14 @@ public class ExtractDataService {
|
||||
return outputStep;
|
||||
}
|
||||
|
||||
private StepMeta udjc(List<DatasetTableField> datasetTableFields){
|
||||
private StepMeta udjc(List<DatasetTableField> datasetTableFields) {
|
||||
String needToChangeolumnType = "";
|
||||
for (DatasetTableField datasetTableField : datasetTableFields) {
|
||||
if (datasetTableField.getDeExtractType() != null && datasetTableField.getDeExtractType() == 4) {
|
||||
needToChangeolumnType = needToChangeolumnType + alterColumnTypeCode.replace("FILED", datasetTableField.getOriginName());
|
||||
}
|
||||
}
|
||||
|
||||
UserDefinedJavaClassMeta userDefinedJavaClassMeta = new UserDefinedJavaClassMeta();
|
||||
List<UserDefinedJavaClassMeta.FieldInfo> fields = new ArrayList<>();
|
||||
UserDefinedJavaClassMeta.FieldInfo fieldInfo = new UserDefinedJavaClassMeta.FieldInfo("dataease_uuid", ValueMetaInterface.TYPE_STRING, -1, -1);
|
||||
@ -521,7 +547,8 @@ public class ExtractDataService {
|
||||
userDefinedJavaClassMeta.setFieldInfo(fields);
|
||||
List<UserDefinedJavaClassDef> definitions = new ArrayList<UserDefinedJavaClassDef>();
|
||||
UserDefinedJavaClassDef userDefinedJavaClassDef = new UserDefinedJavaClassDef(UserDefinedJavaClassDef.ClassType.TRANSFORM_CLASS, "Processor",
|
||||
code.replace("Column_Fields", String.join(",", datasetTableFields.stream().map(DatasetTableField::getOriginName).collect(Collectors.toList()))));
|
||||
code.replace("alterColumnTypeCode", needToChangeolumnType).replace("Column_Fields", String.join(",", datasetTableFields.stream().map(DatasetTableField::getOriginName).collect(Collectors.toList()))));
|
||||
|
||||
userDefinedJavaClassDef.setActive(true);
|
||||
definitions.add(userDefinedJavaClassDef);
|
||||
userDefinedJavaClassMeta.replaceDefinitions(definitions);
|
||||
@ -529,9 +556,42 @@ public class ExtractDataService {
|
||||
StepMeta userDefinedJavaClassStep = new StepMeta("UserDefinedJavaClass", "UserDefinedJavaClass", userDefinedJavaClassMeta);
|
||||
userDefinedJavaClassStep.setLocation(300, 100);
|
||||
userDefinedJavaClassStep.setDraw(true);
|
||||
return userDefinedJavaClassStep;
|
||||
return userDefinedJavaClassStep;
|
||||
}
|
||||
|
||||
public boolean isKettleRunning() {
|
||||
try {
|
||||
if (!InetAddress.getByName(carte).isReachable(1000)) {
|
||||
return false;
|
||||
}
|
||||
HttpClient httpClient;
|
||||
HttpGet getMethod = new HttpGet("http://" + carte + ":" + port);
|
||||
HttpClientManager.HttpClientBuilderFacade clientBuilder = HttpClientManager.getInstance().createBuilder();
|
||||
clientBuilder.setConnectionTimeout(1);
|
||||
clientBuilder.setCredentials(user, passwd);
|
||||
httpClient = clientBuilder.build();
|
||||
HttpResponse httpResponse = httpClient.execute(getMethod);
|
||||
int statusCode = httpResponse.getStatusLine().getStatusCode();
|
||||
if (statusCode != -1 && statusCode < 400) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static String alterColumnTypeCode = " if(\"FILED\".equalsIgnoreCase(filed)){\n" +
|
||||
"\t if(tmp != null && tmp.equalsIgnoreCase(\"Y\")){\n" +
|
||||
" get(Fields.Out, filed).setValue(r, 1);\n" +
|
||||
" get(Fields.Out, filed).getValueMeta().setType(2);\n" +
|
||||
" }else{\n" +
|
||||
" get(Fields.Out, filed).setValue(r, 0);\n" +
|
||||
" get(Fields.Out, filed).getValueMeta().setType(2);\n" +
|
||||
" }\n" +
|
||||
" }\n";
|
||||
|
||||
private static String code = "import org.pentaho.di.core.row.ValueMetaInterface;\n" +
|
||||
"import java.util.List;\n" +
|
||||
"import java.io.File;\n" +
|
||||
@ -561,6 +621,7 @@ public class ExtractDataService {
|
||||
" List<String> fileds = Arrays.asList(\"Column_Fields\".split(\",\"));\n" +
|
||||
" for (String filed : fileds) {\n" +
|
||||
" String tmp = get(Fields.In, filed).getString(r);\n" +
|
||||
"alterColumnTypeCode \n" +
|
||||
" str = str + tmp;\n" +
|
||||
" }\n" +
|
||||
"\n" +
|
||||
|
||||
@ -7,6 +7,7 @@ import io.dataease.datasource.provider.DatasourceProvider;
|
||||
import io.dataease.datasource.provider.ProviderFactory;
|
||||
import io.dataease.datasource.request.DatasourceRequest;
|
||||
import io.dataease.datasource.service.DatasourceService;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
import io.dataease.service.dataset.DataSetFieldService;
|
||||
import io.dataease.service.dataset.DataSetTableFieldsService;
|
||||
import io.dataease.service.dataset.DataSetTableService;
|
||||
@ -17,6 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -46,18 +48,19 @@ public class DirectFieldService implements DataSetFieldService {
|
||||
|
||||
DatasetTableField field = list.get(0);
|
||||
String tableId = field.getTableId();
|
||||
if (StringUtils.isEmpty(tableId))return null;
|
||||
if (StringUtils.isEmpty(tableId)) return null;
|
||||
DatasetTable datasetTable = dataSetTableService.get(tableId);
|
||||
if (ObjectUtils.isEmpty(datasetTable) || StringUtils.isEmpty(datasetTable.getName())) return null;
|
||||
String tableName = datasetTable.getName();
|
||||
|
||||
String dataSourceId = datasetTable.getDataSourceId();
|
||||
if( StringUtils.isEmpty(dataSourceId)) return null;
|
||||
if (StringUtils.isEmpty(dataSourceId)) return null;
|
||||
Datasource ds = datasourceService.get(dataSourceId);
|
||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(ds.getType());
|
||||
DatasourceRequest datasourceRequest = new DatasourceRequest();
|
||||
datasourceRequest.setDatasource(ds);
|
||||
String querySQL = dataSetTableService.createQuerySQL(ds.getType(), tableName, new String[]{field.getOriginName()});
|
||||
QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType());
|
||||
String querySQL = qp.createQuerySQL(tableName, Collections.singletonList(field));
|
||||
datasourceRequest.setQuery(querySQL);
|
||||
try {
|
||||
List<String[]> rows = datasourceProvider.getData(datasourceRequest);
|
||||
|
||||
134
backend/src/main/java/io/dataease/service/sys/PluginService.java
Normal file
134
backend/src/main/java/io/dataease/service/sys/PluginService.java
Normal file
@ -0,0 +1,134 @@
|
||||
package io.dataease.service.sys;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.base.domain.MyPlugin;
|
||||
import io.dataease.base.mapper.MyPluginMapper;
|
||||
import io.dataease.base.mapper.ext.ExtSysPluginMapper;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.DeFileUtils;
|
||||
import io.dataease.commons.utils.ZipUtils;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
import io.dataease.plugins.config.LoadjarUtil;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
public class PluginService {
|
||||
|
||||
@Value("${dataease.plugin.dir:/opt/dataease/plugins/}")
|
||||
private String pluginDir;
|
||||
|
||||
private final static String pluginJsonName = "plugin.json";
|
||||
|
||||
@Resource
|
||||
private ExtSysPluginMapper extSysPluginMapper;
|
||||
|
||||
@Resource
|
||||
private MyPluginMapper myPluginMapper;
|
||||
|
||||
@Resource
|
||||
private LoadjarUtil loadjarUtil;
|
||||
|
||||
public List<MyPlugin> query(BaseGridRequest request) {
|
||||
GridExample gridExample = request.convertExample();
|
||||
List<MyPlugin> results = extSysPluginMapper.query(gridExample);
|
||||
return results;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从本地安装处插件
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> localInstall(MultipartFile file) {
|
||||
//1.上传文件到服务器pluginDir目录下
|
||||
File dest = DeFileUtils.upload(file, pluginDir+"temp/");
|
||||
//2.解压目标文件dest 得到plugin.json和jar
|
||||
String folder = pluginDir+"folder/";
|
||||
try {
|
||||
ZipUtils.upZipFile(dest, folder);
|
||||
} catch (IOException e) {
|
||||
// 需要删除文件
|
||||
e.printStackTrace();
|
||||
}
|
||||
//3.解析plugin.json 失败则 直接返回错误 删除文件
|
||||
File folderFile = new File(folder);
|
||||
File[] jsonFiles = folderFile.listFiles(this::isPluginJson);
|
||||
if (ArrayUtils.isEmpty(jsonFiles)) {
|
||||
throw new RuntimeException("缺少插件描述文件");
|
||||
}
|
||||
MyPlugin myPlugin = formatJsonFile(jsonFiles[0]);
|
||||
//4.加载jar包 失败则 直接返回错误 删除文件
|
||||
File[] jarFiles = folderFile.listFiles(this::isPluginJar);
|
||||
if (ArrayUtils.isEmpty(jarFiles)) {
|
||||
throw new RuntimeException("缺少插件jar文件");
|
||||
}
|
||||
File jarFile = jarFiles[0];
|
||||
String jarRoot = pluginDir+"jar/";
|
||||
String jarPath = null;
|
||||
try {
|
||||
jarPath = DeFileUtils.copy(jarFile, jarRoot);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
loadjarUtil.loadJar(jarPath);
|
||||
//5.写表到my_plugin
|
||||
myPlugin.setPluginId(0L);
|
||||
myPluginMapper.insert(myPlugin);
|
||||
return null;
|
||||
}
|
||||
|
||||
//判断当前文件是否实插件描述文件
|
||||
//文件名称必须plugin.json
|
||||
private boolean isPluginJson(File file) {
|
||||
return StringUtils.equals(file.getName(), pluginJsonName);
|
||||
}
|
||||
|
||||
private boolean isPluginJar(File file) {
|
||||
String name = file.getName();
|
||||
return StringUtils.equals(DeFileUtils.getExtensionName(name), "jar");
|
||||
}
|
||||
|
||||
/**
|
||||
* 从plugin.json文件反序列化为MyPlugin实例对象
|
||||
* @return
|
||||
*/
|
||||
private MyPlugin formatJsonFile(File file) {
|
||||
String str = DeFileUtils.readJson(file);
|
||||
Gson gson = new Gson();
|
||||
Map<String, Object> myPlugin = gson.fromJson(str, Map.class);
|
||||
myPlugin.put("free", (Double)myPlugin.get("free") > 0.0);
|
||||
MyPlugin result = new MyPlugin();
|
||||
try {
|
||||
org.apache.commons.beanutils.BeanUtils.populate(result, myPlugin);
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//BeanUtils.copyBean(result, myPlugin);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从插件商城远程安装插件
|
||||
* 2.0版本实现
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> remoteInstall(Map<String, Object> params) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
package io.dataease.service.sys;
|
||||
|
||||
import io.dataease.auth.api.dto.CurrentUserDto;
|
||||
import io.dataease.base.domain.SysUser;
|
||||
import io.dataease.base.domain.SysUserExample;
|
||||
import io.dataease.base.domain.SysUsersRolesExample;
|
||||
@ -9,6 +10,7 @@ import io.dataease.base.mapper.SysUsersRolesMapper;
|
||||
import io.dataease.base.mapper.ext.ExtSysUserMapper;
|
||||
import io.dataease.base.mapper.ext.query.GridExample;
|
||||
import io.dataease.commons.constants.AuthConstants;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.CodingUtil;
|
||||
import io.dataease.controller.sys.base.BaseGridRequest;
|
||||
@ -89,6 +91,22 @@ public class SysUserService {
|
||||
deleteUserRoles(user.getUserId());//先删除用户角色关联
|
||||
saveUserRoles(user.getUserId(), request.getRoleIds());//再插入角色关联
|
||||
return sysUserMapper.updateByPrimaryKey(user);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户修改个人信息
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
@Transactional
|
||||
public int updatePersonInfo(SysUserCreateRequest request){
|
||||
SysUser user = BeanUtils.copyBean(new SysUser(), request);
|
||||
long now = System.currentTimeMillis();
|
||||
user.setUpdateTime(now);
|
||||
return sysUserMapper.updateByPrimaryKeySelective(user);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -107,20 +125,16 @@ public class SysUserService {
|
||||
*/
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #request.userId")
|
||||
public int updatePwd(SysUserPwdRequest request) {
|
||||
if (!StringUtils.equals(request.getPassword(), request.getRepeatPassword())){
|
||||
throw new RuntimeException("两次密码不一致");
|
||||
}
|
||||
SysUser temp = new SysUser();
|
||||
temp.setUserId(request.getUserId());
|
||||
SysUser user = findOne(temp);
|
||||
CurrentUserDto user = AuthUtils.getUser();
|
||||
|
||||
if (ObjectUtils.isEmpty(user)) {
|
||||
throw new RuntimeException("用户不存在");
|
||||
}
|
||||
if (!StringUtils.equals(request.getPassword(), user.getPassword())){
|
||||
if (!StringUtils.equals(CodingUtil.md5(request.getPassword()), user.getPassword())){
|
||||
throw new RuntimeException("密码错误");
|
||||
}
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(request.getUserId());
|
||||
sysUser.setUserId(user.getUserId());
|
||||
sysUser.setPassword(CodingUtil.md5(request.getNewPassword()));
|
||||
return sysUserMapper.updateByPrimaryKeySelective(sysUser);
|
||||
}
|
||||
@ -187,4 +201,12 @@ public class SysUserService {
|
||||
return userIds.stream().map(sysUserMapper::selectByPrimaryKey).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@CacheEvict(value = AuthConstants.USER_CACHE_NAME, key = "'user' + #userId")
|
||||
public void setLanguage(Long userId,String language) {
|
||||
SysUser sysUser = new SysUser();
|
||||
sysUser.setUserId(userId);
|
||||
sysUser.setLanguage(language);
|
||||
sysUserMapper.updateByPrimaryKeySelective(sysUser);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -220,6 +220,7 @@ public class SystemParameterService {
|
||||
|
||||
public void saveUIInfo(Map<String,List<SystemParameterDTO>> request, List<MultipartFile> bodyFiles) throws IOException {
|
||||
List<SystemParameterDTO> parameters = request.get("systemParams");
|
||||
if (null != bodyFiles)
|
||||
for (MultipartFile multipartFile : bodyFiles) {
|
||||
if (!multipartFile.isEmpty()) {
|
||||
//防止添加非图片文件
|
||||
|
||||
@ -61,13 +61,8 @@ logging.level.org.springframework.boot.web=trace
|
||||
spring.mvc.log-request-details=true
|
||||
pagehelper.PageRowBounds=true
|
||||
#excel等用户上传文件路径
|
||||
upload.file.path=/opt/dataease/data/upload/
|
||||
|
||||
#初始密码和登录超时时间移到/opt/dataease/conf/dataease.properties
|
||||
#用户初始密码,如果不设置默认是DataEase123..
|
||||
#dataease.init_password=DataEase123456
|
||||
#登录超时时间单位min
|
||||
#dataease.login_timeout=480
|
||||
upload.file.path=/opt/dataease/data/kettle/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
-- chart start
|
||||
DROP TABLE IF EXISTS `chart_group`;
|
||||
CREATE TABLE IF NOT EXISTS `chart_group`
|
||||
(
|
||||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`name` varchar(64) NOT NULL COMMENT '名称',
|
||||
`pid` varchar(50) COMMENT '父级ID',
|
||||
`level` int(10) COMMENT '当前分组处于第几级',
|
||||
`type` varchar(50) COMMENT 'group or scene',
|
||||
`create_by` varchar(50) COMMENT '创建人ID',
|
||||
`create_time` bigint(13) COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4;
|
||||
DROP TABLE IF EXISTS `chart_view`;
|
||||
CREATE TABLE `chart_view` (
|
||||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`name` varchar(64) DEFAULT NULL COMMENT '名称',
|
||||
`scene_id` varchar(50) NOT NULL COMMENT '场景ID',
|
||||
`table_id` varchar(50) NOT NULL COMMENT '数据集表ID',
|
||||
`type` varchar(50) DEFAULT NULL COMMENT '图表类型',
|
||||
`title` varchar(50) DEFAULT NULL COMMENT 'EChart标题',
|
||||
`x_axis` longtext COMMENT '横轴field',
|
||||
`y_axis` longtext COMMENT '纵轴field',
|
||||
`custom_attr` longtext COMMENT '图形属性',
|
||||
`custom_style` longtext COMMENT '组件样式',
|
||||
`custom_filter` longtext COMMENT '结果过滤',
|
||||
`create_by` varchar(50) DEFAULT NULL COMMENT '创建人ID',
|
||||
`create_time` bigint(13) DEFAULT NULL COMMENT '创建时间',
|
||||
`update_time` bigint(13) DEFAULT NULL COMMENT '更新时间',
|
||||
`snapshot` longtext COMMENT '缩略图 ',
|
||||
`style_priority` varchar(255) DEFAULT 'panel' COMMENT '样式优先级 panel 仪表盘 view 视图',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `IDX_TABLE_ID` (`table_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- chart end
|
||||
@ -1,6 +0,0 @@
|
||||
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.favicon', NULL, 'file', 6);
|
||||
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.loginImage', NULL, 'file', 3);
|
||||
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.loginLogo', NULL, 'file', 2);
|
||||
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.loginTitle', '', 'text', 4);
|
||||
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.logo', NULL, 'file', 1);
|
||||
INSERT INTO `system_parameter`(`param_key`, `param_value`, `type`, `sort`) VALUES ('ui.title', '', 'text', 5);
|
||||
File diff suppressed because one or more lines are too long
@ -1,10 +0,0 @@
|
||||
DROP TABLE IF EXISTS `dataset_table_incremental_config`;
|
||||
CREATE TABLE IF NOT EXISTS `dataset_table_incremental_config`
|
||||
(
|
||||
`id` varchar(50) NOT NULL COMMENT 'ID',
|
||||
`table_id` varchar(50) NOT NULL COMMENT '表ID',
|
||||
`incremental_delete` longtext COMMENT '详细信息',
|
||||
`incremental_add` longtext COMMENT '详细信息',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4;
|
||||
@ -1 +0,0 @@
|
||||
ALTER TABLE `dataset_table_field` ADD COLUMN `size` INT NULL AFTER `type`;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user