forked from github/dataease
datasource
This commit is contained in:
parent
ce527d0058
commit
d3b15391e1
@ -0,0 +1,23 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Datasource implements Serializable {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String desc;
|
||||
|
||||
private String type;
|
||||
|
||||
private Long createTime;
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
private String configuration;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
@ -0,0 +1,600 @@
|
||||
package io.dataease.base.domain;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DatasourceExample {
|
||||
protected String orderByClause;
|
||||
|
||||
protected boolean distinct;
|
||||
|
||||
protected List<Criteria> oredCriteria;
|
||||
|
||||
public DatasourceExample() {
|
||||
oredCriteria = new ArrayList<Criteria>();
|
||||
}
|
||||
|
||||
public void setOrderByClause(String orderByClause) {
|
||||
this.orderByClause = orderByClause;
|
||||
}
|
||||
|
||||
public String getOrderByClause() {
|
||||
return orderByClause;
|
||||
}
|
||||
|
||||
public void setDistinct(boolean distinct) {
|
||||
this.distinct = distinct;
|
||||
}
|
||||
|
||||
public boolean isDistinct() {
|
||||
return distinct;
|
||||
}
|
||||
|
||||
public List<Criteria> getOredCriteria() {
|
||||
return oredCriteria;
|
||||
}
|
||||
|
||||
public void or(Criteria criteria) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
|
||||
public Criteria or() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
oredCriteria.add(criteria);
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public Criteria createCriteria() {
|
||||
Criteria criteria = createCriteriaInternal();
|
||||
if (oredCriteria.size() == 0) {
|
||||
oredCriteria.add(criteria);
|
||||
}
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected Criteria createCriteriaInternal() {
|
||||
Criteria criteria = new Criteria();
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
oredCriteria.clear();
|
||||
orderByClause = null;
|
||||
distinct = false;
|
||||
}
|
||||
|
||||
protected abstract static class GeneratedCriteria {
|
||||
protected List<Criterion> criteria;
|
||||
|
||||
protected GeneratedCriteria() {
|
||||
super();
|
||||
criteria = new ArrayList<Criterion>();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return criteria.size() > 0;
|
||||
}
|
||||
|
||||
public List<Criterion> getAllCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
public List<Criterion> getCriteria() {
|
||||
return criteria;
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition) {
|
||||
if (condition == null) {
|
||||
throw new RuntimeException("Value for condition cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value, String property) {
|
||||
if (value == null) {
|
||||
throw new RuntimeException("Value for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value));
|
||||
}
|
||||
|
||||
protected void addCriterion(String condition, Object value1, Object value2, String property) {
|
||||
if (value1 == null || value2 == null) {
|
||||
throw new RuntimeException("Between values for " + property + " cannot be null");
|
||||
}
|
||||
criteria.add(new Criterion(condition, value1, value2));
|
||||
}
|
||||
|
||||
public Criteria andIdIsNull() {
|
||||
addCriterion("id is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdIsNotNull() {
|
||||
addCriterion("id is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andIdEqualTo(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 andNameIsNull() {
|
||||
addCriterion("`name` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIsNotNull() {
|
||||
addCriterion("`name` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameEqualTo(String value) {
|
||||
addCriterion("`name` =", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotEqualTo(String value) {
|
||||
addCriterion("`name` <>", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThan(String value) {
|
||||
addCriterion("`name` >", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`name` >=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThan(String value) {
|
||||
addCriterion("`name` <", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLessThanOrEqualTo(String value) {
|
||||
addCriterion("`name` <=", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameLike(String value) {
|
||||
addCriterion("`name` like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotLike(String value) {
|
||||
addCriterion("`name` not like", value, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameIn(List<String> values) {
|
||||
addCriterion("`name` in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotIn(List<String> values) {
|
||||
addCriterion("`name` not in", values, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameBetween(String value1, String value2) {
|
||||
addCriterion("`name` between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andNameNotBetween(String value1, String value2) {
|
||||
addCriterion("`name` not between", value1, value2, "name");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescIsNull() {
|
||||
addCriterion("`desc` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescIsNotNull() {
|
||||
addCriterion("`desc` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescEqualTo(String value) {
|
||||
addCriterion("`desc` =", value, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescNotEqualTo(String value) {
|
||||
addCriterion("`desc` <>", value, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescGreaterThan(String value) {
|
||||
addCriterion("`desc` >", value, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`desc` >=", value, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescLessThan(String value) {
|
||||
addCriterion("`desc` <", value, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescLessThanOrEqualTo(String value) {
|
||||
addCriterion("`desc` <=", value, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescLike(String value) {
|
||||
addCriterion("`desc` like", value, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescNotLike(String value) {
|
||||
addCriterion("`desc` not like", value, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescIn(List<String> values) {
|
||||
addCriterion("`desc` in", values, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescNotIn(List<String> values) {
|
||||
addCriterion("`desc` not in", values, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescBetween(String value1, String value2) {
|
||||
addCriterion("`desc` between", value1, value2, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andDescNotBetween(String value1, String value2) {
|
||||
addCriterion("`desc` not between", value1, value2, "desc");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNull() {
|
||||
addCriterion("`type` is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIsNotNull() {
|
||||
addCriterion("`type` is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeEqualTo(String value) {
|
||||
addCriterion("`type` =", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotEqualTo(String value) {
|
||||
addCriterion("`type` <>", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThan(String value) {
|
||||
addCriterion("`type` >", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("`type` >=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThan(String value) {
|
||||
addCriterion("`type` <", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLessThanOrEqualTo(String value) {
|
||||
addCriterion("`type` <=", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeLike(String value) {
|
||||
addCriterion("`type` like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotLike(String value) {
|
||||
addCriterion("`type` not like", value, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeIn(List<String> values) {
|
||||
addCriterion("`type` in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotIn(List<String> values) {
|
||||
addCriterion("`type` not in", values, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeBetween(String value1, String value2) {
|
||||
addCriterion("`type` between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTypeNotBetween(String value1, String value2) {
|
||||
addCriterion("`type` not between", value1, value2, "type");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNull() {
|
||||
addCriterion("create_time is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIsNotNull() {
|
||||
addCriterion("create_time is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeEqualTo(Long value) {
|
||||
addCriterion("create_time =", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotEqualTo(Long value) {
|
||||
addCriterion("create_time <>", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeGreaterThan(Long value) {
|
||||
addCriterion("create_time >", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("create_time >=", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeLessThan(Long value) {
|
||||
addCriterion("create_time <", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeLessThanOrEqualTo(Long value) {
|
||||
addCriterion("create_time <=", value, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeIn(List<Long> values) {
|
||||
addCriterion("create_time in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotIn(List<Long> values) {
|
||||
addCriterion("create_time not in", values, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeBetween(Long value1, Long value2) {
|
||||
addCriterion("create_time between", value1, value2, "createTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andCreateTimeNotBetween(Long value1, Long value2) {
|
||||
addCriterion("create_time not between", value1, value2, "createTime");
|
||||
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(Long value) {
|
||||
addCriterion("update_time =", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotEqualTo(Long value) {
|
||||
addCriterion("update_time <>", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeGreaterThan(Long value) {
|
||||
addCriterion("update_time >", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) {
|
||||
addCriterion("update_time >=", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeLessThan(Long value) {
|
||||
addCriterion("update_time <", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeLessThanOrEqualTo(Long value) {
|
||||
addCriterion("update_time <=", value, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeIn(List<Long> values) {
|
||||
addCriterion("update_time in", values, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotIn(List<Long> values) {
|
||||
addCriterion("update_time not in", values, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeBetween(Long value1, Long value2) {
|
||||
addCriterion("update_time between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andUpdateTimeNotBetween(Long value1, Long value2) {
|
||||
addCriterion("update_time not between", value1, value2, "updateTime");
|
||||
return (Criteria) this;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criteria extends GeneratedCriteria {
|
||||
|
||||
protected Criteria() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class Criterion {
|
||||
private String condition;
|
||||
|
||||
private Object value;
|
||||
|
||||
private Object secondValue;
|
||||
|
||||
private boolean noValue;
|
||||
|
||||
private boolean singleValue;
|
||||
|
||||
private boolean betweenValue;
|
||||
|
||||
private boolean listValue;
|
||||
|
||||
private String typeHandler;
|
||||
|
||||
public String getCondition() {
|
||||
return condition;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public Object getSecondValue() {
|
||||
return secondValue;
|
||||
}
|
||||
|
||||
public boolean isNoValue() {
|
||||
return noValue;
|
||||
}
|
||||
|
||||
public boolean isSingleValue() {
|
||||
return singleValue;
|
||||
}
|
||||
|
||||
public boolean isBetweenValue() {
|
||||
return betweenValue;
|
||||
}
|
||||
|
||||
public boolean isListValue() {
|
||||
return listValue;
|
||||
}
|
||||
|
||||
public String getTypeHandler() {
|
||||
return typeHandler;
|
||||
}
|
||||
|
||||
protected Criterion(String condition) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.typeHandler = null;
|
||||
this.noValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.typeHandler = typeHandler;
|
||||
if (value instanceof List<?>) {
|
||||
this.listValue = true;
|
||||
} else {
|
||||
this.singleValue = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value) {
|
||||
this(condition, value, null);
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
|
||||
super();
|
||||
this.condition = condition;
|
||||
this.value = value;
|
||||
this.secondValue = secondValue;
|
||||
this.typeHandler = typeHandler;
|
||||
this.betweenValue = true;
|
||||
}
|
||||
|
||||
protected Criterion(String condition, Object value, Object secondValue) {
|
||||
this(condition, value, secondValue, null);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package io.dataease.base.mapper;
|
||||
|
||||
import io.dataease.base.domain.Datasource;
|
||||
import io.dataease.base.domain.DatasourceExample;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
public interface DatasourceMapper {
|
||||
long countByExample(DatasourceExample example);
|
||||
|
||||
int deleteByExample(DatasourceExample example);
|
||||
|
||||
int deleteByPrimaryKey(String id);
|
||||
|
||||
int insert(Datasource record);
|
||||
|
||||
int insertSelective(Datasource record);
|
||||
|
||||
List<Datasource> selectByExampleWithBLOBs(DatasourceExample example);
|
||||
|
||||
List<Datasource> selectByExample(DatasourceExample example);
|
||||
|
||||
Datasource selectByPrimaryKey(String id);
|
||||
|
||||
int updateByExampleSelective(@Param("record") Datasource record, @Param("example") DatasourceExample example);
|
||||
|
||||
int updateByExampleWithBLOBs(@Param("record") Datasource record, @Param("example") DatasourceExample example);
|
||||
|
||||
int updateByExample(@Param("record") Datasource record, @Param("example") DatasourceExample example);
|
||||
|
||||
int updateByPrimaryKeySelective(Datasource record);
|
||||
|
||||
int updateByPrimaryKeyWithBLOBs(Datasource record);
|
||||
|
||||
int updateByPrimaryKey(Datasource record);
|
||||
}
|
@ -0,0 +1,287 @@
|
||||
<?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.DatasourceMapper">
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.Datasource">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="desc" jdbcType="VARCHAR" property="desc" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="create_time" jdbcType="BIGINT" property="createTime" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
</resultMap>
|
||||
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.Datasource">
|
||||
<result column="configuration" jdbcType="LONGVARCHAR" property="configuration" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Update_By_Example_Where_Clause">
|
||||
<where>
|
||||
<foreach collection="example.oredCriteria" item="criteria" separator="or">
|
||||
<if test="criteria.valid">
|
||||
<trim prefix="(" prefixOverrides="and" suffix=")">
|
||||
<foreach collection="criteria.criteria" item="criterion">
|
||||
<choose>
|
||||
<when test="criterion.noValue">
|
||||
and ${criterion.condition}
|
||||
</when>
|
||||
<when test="criterion.singleValue">
|
||||
and ${criterion.condition} #{criterion.value}
|
||||
</when>
|
||||
<when test="criterion.betweenValue">
|
||||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
|
||||
</when>
|
||||
<when test="criterion.listValue">
|
||||
and ${criterion.condition}
|
||||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
|
||||
#{listItem}
|
||||
</foreach>
|
||||
</when>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
</if>
|
||||
</foreach>
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, `name`, `desc`, `type`, create_time, update_time
|
||||
</sql>
|
||||
<sql id="Blob_Column_List">
|
||||
configuration
|
||||
</sql>
|
||||
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.DatasourceExample" resultMap="ResultMapWithBLOBs">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from datasource
|
||||
<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.DatasourceExample" resultMap="BaseResultMap">
|
||||
select
|
||||
<if test="distinct">
|
||||
distinct
|
||||
</if>
|
||||
<include refid="Base_Column_List" />
|
||||
from datasource
|
||||
<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="ResultMapWithBLOBs">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
,
|
||||
<include refid="Blob_Column_List" />
|
||||
from datasource
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
||||
delete from datasource
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<delete id="deleteByExample" parameterType="io.dataease.base.domain.DatasourceExample">
|
||||
delete from datasource
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.Datasource">
|
||||
insert into datasource (id, `name`, `desc`,
|
||||
`type`, create_time, update_time,
|
||||
configuration)
|
||||
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{desc,jdbcType=VARCHAR},
|
||||
#{type,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
|
||||
#{configuration,jdbcType=LONGVARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.Datasource">
|
||||
insert into datasource
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
`name`,
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
`desc`,
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type`,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="configuration != null">
|
||||
configuration,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
#{desc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
#{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="configuration != null">
|
||||
#{configuration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="countByExample" parameterType="io.dataease.base.domain.DatasourceExample" resultType="java.lang.Long">
|
||||
select count(*) from datasource
|
||||
<if test="_parameter != null">
|
||||
<include refid="Example_Where_Clause" />
|
||||
</if>
|
||||
</select>
|
||||
<update id="updateByExampleSelective" parameterType="map">
|
||||
update datasource
|
||||
<set>
|
||||
<if test="record.id != null">
|
||||
id = #{record.id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.name != null">
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.desc != null">
|
||||
`desc` = #{record.desc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.type != null">
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.createTime != null">
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="record.configuration != null">
|
||||
configuration = #{record.configuration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExampleWithBLOBs" parameterType="map">
|
||||
update datasource
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
`desc` = #{record.desc,jdbcType=VARCHAR},
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
configuration = #{record.configuration,jdbcType=LONGVARCHAR}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByExample" parameterType="map">
|
||||
update datasource
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
`name` = #{record.name,jdbcType=VARCHAR},
|
||||
`desc` = #{record.desc,jdbcType=VARCHAR},
|
||||
`type` = #{record.type,jdbcType=VARCHAR},
|
||||
create_time = #{record.createTime,jdbcType=BIGINT},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.Datasource">
|
||||
update datasource
|
||||
<set>
|
||||
<if test="name != null">
|
||||
`name` = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="desc != null">
|
||||
`desc` = #{desc,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="configuration != null">
|
||||
configuration = #{configuration,jdbcType=LONGVARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.Datasource">
|
||||
update datasource
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
`desc` = #{desc,jdbcType=VARCHAR},
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
configuration = #{configuration,jdbcType=LONGVARCHAR}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.Datasource">
|
||||
update datasource
|
||||
set `name` = #{name,jdbcType=VARCHAR},
|
||||
`desc` = #{desc,jdbcType=VARCHAR},
|
||||
`type` = #{type,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=BIGINT},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
</mapper>
|
@ -1,15 +0,0 @@
|
||||
package io.dataease.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package io.dataease.datasource.constants;
|
||||
|
||||
public enum DatasourceTypes {
|
||||
mysql
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package io.dataease.datasource.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import io.dataease.base.domain.Datasource;
|
||||
import io.dataease.commons.utils.PageUtils;
|
||||
import io.dataease.commons.utils.Pager;
|
||||
import io.dataease.datasource.service.DatasourceService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@RequestMapping("datasource")
|
||||
@RestController
|
||||
public class DatasourceController {
|
||||
|
||||
@Resource
|
||||
private DatasourceService datasourceService;
|
||||
|
||||
@PostMapping("/add")
|
||||
public Datasource addDatasource(@RequestBody Datasource Datasource) {
|
||||
return datasourceService.addDatasource(Datasource);
|
||||
}
|
||||
|
||||
@PostMapping("/validate")
|
||||
public void validate(@RequestBody Datasource Datasource) throws Exception{
|
||||
datasourceService.validate(Datasource);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public List<Datasource> getDatasourceList() throws Exception {
|
||||
return datasourceService.getDatasourceList(new Datasource());
|
||||
}
|
||||
|
||||
@PostMapping("/list/{goPage}/{pageSize}")
|
||||
public Pager<List<Datasource>> getDatasourceList(@RequestBody Datasource request, @PathVariable int goPage, @PathVariable int pageSize) throws Exception{
|
||||
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
|
||||
return PageUtils.setPageInfo(page, datasourceService.getDatasourceList(request));
|
||||
}
|
||||
|
||||
@GetMapping("/delete/{datasourceID}")
|
||||
public void deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) {
|
||||
datasourceService.deleteDatasource(datasourceID);
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public void updateDatasource(@RequestBody Datasource Datasource) {
|
||||
datasourceService.updateDatasource(Datasource);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package io.dataease.datasource.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class MysqlConfigrationDTO {
|
||||
private String host;
|
||||
private Integer port;
|
||||
private String username;
|
||||
private String password;
|
||||
private String jdbc;
|
||||
private String dataBase;
|
||||
private String driver = "com.mysql.cj.jdbc.Driver";
|
||||
|
||||
public String getJdbc(){
|
||||
if(StringUtils.isNotEmpty(jdbc)){
|
||||
return jdbc;
|
||||
}else {
|
||||
return "jdbc:mysql://HOSTNAME:PORT/DATABASE".replace("HOSTNAME", host).replace("PORT", port.toString()).replace("DATABASE", dataBase);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package io.dataease.datasource.provider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class DatasourceProvider {
|
||||
|
||||
protected String dataSourceConfigration;
|
||||
protected String type;
|
||||
|
||||
public String getQuery() {
|
||||
return query;
|
||||
}
|
||||
|
||||
public void setQuery(String query) {
|
||||
this.query = query;
|
||||
}
|
||||
|
||||
protected String query;
|
||||
private int resultLimit = 30000;
|
||||
|
||||
public String getDataSourceConfigration() {
|
||||
return dataSourceConfigration;
|
||||
}
|
||||
|
||||
public void setDataSourceConfigration(String dataSourceConfigration) {
|
||||
this.dataSourceConfigration = dataSourceConfigration;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
|
||||
abstract public List<String[]> getData() throws Exception;
|
||||
|
||||
abstract public List<String> getTables() throws Exception;
|
||||
|
||||
public void test() throws Exception {
|
||||
getData();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package io.dataease.datasource.provider;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.datasource.constants.DatasourceTypes;
|
||||
import io.dataease.datasource.dto.MysqlConfigrationDTO;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import io.dataease.datasource.constants.DatasourceTypes.*;
|
||||
import java.util.Properties;
|
||||
|
||||
|
||||
@Service("jdbc")
|
||||
public class JdbcProvider extends DatasourceProvider{
|
||||
|
||||
@Override
|
||||
public List<String[]> getData() throws Exception {
|
||||
List<String[]> list = new LinkedList<>();
|
||||
try (
|
||||
Connection connection = getConnection();
|
||||
Statement stat = connection.createStatement();
|
||||
ResultSet rs = stat.executeQuery(getQuery())
|
||||
) {
|
||||
ResultSetMetaData metaData = rs.getMetaData();
|
||||
int columnCount = metaData.getColumnCount();
|
||||
while (rs.next()) {
|
||||
String[] row = new String[columnCount];
|
||||
for (int j = 0; j < columnCount; j++) {
|
||||
int columType = metaData.getColumnType(j + 1);
|
||||
switch (columType) {
|
||||
case java.sql.Types.DATE:
|
||||
row[j] = rs.getDate(j + 1).toString();
|
||||
break;
|
||||
default:
|
||||
row[j] = rs.getString(j + 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
list.add(row);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR:" + e.getMessage(), e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTables() throws Exception {
|
||||
List<String> tables = new ArrayList<>();
|
||||
|
||||
String queryStr = "show tables";
|
||||
try (Connection con = getConnection(); Statement ps = con.createStatement()) {
|
||||
ResultSet resultSet = ps.executeQuery(queryStr);
|
||||
while (resultSet.next()){
|
||||
tables.add(resultSet.getString(1));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR: " + e.getMessage(), e);
|
||||
}
|
||||
return tables;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void test() throws Exception {
|
||||
String queryStr = "show tables";
|
||||
try (Connection con = getConnection(); Statement ps = con.createStatement()) {
|
||||
ResultSet resultSet = ps.executeQuery(queryStr);
|
||||
} catch (Exception e) {
|
||||
throw new Exception("ERROR: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Connection getConnection() throws Exception {
|
||||
String username = null;
|
||||
String password = null;
|
||||
String driver = null;
|
||||
String jdbcurl = null;
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(getType());
|
||||
switch (datasourceType){
|
||||
case mysql:
|
||||
MysqlConfigrationDTO mysqlConfigrationDTO = new Gson().fromJson(getDataSourceConfigration(), MysqlConfigrationDTO.class);
|
||||
username = mysqlConfigrationDTO.getUsername();
|
||||
password = mysqlConfigrationDTO.getPassword();
|
||||
driver = mysqlConfigrationDTO.getDriver();
|
||||
jdbcurl = mysqlConfigrationDTO.getJdbc();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Class.forName(driver);
|
||||
Properties props = new Properties();
|
||||
props.setProperty("user", username);
|
||||
if (StringUtils.isNotBlank(password)) {
|
||||
props.setProperty("password", password);
|
||||
}
|
||||
return DriverManager.getConnection(jdbcurl, props);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package io.dataease.datasource.provider;
|
||||
|
||||
import io.dataease.datasource.constants.DatasourceTypes;
|
||||
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 {
|
||||
|
||||
private static ApplicationContext context;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
this.context = applicationContext;
|
||||
}
|
||||
|
||||
public static DatasourceProvider getProvider(String type){
|
||||
DatasourceTypes datasourceType = DatasourceTypes.valueOf(type);
|
||||
switch (datasourceType){
|
||||
case mysql:
|
||||
return context.getBean("jdbc", DatasourceProvider.class);
|
||||
default:
|
||||
return context.getBean("jdbc", DatasourceProvider.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package io.dataease.datasource.service;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.base.mapper.*;
|
||||
import io.dataease.datasource.dto.MysqlConfigrationDTO;
|
||||
import io.dataease.datasource.provider.DatasourceProvider;
|
||||
import io.dataease.datasource.provider.JdbcProvider;
|
||||
import io.dataease.datasource.provider.ProviderFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class DatasourceService {
|
||||
|
||||
@Resource
|
||||
private DatasourceMapper datasourceMapper;
|
||||
|
||||
public Datasource addDatasource(Datasource datasource) {
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
datasource.setId(UUID.randomUUID().toString());
|
||||
datasource.setUpdateTime(currentTimeMillis);
|
||||
datasource.setCreateTime(currentTimeMillis);
|
||||
datasourceMapper.insertSelective(datasource);
|
||||
return datasource;
|
||||
}
|
||||
|
||||
public List<Datasource> getDatasourceList(Datasource request)throws Exception{
|
||||
DatasourceExample example = new DatasourceExample();
|
||||
DatasourceExample.Criteria criteria = example.createCriteria();
|
||||
if (StringUtils.isNotBlank(request.getName())) {
|
||||
criteria.andNameLike(StringUtils.wrapIfMissing(request.getName(), "%"));
|
||||
}
|
||||
if (StringUtils.isNotBlank(request.getType())) {
|
||||
criteria.andTypeEqualTo(request.getType());
|
||||
}
|
||||
example.setOrderByClause("update_time desc");
|
||||
return datasourceMapper.selectByExample(example);
|
||||
}
|
||||
|
||||
public void deleteDatasource(String datasourceId) {
|
||||
datasourceMapper.deleteByPrimaryKey(datasourceId);
|
||||
}
|
||||
|
||||
public void updateDatasource(Datasource datasource) {
|
||||
datasource.setCreateTime(null);
|
||||
datasource.setUpdateTime(System.currentTimeMillis());
|
||||
datasourceMapper.updateByPrimaryKeySelective(datasource);
|
||||
}
|
||||
|
||||
public void validate(Datasource datasource)throws Exception {
|
||||
DatasourceProvider datasourceProvider = ProviderFactory.getProvider(datasource.getType());
|
||||
datasourceProvider.setDataSourceConfigration(datasource.getConfiguration());
|
||||
datasourceProvider.test();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
10
backend/src/main/resources/db/migration/V6__datasource.sql
Normal file
10
backend/src/main/resources/db/migration/V6__datasource.sql
Normal file
@ -0,0 +1,10 @@
|
||||
CREATE TABLE `datasource` (
|
||||
`id` varchar(50) NOT NULL DEFAULT '' COMMENT 'ID',
|
||||
`name` varchar(50) NOT NULL COMMENT '名称',
|
||||
`desc` varchar(50) NOT NULL COMMENT '描述',
|
||||
`type` varchar(50) NOT NULL COMMENT '类型',
|
||||
`configuration` longtext NOT NULL COMMENT '详细信息',
|
||||
`create_time` bigint(13) NOT NULL COMMENT 'Create timestamp',
|
||||
`update_time` bigint(13) NOT NULL COMMENT 'Update timestamp',
|
||||
PRIMARY KEY (`id`)
|
||||
)
|
@ -64,11 +64,8 @@
|
||||
|
||||
<!--要生成的数据库表 -->
|
||||
|
||||
<table tableName="auth_source"/>
|
||||
<table tableName="swagger_url_project"/>
|
||||
<!--<table tableName="test_plan_api_scenario"/>-->
|
||||
<!--<table tableName="test_plan"/>-->
|
||||
<!--<table tableName="api_scenario_report"/>-->
|
||||
<table tableName="datasource"/>
|
||||
|
||||
|
||||
</context>
|
||||
</generatorConfiguration>
|
||||
|
@ -7,6 +7,11 @@ export default {
|
||||
content: () => import('@/business/components/settings/Setting')
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'datasource',
|
||||
component: () => import('@/business/components/settings/system/Datasource'),
|
||||
meta: {system: true, title: 'commons.datasource'}
|
||||
},
|
||||
{
|
||||
path: 'user',
|
||||
component: () => import('@/business/components/settings/system/User'),
|
||||
|
535
frontend/src/business/components/settings/system/Datasource.vue
Normal file
535
frontend/src/business/components/settings/system/Datasource.vue
Normal file
@ -0,0 +1,535 @@
|
||||
<template>
|
||||
<div v-loading="result.loading">
|
||||
|
||||
<el-card class="table-card">
|
||||
<template v-slot:header>
|
||||
<ms-table-header :condition.sync="condition" @search="initTableData" @create="create"
|
||||
:create-tip="$t('datasource.create')" :title="$t('commons.datasource')"/>
|
||||
</template>
|
||||
<!-- system menu datasource table-->
|
||||
<el-table border class="adjust-table" :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="name" :label="$t('commons.name')"/>
|
||||
<el-table-column prop="description" :label="$t('commons.description')"/>
|
||||
<el-table-column prop="type" :label="$t('datasource.type')"/>
|
||||
<!-- <el-table-column :label="$t('commons.member')">-->
|
||||
<!-- <template v-slot:default="scope">-->
|
||||
<!-- <el-link type="primary" class="member-size" @click="cellClick(scope.row)">-->
|
||||
<!-- {{ scope.row.memberSize }}-->
|
||||
<!-- </el-link>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column :label="$t('commons.operating')">-->
|
||||
<!-- <template v-slot:default="scope">-->
|
||||
<!-- <ms-table-operator @editClick="edit(scope.row)" @deleteClick="handleDelete(scope.row)"/>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
</el-table>
|
||||
<ms-table-pagination :change="initTableData" :current-page.sync="currentPage" :page-size.sync="pageSize"
|
||||
:total="total"/>
|
||||
</el-card>
|
||||
|
||||
<!-- dialog of organization member -->
|
||||
<el-dialog :close-on-click-modal="false" :visible.sync="dialogDatasourceMemberVisible" width="70%" :destroy-on-close="true" @close="closeFunc"
|
||||
class="dialog-css">
|
||||
<ms-table-header :condition.sync="dialogCondition" @create="addMember" @search="dialogSearch"
|
||||
:create-tip="$t('member.create')" :title="$t('commons.member')"/>
|
||||
<!-- organization member table -->
|
||||
<el-table :border="true" class="adjust-table" :data="memberLineData" style="width: 100%;margin-top:5px;">
|
||||
<el-table-column prop="id" label="ID"/>
|
||||
<el-table-column prop="name" :label="$t('commons.username')"/>
|
||||
<el-table-column prop="email" :label="$t('commons.email')"/>
|
||||
<el-table-column prop="phone" :label="$t('commons.phone')"/>
|
||||
<el-table-column :label="$t('commons.role')" width="140">
|
||||
<template v-slot:default="scope">
|
||||
<ms-roles-tag :roles="scope.row.roles"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="$t('commons.operating')">
|
||||
<template v-slot:default="scope">
|
||||
<ms-table-operator :tip2="$t('commons.remove')" @editClick="editMember(scope.row)"
|
||||
@deleteClick="delMember(scope.row)"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<ms-table-pagination :change="dialogSearch" :current-page.sync="dialogCurrentPage"
|
||||
:page-size.sync="dialogPageSize"
|
||||
:total="dialogTotal"/>
|
||||
</el-dialog>
|
||||
|
||||
<!-- add datasource form -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('datasource.create')" :visible.sync="dialogDatasourceAddVisible" width="30%" @closed="closeFunc"
|
||||
:destroy-on-close="true">
|
||||
<el-form :model="form" label-position="right" label-width="100px" size="small" ref="createDatasource">
|
||||
<el-form-item :label="$t('commons.name')" prop="name" :rules="[{required: true, message: this.$t('datasource.input_name'), trigger: 'blur'},
|
||||
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'}]">
|
||||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.description')" prop="desc" :rules="[{required: true, message: this.$t('datasource.input_desc'), trigger: 'blur'},
|
||||
{min: 2, max: 50, message: this.$t('commons.input_limit', [2, 50]), trigger: 'blur'}]">
|
||||
<el-input v-model="form.desc" autocomplete="off" type="textarea"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('datasource.type')" prop="type" :rules="{required: true, message: $t('datasource.please_choose_type'), trigger: 'change'}">
|
||||
<el-select v-model="form.type" :placeholder="$t('datasource.please_choose_type')" class="select-width">
|
||||
<el-option
|
||||
v-for="item in allTypes"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('datasource.data_base')" prop="configuration.dataBase" :rules="{required: true, message: $t('datasource.please_input_data_base'), trigger: 'blur'}" v-show="form.type=='mysql'">
|
||||
<el-input v-model="form.configuration.dataBase" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('datasource.user_name')" prop="configuration.username" v-show="form.type=='mysql'">
|
||||
<el-input v-model="form.configuration.username" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('datasource.password')" prop="configuration.password" :rules="{required: true, message: $t('datasource.please_input_password'), trigger: 'change'}" v-show="form.type=='mysql'">
|
||||
<el-input v-model="form.configuration.password" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('datasource.host')" prop="configuration.host" :rules="{required: true, message: $t('datasource.please_input_host'), trigger: 'change'}" v-show="form.type=='mysql'">
|
||||
<el-input v-model="form.configuration.host" autocomplete="off" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('datasource.port')" prop="configuration.port" :rules="{required: true, message: $t('datasource.please_input_port'), trigger: 'change'}" v-show="form.type=='mysql'">
|
||||
<el-input v-model="form.configuration.port" autocomplete="off" />
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
@cancel="dialogDatasourceAddVisible = false"
|
||||
@confirm="createDatasource('createDatasource')"/>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- update organization form -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('organization.modify')" :visible.sync="dialogDatasourceUpdateVisible" width="30%"
|
||||
:destroy-on-close="true"
|
||||
@close="closeFunc">
|
||||
<el-form :model="form" label-position="right" label-width="100px" size="small" :rules="rule"
|
||||
ref="updateOrganizationForm">
|
||||
<el-form-item :label="$t('commons.name')" prop="name">
|
||||
<el-input v-model="form.name" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.description')" prop="description">
|
||||
<el-input v-model="form.description" autocomplete="off"/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
@cancel="dialogDatasourceUpdateVisible = false"
|
||||
@confirm="updateOrganization('updateOrganizationForm')"/>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- add organization member form -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.create')" :visible.sync="dialogDatasourceMemberAddVisible" width="30%"
|
||||
:destroy-on-close="true"
|
||||
@close="closeFunc">
|
||||
<el-form :model="memberForm" ref="form" :rules="orgMemberRule" label-position="right" label-width="100px"
|
||||
size="small">
|
||||
<el-form-item :label="$t('commons.member')" prop="userIds">
|
||||
<el-select filterable v-model="memberForm.userIds" multiple :placeholder="$t('member.please_choose_member')"
|
||||
class="select-width" :filter-method="dataFilter">
|
||||
<el-option
|
||||
v-for="item in memberForm.userList"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
<span class="org-member-id">{{ item.id }}</span>
|
||||
<span class="org-member-email">{{ item.email }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.role')" prop="roleIds">
|
||||
<el-select filterable v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
|
||||
class="select-width">
|
||||
<el-option
|
||||
v-for="item in memberForm.roles"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
@cancel="dialogDatasourceMemberAddVisible = false"
|
||||
@confirm="submitForm('form')"/>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<!-- update organization member form -->
|
||||
<el-dialog :close-on-click-modal="false" :title="$t('member.modify')" :visible.sync="dialogDatasourceMemberUpdateVisible" width="30%"
|
||||
:destroy-on-close="true"
|
||||
@close="closeFunc">
|
||||
<el-form :model="memberForm" label-position="right" label-width="100px" size="small" ref="updateUserForm">
|
||||
<el-form-item label="ID" prop="id">
|
||||
<el-input v-model="memberForm.id" autocomplete="off" :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.username')" prop="name">
|
||||
<el-input v-model="memberForm.name" autocomplete="off" :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.email')" prop="email">
|
||||
<el-input v-model="memberForm.email" autocomplete="off" :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.phone')" prop="phone">
|
||||
<el-input v-model="memberForm.phone" autocomplete="off" :disabled="true"/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.role')" prop="roleIds"
|
||||
:rules="{required: true, message: $t('role.please_choose_role'), trigger: 'change'}">
|
||||
<el-select filterable v-model="memberForm.roleIds" multiple :placeholder="$t('role.please_choose_role')"
|
||||
class="select-width">
|
||||
<el-option
|
||||
v-for="item in memberForm.allroles"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template v-slot:footer>
|
||||
<ms-dialog-footer
|
||||
@cancel="dialogDatasourceMemberUpdateVisible = false"
|
||||
@confirm="updateOrgMember('updateUserForm')"/>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<ms-delete-confirm :title="$t('organization.delete')" @delete="_handleDelete" ref="deleteConfirm"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import MsCreateBox from "../CreateBox";
|
||||
import MsTablePagination from "../../common/pagination/TablePagination";
|
||||
import MsTableHeader from "../../common/components/MsTableHeader";
|
||||
import MsRolesTag from "../../common/components/MsRolesTag";
|
||||
import MsTableOperator from "../../common/components/MsTableOperator";
|
||||
import MsTableOperatorButton from "../../common/components/MsTableOperatorButton";
|
||||
import MsDialogFooter from "../../common/components/MsDialogFooter";
|
||||
import {
|
||||
getCurrentOrganizationId,
|
||||
getCurrentUser,
|
||||
listenGoBack,
|
||||
refreshSessionAndCookies,
|
||||
removeGoBackListener
|
||||
} from "@/common/js/utils";
|
||||
import {DEFAULT, ORGANIZATION} from "@/common/js/constants";
|
||||
import MsDeleteConfirm from "../../common/components/MsDeleteConfirm";
|
||||
|
||||
export default {
|
||||
name: "DeDatasource",
|
||||
components: {
|
||||
MsDeleteConfirm,
|
||||
MsCreateBox,
|
||||
MsTablePagination,
|
||||
MsTableHeader,
|
||||
MsRolesTag,
|
||||
MsTableOperator,
|
||||
MsDialogFooter,
|
||||
MsTableOperatorButton
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
queryPath: '/datasource/list',
|
||||
deletePath: '/datasource/delete/',
|
||||
createPath: '/datasource/add',
|
||||
updatePath: '/datasource/update',
|
||||
result: {},
|
||||
dialogDatasourceAddVisible: false,
|
||||
dialogDatasourceUpdateVisible: false,
|
||||
dialogDatasourceMemberVisible: false,
|
||||
dialogDatasourceMemberAddVisible: false,
|
||||
dialogDatasourceMemberUpdateVisible: false,
|
||||
multipleSelection: [],
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
total: 0,
|
||||
dialogCurrentPage: 1,
|
||||
dialogPageSize: 10,
|
||||
dialogTotal: 0,
|
||||
currentRow: {},
|
||||
condition: {},
|
||||
dialogCondition: {},
|
||||
tableData: [],
|
||||
memberLineData: [],
|
||||
form: {configuration: {}},
|
||||
allTypes: ['mysql', 'oracle'],
|
||||
memberForm: {},
|
||||
rule: {
|
||||
name: [
|
||||
{required: true, message: this.$t('organization.input_name'), trigger: 'blur'},
|
||||
{min: 2, max: 25, message: this.$t('commons.input_limit', [2, 25]), trigger: 'blur'}
|
||||
],
|
||||
desc: [
|
||||
{required: true, message: this.$t('organization.input_name'), trigger: 'blur'},
|
||||
{max: 50, message: this.$t('commons.input_limit', [0, 50]), trigger: 'blur'}
|
||||
]
|
||||
},
|
||||
orgMemberRule: {
|
||||
userIds: [
|
||||
{required: true, message: this.$t('member.please_choose_member'), trigger: ['blur']}
|
||||
],
|
||||
roleIds: [
|
||||
{required: true, message: this.$t('role.please_choose_role'), trigger: ['blur']}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
activated() {
|
||||
this.initTableData();
|
||||
},
|
||||
methods: {
|
||||
create() {
|
||||
this.dialogDatasourceAddVisible = true;
|
||||
listenGoBack(this.closeFunc);
|
||||
},
|
||||
addMember() {
|
||||
this.dialogDatasourceMemberAddVisible = true;
|
||||
this.memberForm = {};
|
||||
this.result = this.$get('/user/list/', response => {
|
||||
this.$set(this.memberForm, "userList", response.data);
|
||||
this.$set(this.memberForm, "copyUserList", response.data);
|
||||
});
|
||||
this.result = this.$get('/role/list/org', response => {
|
||||
this.$set(this.memberForm, "roles", response.data);
|
||||
})
|
||||
},
|
||||
dataFilter(val) {
|
||||
if (val) {
|
||||
this.memberForm.userList = this.memberForm.copyUserList.filter((item) => {
|
||||
if (!!~item.id.indexOf(val) || !!~item.id.toUpperCase().indexOf(val.toUpperCase())) {
|
||||
return true
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.memberForm.userList = this.memberForm.copyUserList;
|
||||
}
|
||||
},
|
||||
edit(row) {
|
||||
this.dialogDatasourceUpdateVisible = true;
|
||||
this.form = Object.assign({}, row);
|
||||
listenGoBack(this.closeFunc);
|
||||
},
|
||||
editMember(row) {
|
||||
this.dialogDatasourceMemberUpdateVisible = true;
|
||||
this.memberForm = Object.assign({}, row);
|
||||
let roleIds = this.memberForm.roles.map(r => r.id);
|
||||
this.result = this.$get('/role/list/org', response => {
|
||||
this.$set(this.memberForm, "allroles", response.data);
|
||||
})
|
||||
// 编辑时填充角色信息
|
||||
this.$set(this.memberForm, 'roleIds', roleIds);
|
||||
listenGoBack(this.closeFunc);
|
||||
},
|
||||
cellClick(row) {
|
||||
// 保存当前点击的组织信息到currentRow
|
||||
this.currentRow = row;
|
||||
this.dialogDatasourceMemberVisible = true;
|
||||
let param = {
|
||||
name: '',
|
||||
organizationId: row.id
|
||||
};
|
||||
let path = "/user/special/org/member/list";
|
||||
this.result = this.$post(path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize, param, res => {
|
||||
let data = res.data;
|
||||
this.memberLineData = data.listObject;
|
||||
let url = "/userrole/list/org/" + row.id;
|
||||
for (let i = 0; i < this.memberLineData.length; i++) {
|
||||
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
||||
let roles = response.data;
|
||||
this.$set(this.memberLineData[i], "roles", roles);
|
||||
})
|
||||
}
|
||||
this.dialogTotal = data.itemCount;
|
||||
});
|
||||
listenGoBack(this.closeFunc);
|
||||
},
|
||||
dialogSearch() {
|
||||
let row = this.currentRow;
|
||||
this.dialogDatasourceMemberVisible = true;
|
||||
let param = this.dialogCondition;
|
||||
this.$set(param, 'organizationId', row.id);
|
||||
let path = "/user/special/org/member/list";
|
||||
this.result = this.$post(path + "/" + this.dialogCurrentPage + "/" + this.dialogPageSize, param, res => {
|
||||
let data = res.data;
|
||||
this.memberLineData = data.listObject;
|
||||
let url = "/userrole/list/org/" + row.id;
|
||||
for (let i = 0; i < this.memberLineData.length; i++) {
|
||||
this.$get(url + "/" + encodeURIComponent(this.memberLineData[i].id), response => {
|
||||
let roles = response.data;
|
||||
this.$set(this.memberLineData[i], "roles", roles);
|
||||
})
|
||||
}
|
||||
this.dialogTotal = data.itemCount;
|
||||
});
|
||||
},
|
||||
handleDelete(organization) {
|
||||
this.$refs.deleteConfirm.open(organization);
|
||||
},
|
||||
_handleDelete(organization) {
|
||||
this.$confirm(this.$t('organization.delete_confirm'), '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.result = this.$get(this.deletePath + organization.id, () => {
|
||||
let lastOrganizationId = getCurrentOrganizationId();
|
||||
let sourceId = organization.id;
|
||||
if (lastOrganizationId === sourceId) {
|
||||
refreshSessionAndCookies(DEFAULT, sourceId);
|
||||
}
|
||||
this.$success(this.$t('commons.delete_success'));
|
||||
this.initTableData();
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$message({
|
||||
type: 'info',
|
||||
message: this.$t('commons.delete_cancelled')
|
||||
});
|
||||
});
|
||||
},
|
||||
delMember(row) {
|
||||
this.$confirm(this.$t('member.remove_member'), '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
cancelButtonText: this.$t('commons.cancel'),
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.result = this.$get('/user/special/org/member/delete/' + this.currentRow.id + '/' + encodeURIComponent(row.id), () => {
|
||||
let sourceId = this.currentRow.id;
|
||||
let currentUser = getCurrentUser();
|
||||
let userId = row.id;
|
||||
if (currentUser.id === userId) {
|
||||
refreshSessionAndCookies(ORGANIZATION, sourceId);
|
||||
}
|
||||
this.$success(this.$t('commons.remove_success'))
|
||||
this.cellClick(this.currentRow);
|
||||
});
|
||||
}).catch(() => {
|
||||
this.$info(this.$t('commons.remove_cancel'));
|
||||
});
|
||||
},
|
||||
createDatasource(createDatasourceForm) {
|
||||
this.$refs[createDatasourceForm].validate(valid => {
|
||||
if (valid) {
|
||||
this.form.configuration = JSON.stringify(this.form.configuration);
|
||||
this.result = this.$post(this.createPath, this.form, () => {
|
||||
console.log('aaaaa');
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.initTableData();
|
||||
this.dialogDatasourceAddVisible = false;
|
||||
}, ()=>{ console.log('bbbb');});
|
||||
console.log(this.result);
|
||||
this.dialogDatasourceAddVisible = false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
updateOrganization(updateOrganizationForm) {
|
||||
this.$refs[updateOrganizationForm].validate(valid => {
|
||||
if (valid) {
|
||||
this.result = this.$post(this.updatePath, this.form, () => {
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.dialogDatasourceUpdateVisible = false;
|
||||
this.initTableData();
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
initTableData() {
|
||||
this.result = this.$post(this.queryPath + "/" + this.currentPage + "/" + this.pageSize, this.condition, response => {
|
||||
let data = response.data;
|
||||
this.tableData = data.listObject;
|
||||
this.total = data.itemCount;
|
||||
})
|
||||
},
|
||||
closeFunc() {
|
||||
this.memberLineData = [];
|
||||
this.initTableData();
|
||||
this.form = {configuration: {}};
|
||||
removeGoBackListener(this.closeFunc);
|
||||
this.dialogDatasourceAddVisible = false;
|
||||
this.dialogDatasourceUpdateVisible = false;
|
||||
this.dialogDatasourceMemberVisible = false;
|
||||
this.dialogDatasourceMemberAddVisible = false;
|
||||
this.dialogDatasourceMemberUpdateVisible = false;
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val;
|
||||
},
|
||||
submitForm(formName) {
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
let param = {
|
||||
userIds: this.memberForm.userIds,
|
||||
roleIds: this.memberForm.roleIds,
|
||||
organizationId: this.currentRow.id
|
||||
};
|
||||
this.result = this.$post("user/special/org/member/add", param, () => {
|
||||
let sign = "other";
|
||||
let sourceId = this.currentRow.id;
|
||||
refreshSessionAndCookies(sign, sourceId);
|
||||
this.cellClick(this.currentRow);
|
||||
this.dialogDatasourceMemberAddVisible = false;
|
||||
})
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
},
|
||||
updateOrgMember(formName) {
|
||||
let param = {
|
||||
id: this.memberForm.id,
|
||||
name: this.memberForm.name,
|
||||
email: this.memberForm.email,
|
||||
phone: this.memberForm.phone,
|
||||
roleIds: this.memberForm.roleIds,
|
||||
organizationId: this.currentRow.id
|
||||
}
|
||||
this.$refs[formName].validate((valid) => {
|
||||
if (valid) {
|
||||
this.result = this.$post("/organization/member/update", param, () => {
|
||||
this.$success(this.$t('commons.modify_success'));
|
||||
this.dialogDatasourceMemberUpdateVisible = false;
|
||||
this.cellClick(this.currentRow);
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.member-size {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.org-member-id {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.org-member-email {
|
||||
float: right;
|
||||
color: #8492a6;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.select-width {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.dialog-css >>> .el-dialog__header {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
</style>
|
@ -192,7 +192,8 @@ export default {
|
||||
module: {
|
||||
select_module: "选择模块",
|
||||
default_module: "默认模块",
|
||||
}
|
||||
},
|
||||
datasource: '数据连接'
|
||||
},
|
||||
license: {
|
||||
title: '授权管理',
|
||||
@ -1521,5 +1522,54 @@ export default {
|
||||
delete_prompt: '此操作会删除认证源,是否继续?',
|
||||
title: '认证设置',
|
||||
auth_name_valid: '名称不支持特殊字符',
|
||||
}
|
||||
},
|
||||
datasource: {
|
||||
create: '新建数据连接',
|
||||
type: '类型',
|
||||
please_choose_type: '请选择数据源类型',
|
||||
data_base: '数据库名称',
|
||||
user_name: '用户名',
|
||||
password: '密码',
|
||||
host: '主机',
|
||||
port: '端口',
|
||||
please_input_data_base: '请输入数据库名称',
|
||||
please_input_user_name: '请输入用户名',
|
||||
please_input_password: '请输入密码',
|
||||
please_input_host: '请输入主机',
|
||||
please_input_port: '请输入端口',
|
||||
modify: '修改组织',
|
||||
delete: '删除组织',
|
||||
delete_confirm: '删除该组织会关联删除该组织下的所有资源(如:相关工作空间,项目,测试用例等),确定要删除吗?',
|
||||
input_name: '请输入名称',
|
||||
input_desc: '请输入描述',
|
||||
select_organization: '请选择组织',
|
||||
search_by_name: '根据名称搜索',
|
||||
special_characters_are_not_supported: '格式错误(不支持特殊字符,且不能以\'-\'开头结尾)',
|
||||
none: '无组织',
|
||||
select: '选择组织',
|
||||
delete_warning: '删除该组织将同步删除该组织下所有相关工作空间和相关工作空间下的所有项目,以及项目中的所有用例、接口测试、性能测试等,确定要删除吗?',
|
||||
service_integration: '服务集成',
|
||||
defect_manage: '缺陷管理平台',
|
||||
message_settings: '消息设置',
|
||||
message: {
|
||||
jenkins_task_notification: 'Jenkins接口调用任务通知',
|
||||
test_plan_task_notification: '测试计划任务通知',
|
||||
test_review_task_notice: '测试评审任务通知',
|
||||
create_new_notification: '创建新通知',
|
||||
mail_template_example: '邮件模版',
|
||||
robot_template: '机器人模版',
|
||||
select_events: '选择事件',
|
||||
defect_task_notification: '缺陷任务通知',
|
||||
select_receiving_method: '选择接收方式',
|
||||
mail: '邮件',
|
||||
nail_robot: '钉钉机器人',
|
||||
enterprise_wechat_robot: '企业微信机器人',
|
||||
notes: '1.钉钉和企业群里新建一个自定义机器人,然后复制 webhook 地址在我们平台上;\n' +
|
||||
' 2.机器人选择为群机器人,安全验证选择“自定义关键词” :"任务通知";\n' +
|
||||
' 3.选择接收人时必须是你所建的群里包含的人,接收人手机号为必填项且为钉钉企业所使用的手机号,',
|
||||
message: '事件,接收人,接收方式为必填项',
|
||||
message_webhook: '接收方式为钉钉和企业机器人时,webhook为必填项',
|
||||
template: "模版"
|
||||
},
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user