Merge branch 'dev' into pr@dev@errormsg

This commit is contained in:
taojinlong 2021-07-12 11:49:45 +08:00 committed by GitHub
commit f8e2c53e85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 3533 additions and 503 deletions

View File

@ -365,6 +365,11 @@
<version>12.2.0.1</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>ST4</artifactId>
<version>4.0.8</version>
</dependency>
</dependencies>
<build>

View File

@ -9,12 +9,10 @@ public class SysMsg implements Serializable {
private Long userId;
private Integer type;
private Long typeId;
private Boolean status;
private String router;
private String param;
private Long createTime;

View File

@ -0,0 +1,13 @@
package io.dataease.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class SysMsgChannel implements Serializable {
private Long msgChannelId;
private String channelName;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,330 @@
package io.dataease.base.domain;
import java.util.ArrayList;
import java.util.List;
public class SysMsgChannelExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SysMsgChannelExample() {
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 andMsgChannelIdIsNull() {
addCriterion("msg_channel_id is null");
return (Criteria) this;
}
public Criteria andMsgChannelIdIsNotNull() {
addCriterion("msg_channel_id is not null");
return (Criteria) this;
}
public Criteria andMsgChannelIdEqualTo(Long value) {
addCriterion("msg_channel_id =", value, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdNotEqualTo(Long value) {
addCriterion("msg_channel_id <>", value, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdGreaterThan(Long value) {
addCriterion("msg_channel_id >", value, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdGreaterThanOrEqualTo(Long value) {
addCriterion("msg_channel_id >=", value, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdLessThan(Long value) {
addCriterion("msg_channel_id <", value, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdLessThanOrEqualTo(Long value) {
addCriterion("msg_channel_id <=", value, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdIn(List<Long> values) {
addCriterion("msg_channel_id in", values, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdNotIn(List<Long> values) {
addCriterion("msg_channel_id not in", values, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdBetween(Long value1, Long value2) {
addCriterion("msg_channel_id between", value1, value2, "msgChannelId");
return (Criteria) this;
}
public Criteria andMsgChannelIdNotBetween(Long value1, Long value2) {
addCriterion("msg_channel_id not between", value1, value2, "msgChannelId");
return (Criteria) this;
}
public Criteria andChannelNameIsNull() {
addCriterion("channel_name is null");
return (Criteria) this;
}
public Criteria andChannelNameIsNotNull() {
addCriterion("channel_name is not null");
return (Criteria) this;
}
public Criteria andChannelNameEqualTo(String value) {
addCriterion("channel_name =", value, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameNotEqualTo(String value) {
addCriterion("channel_name <>", value, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameGreaterThan(String value) {
addCriterion("channel_name >", value, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameGreaterThanOrEqualTo(String value) {
addCriterion("channel_name >=", value, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameLessThan(String value) {
addCriterion("channel_name <", value, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameLessThanOrEqualTo(String value) {
addCriterion("channel_name <=", value, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameLike(String value) {
addCriterion("channel_name like", value, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameNotLike(String value) {
addCriterion("channel_name not like", value, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameIn(List<String> values) {
addCriterion("channel_name in", values, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameNotIn(List<String> values) {
addCriterion("channel_name not in", values, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameBetween(String value1, String value2) {
addCriterion("channel_name between", value1, value2, "channelName");
return (Criteria) this;
}
public Criteria andChannelNameNotBetween(String value1, String value2) {
addCriterion("channel_name not between", value1, value2, "channelName");
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);
}
}
}

View File

@ -224,63 +224,63 @@ public class SysMsgExample {
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
public Criteria andTypeIdIsNull() {
addCriterion("type_id is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
public Criteria andTypeIdIsNotNull() {
addCriterion("type_id is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(Integer value) {
addCriterion("`type` =", value, "type");
public Criteria andTypeIdEqualTo(Long value) {
addCriterion("type_id =", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(Integer value) {
addCriterion("`type` <>", value, "type");
public Criteria andTypeIdNotEqualTo(Long value) {
addCriterion("type_id <>", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(Integer value) {
addCriterion("`type` >", value, "type");
public Criteria andTypeIdGreaterThan(Long value) {
addCriterion("type_id >", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
addCriterion("`type` >=", value, "type");
public Criteria andTypeIdGreaterThanOrEqualTo(Long value) {
addCriterion("type_id >=", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeLessThan(Integer value) {
addCriterion("`type` <", value, "type");
public Criteria andTypeIdLessThan(Long value) {
addCriterion("type_id <", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(Integer value) {
addCriterion("`type` <=", value, "type");
public Criteria andTypeIdLessThanOrEqualTo(Long value) {
addCriterion("type_id <=", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIn(List<Integer> values) {
addCriterion("`type` in", values, "type");
public Criteria andTypeIdIn(List<Long> values) {
addCriterion("type_id in", values, "typeId");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<Integer> values) {
addCriterion("`type` not in", values, "type");
public Criteria andTypeIdNotIn(List<Long> values) {
addCriterion("type_id not in", values, "typeId");
return (Criteria) this;
}
public Criteria andTypeBetween(Integer value1, Integer value2) {
addCriterion("`type` between", value1, value2, "type");
public Criteria andTypeIdBetween(Long value1, Long value2) {
addCriterion("type_id between", value1, value2, "typeId");
return (Criteria) this;
}
public Criteria andTypeNotBetween(Integer value1, Integer value2) {
addCriterion("`type` not between", value1, value2, "type");
public Criteria andTypeIdNotBetween(Long value1, Long value2) {
addCriterion("type_id not between", value1, value2, "typeId");
return (Criteria) this;
}
@ -344,76 +344,6 @@ public class SysMsgExample {
return (Criteria) this;
}
public Criteria andRouterIsNull() {
addCriterion("router is null");
return (Criteria) this;
}
public Criteria andRouterIsNotNull() {
addCriterion("router is not null");
return (Criteria) this;
}
public Criteria andRouterEqualTo(String value) {
addCriterion("router =", value, "router");
return (Criteria) this;
}
public Criteria andRouterNotEqualTo(String value) {
addCriterion("router <>", value, "router");
return (Criteria) this;
}
public Criteria andRouterGreaterThan(String value) {
addCriterion("router >", value, "router");
return (Criteria) this;
}
public Criteria andRouterGreaterThanOrEqualTo(String value) {
addCriterion("router >=", value, "router");
return (Criteria) this;
}
public Criteria andRouterLessThan(String value) {
addCriterion("router <", value, "router");
return (Criteria) this;
}
public Criteria andRouterLessThanOrEqualTo(String value) {
addCriterion("router <=", value, "router");
return (Criteria) this;
}
public Criteria andRouterLike(String value) {
addCriterion("router like", value, "router");
return (Criteria) this;
}
public Criteria andRouterNotLike(String value) {
addCriterion("router not like", value, "router");
return (Criteria) this;
}
public Criteria andRouterIn(List<String> values) {
addCriterion("router in", values, "router");
return (Criteria) this;
}
public Criteria andRouterNotIn(List<String> values) {
addCriterion("router not in", values, "router");
return (Criteria) this;
}
public Criteria andRouterBetween(String value1, String value2) {
addCriterion("router between", value1, value2, "router");
return (Criteria) this;
}
public Criteria andRouterNotBetween(String value1, String value2) {
addCriterion("router not between", value1, value2, "router");
return (Criteria) this;
}
public Criteria andParamIsNull() {
addCriterion("param is null");
return (Criteria) this;

View File

@ -0,0 +1,19 @@
package io.dataease.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class SysMsgSetting implements Serializable {
private Long msgSettingId;
private Long userId;
private Long typeId;
private Long channelId;
private Boolean enable;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,500 @@
package io.dataease.base.domain;
import java.util.ArrayList;
import java.util.List;
public class SysMsgSettingExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SysMsgSettingExample() {
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 andMsgSettingIdIsNull() {
addCriterion("msg_setting_id is null");
return (Criteria) this;
}
public Criteria andMsgSettingIdIsNotNull() {
addCriterion("msg_setting_id is not null");
return (Criteria) this;
}
public Criteria andMsgSettingIdEqualTo(Long value) {
addCriterion("msg_setting_id =", value, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdNotEqualTo(Long value) {
addCriterion("msg_setting_id <>", value, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdGreaterThan(Long value) {
addCriterion("msg_setting_id >", value, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdGreaterThanOrEqualTo(Long value) {
addCriterion("msg_setting_id >=", value, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdLessThan(Long value) {
addCriterion("msg_setting_id <", value, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdLessThanOrEqualTo(Long value) {
addCriterion("msg_setting_id <=", value, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdIn(List<Long> values) {
addCriterion("msg_setting_id in", values, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdNotIn(List<Long> values) {
addCriterion("msg_setting_id not in", values, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdBetween(Long value1, Long value2) {
addCriterion("msg_setting_id between", value1, value2, "msgSettingId");
return (Criteria) this;
}
public Criteria andMsgSettingIdNotBetween(Long value1, Long value2) {
addCriterion("msg_setting_id not between", value1, value2, "msgSettingId");
return (Criteria) this;
}
public Criteria andUserIdIsNull() {
addCriterion("user_id is null");
return (Criteria) this;
}
public Criteria andUserIdIsNotNull() {
addCriterion("user_id is not null");
return (Criteria) this;
}
public Criteria andUserIdEqualTo(Long value) {
addCriterion("user_id =", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotEqualTo(Long value) {
addCriterion("user_id <>", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThan(Long value) {
addCriterion("user_id >", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdGreaterThanOrEqualTo(Long value) {
addCriterion("user_id >=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThan(Long value) {
addCriterion("user_id <", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdLessThanOrEqualTo(Long value) {
addCriterion("user_id <=", value, "userId");
return (Criteria) this;
}
public Criteria andUserIdIn(List<Long> values) {
addCriterion("user_id in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotIn(List<Long> values) {
addCriterion("user_id not in", values, "userId");
return (Criteria) this;
}
public Criteria andUserIdBetween(Long value1, Long value2) {
addCriterion("user_id between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andUserIdNotBetween(Long value1, Long value2) {
addCriterion("user_id not between", value1, value2, "userId");
return (Criteria) this;
}
public Criteria andTypeIdIsNull() {
addCriterion("type_id is null");
return (Criteria) this;
}
public Criteria andTypeIdIsNotNull() {
addCriterion("type_id is not null");
return (Criteria) this;
}
public Criteria andTypeIdEqualTo(Long value) {
addCriterion("type_id =", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdNotEqualTo(Long value) {
addCriterion("type_id <>", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdGreaterThan(Long value) {
addCriterion("type_id >", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdGreaterThanOrEqualTo(Long value) {
addCriterion("type_id >=", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdLessThan(Long value) {
addCriterion("type_id <", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdLessThanOrEqualTo(Long value) {
addCriterion("type_id <=", value, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdIn(List<Long> values) {
addCriterion("type_id in", values, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdNotIn(List<Long> values) {
addCriterion("type_id not in", values, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdBetween(Long value1, Long value2) {
addCriterion("type_id between", value1, value2, "typeId");
return (Criteria) this;
}
public Criteria andTypeIdNotBetween(Long value1, Long value2) {
addCriterion("type_id not between", value1, value2, "typeId");
return (Criteria) this;
}
public Criteria andChannelIdIsNull() {
addCriterion("channel_id is null");
return (Criteria) this;
}
public Criteria andChannelIdIsNotNull() {
addCriterion("channel_id is not null");
return (Criteria) this;
}
public Criteria andChannelIdEqualTo(Long value) {
addCriterion("channel_id =", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdNotEqualTo(Long value) {
addCriterion("channel_id <>", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdGreaterThan(Long value) {
addCriterion("channel_id >", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdGreaterThanOrEqualTo(Long value) {
addCriterion("channel_id >=", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdLessThan(Long value) {
addCriterion("channel_id <", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdLessThanOrEqualTo(Long value) {
addCriterion("channel_id <=", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdIn(List<Long> values) {
addCriterion("channel_id in", values, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdNotIn(List<Long> values) {
addCriterion("channel_id not in", values, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdBetween(Long value1, Long value2) {
addCriterion("channel_id between", value1, value2, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdNotBetween(Long value1, Long value2) {
addCriterion("channel_id not between", value1, value2, "channelId");
return (Criteria) this;
}
public Criteria andEnableIsNull() {
addCriterion("`enable` is null");
return (Criteria) this;
}
public Criteria andEnableIsNotNull() {
addCriterion("`enable` is not null");
return (Criteria) this;
}
public Criteria andEnableEqualTo(Boolean value) {
addCriterion("`enable` =", value, "enable");
return (Criteria) this;
}
public Criteria andEnableNotEqualTo(Boolean value) {
addCriterion("`enable` <>", value, "enable");
return (Criteria) this;
}
public Criteria andEnableGreaterThan(Boolean value) {
addCriterion("`enable` >", value, "enable");
return (Criteria) this;
}
public Criteria andEnableGreaterThanOrEqualTo(Boolean value) {
addCriterion("`enable` >=", value, "enable");
return (Criteria) this;
}
public Criteria andEnableLessThan(Boolean value) {
addCriterion("`enable` <", value, "enable");
return (Criteria) this;
}
public Criteria andEnableLessThanOrEqualTo(Boolean value) {
addCriterion("`enable` <=", value, "enable");
return (Criteria) this;
}
public Criteria andEnableIn(List<Boolean> values) {
addCriterion("`enable` in", values, "enable");
return (Criteria) this;
}
public Criteria andEnableNotIn(List<Boolean> values) {
addCriterion("`enable` not in", values, "enable");
return (Criteria) this;
}
public Criteria andEnableBetween(Boolean value1, Boolean value2) {
addCriterion("`enable` between", value1, value2, "enable");
return (Criteria) this;
}
public Criteria andEnableNotBetween(Boolean value1, Boolean value2) {
addCriterion("`enable` not between", value1, value2, "enable");
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);
}
}
}

View File

@ -0,0 +1,19 @@
package io.dataease.base.domain;
import java.io.Serializable;
import lombok.Data;
@Data
public class SysMsgType implements Serializable {
private Long msgTypeId;
private Long pid;
private String typeName;
private String router;
private String callback;
private static final long serialVersionUID = 1L;
}

View File

@ -0,0 +1,530 @@
package io.dataease.base.domain;
import java.util.ArrayList;
import java.util.List;
public class SysMsgTypeExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SysMsgTypeExample() {
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 andMsgTypeIdIsNull() {
addCriterion("msg_type_id is null");
return (Criteria) this;
}
public Criteria andMsgTypeIdIsNotNull() {
addCriterion("msg_type_id is not null");
return (Criteria) this;
}
public Criteria andMsgTypeIdEqualTo(Long value) {
addCriterion("msg_type_id =", value, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdNotEqualTo(Long value) {
addCriterion("msg_type_id <>", value, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdGreaterThan(Long value) {
addCriterion("msg_type_id >", value, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdGreaterThanOrEqualTo(Long value) {
addCriterion("msg_type_id >=", value, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdLessThan(Long value) {
addCriterion("msg_type_id <", value, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdLessThanOrEqualTo(Long value) {
addCriterion("msg_type_id <=", value, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdIn(List<Long> values) {
addCriterion("msg_type_id in", values, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdNotIn(List<Long> values) {
addCriterion("msg_type_id not in", values, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdBetween(Long value1, Long value2) {
addCriterion("msg_type_id between", value1, value2, "msgTypeId");
return (Criteria) this;
}
public Criteria andMsgTypeIdNotBetween(Long value1, Long value2) {
addCriterion("msg_type_id not between", value1, value2, "msgTypeId");
return (Criteria) this;
}
public Criteria andPidIsNull() {
addCriterion("pid is null");
return (Criteria) this;
}
public Criteria andPidIsNotNull() {
addCriterion("pid is not null");
return (Criteria) this;
}
public Criteria andPidEqualTo(Long value) {
addCriterion("pid =", value, "pid");
return (Criteria) this;
}
public Criteria andPidNotEqualTo(Long value) {
addCriterion("pid <>", value, "pid");
return (Criteria) this;
}
public Criteria andPidGreaterThan(Long value) {
addCriterion("pid >", value, "pid");
return (Criteria) this;
}
public Criteria andPidGreaterThanOrEqualTo(Long value) {
addCriterion("pid >=", value, "pid");
return (Criteria) this;
}
public Criteria andPidLessThan(Long value) {
addCriterion("pid <", value, "pid");
return (Criteria) this;
}
public Criteria andPidLessThanOrEqualTo(Long value) {
addCriterion("pid <=", value, "pid");
return (Criteria) this;
}
public Criteria andPidIn(List<Long> values) {
addCriterion("pid in", values, "pid");
return (Criteria) this;
}
public Criteria andPidNotIn(List<Long> values) {
addCriterion("pid not in", values, "pid");
return (Criteria) this;
}
public Criteria andPidBetween(Long value1, Long value2) {
addCriterion("pid between", value1, value2, "pid");
return (Criteria) this;
}
public Criteria andPidNotBetween(Long value1, Long value2) {
addCriterion("pid not between", value1, value2, "pid");
return (Criteria) this;
}
public Criteria andTypeNameIsNull() {
addCriterion("type_name is null");
return (Criteria) this;
}
public Criteria andTypeNameIsNotNull() {
addCriterion("type_name is not null");
return (Criteria) this;
}
public Criteria andTypeNameEqualTo(String value) {
addCriterion("type_name =", value, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameNotEqualTo(String value) {
addCriterion("type_name <>", value, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameGreaterThan(String value) {
addCriterion("type_name >", value, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameGreaterThanOrEqualTo(String value) {
addCriterion("type_name >=", value, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameLessThan(String value) {
addCriterion("type_name <", value, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameLessThanOrEqualTo(String value) {
addCriterion("type_name <=", value, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameLike(String value) {
addCriterion("type_name like", value, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameNotLike(String value) {
addCriterion("type_name not like", value, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameIn(List<String> values) {
addCriterion("type_name in", values, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameNotIn(List<String> values) {
addCriterion("type_name not in", values, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameBetween(String value1, String value2) {
addCriterion("type_name between", value1, value2, "typeName");
return (Criteria) this;
}
public Criteria andTypeNameNotBetween(String value1, String value2) {
addCriterion("type_name not between", value1, value2, "typeName");
return (Criteria) this;
}
public Criteria andRouterIsNull() {
addCriterion("router is null");
return (Criteria) this;
}
public Criteria andRouterIsNotNull() {
addCriterion("router is not null");
return (Criteria) this;
}
public Criteria andRouterEqualTo(String value) {
addCriterion("router =", value, "router");
return (Criteria) this;
}
public Criteria andRouterNotEqualTo(String value) {
addCriterion("router <>", value, "router");
return (Criteria) this;
}
public Criteria andRouterGreaterThan(String value) {
addCriterion("router >", value, "router");
return (Criteria) this;
}
public Criteria andRouterGreaterThanOrEqualTo(String value) {
addCriterion("router >=", value, "router");
return (Criteria) this;
}
public Criteria andRouterLessThan(String value) {
addCriterion("router <", value, "router");
return (Criteria) this;
}
public Criteria andRouterLessThanOrEqualTo(String value) {
addCriterion("router <=", value, "router");
return (Criteria) this;
}
public Criteria andRouterLike(String value) {
addCriterion("router like", value, "router");
return (Criteria) this;
}
public Criteria andRouterNotLike(String value) {
addCriterion("router not like", value, "router");
return (Criteria) this;
}
public Criteria andRouterIn(List<String> values) {
addCriterion("router in", values, "router");
return (Criteria) this;
}
public Criteria andRouterNotIn(List<String> values) {
addCriterion("router not in", values, "router");
return (Criteria) this;
}
public Criteria andRouterBetween(String value1, String value2) {
addCriterion("router between", value1, value2, "router");
return (Criteria) this;
}
public Criteria andRouterNotBetween(String value1, String value2) {
addCriterion("router not between", value1, value2, "router");
return (Criteria) this;
}
public Criteria andCallbackIsNull() {
addCriterion("callback is null");
return (Criteria) this;
}
public Criteria andCallbackIsNotNull() {
addCriterion("callback is not null");
return (Criteria) this;
}
public Criteria andCallbackEqualTo(String value) {
addCriterion("callback =", value, "callback");
return (Criteria) this;
}
public Criteria andCallbackNotEqualTo(String value) {
addCriterion("callback <>", value, "callback");
return (Criteria) this;
}
public Criteria andCallbackGreaterThan(String value) {
addCriterion("callback >", value, "callback");
return (Criteria) this;
}
public Criteria andCallbackGreaterThanOrEqualTo(String value) {
addCriterion("callback >=", value, "callback");
return (Criteria) this;
}
public Criteria andCallbackLessThan(String value) {
addCriterion("callback <", value, "callback");
return (Criteria) this;
}
public Criteria andCallbackLessThanOrEqualTo(String value) {
addCriterion("callback <=", value, "callback");
return (Criteria) this;
}
public Criteria andCallbackLike(String value) {
addCriterion("callback like", value, "callback");
return (Criteria) this;
}
public Criteria andCallbackNotLike(String value) {
addCriterion("callback not like", value, "callback");
return (Criteria) this;
}
public Criteria andCallbackIn(List<String> values) {
addCriterion("callback in", values, "callback");
return (Criteria) this;
}
public Criteria andCallbackNotIn(List<String> values) {
addCriterion("callback not in", values, "callback");
return (Criteria) this;
}
public Criteria andCallbackBetween(String value1, String value2) {
addCriterion("callback between", value1, value2, "callback");
return (Criteria) this;
}
public Criteria andCallbackNotBetween(String value1, String value2) {
addCriterion("callback not between", value1, value2, "callback");
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);
}
}
}

View File

@ -0,0 +1,30 @@
package io.dataease.base.mapper;
import io.dataease.base.domain.SysMsgChannel;
import io.dataease.base.domain.SysMsgChannelExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysMsgChannelMapper {
long countByExample(SysMsgChannelExample example);
int deleteByExample(SysMsgChannelExample example);
int deleteByPrimaryKey(Long msgChannelId);
int insert(SysMsgChannel record);
int insertSelective(SysMsgChannel record);
List<SysMsgChannel> selectByExample(SysMsgChannelExample example);
SysMsgChannel selectByPrimaryKey(Long msgChannelId);
int updateByExampleSelective(@Param("record") SysMsgChannel record, @Param("example") SysMsgChannelExample example);
int updateByExample(@Param("record") SysMsgChannel record, @Param("example") SysMsgChannelExample example);
int updateByPrimaryKeySelective(SysMsgChannel record);
int updateByPrimaryKey(SysMsgChannel record);
}

View File

@ -0,0 +1,164 @@
<?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.SysMsgChannelMapper">
<resultMap id="BaseResultMap" type="io.dataease.base.domain.SysMsgChannel">
<id column="msg_channel_id" jdbcType="BIGINT" property="msgChannelId" />
<result column="channel_name" jdbcType="VARCHAR" property="channelName" />
</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">
msg_channel_id, channel_name
</sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.SysMsgChannelExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_msg_channel
<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 sys_msg_channel
where msg_channel_id = #{msgChannelId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from sys_msg_channel
where msg_channel_id = #{msgChannelId,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="io.dataease.base.domain.SysMsgChannelExample">
delete from sys_msg_channel
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.SysMsgChannel">
insert into sys_msg_channel (msg_channel_id, channel_name)
values (#{msgChannelId,jdbcType=BIGINT}, #{channelName,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.SysMsgChannel">
insert into sys_msg_channel
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="msgChannelId != null">
msg_channel_id,
</if>
<if test="channelName != null">
channel_name,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="msgChannelId != null">
#{msgChannelId,jdbcType=BIGINT},
</if>
<if test="channelName != null">
#{channelName,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.base.domain.SysMsgChannelExample" resultType="java.lang.Long">
select count(*) from sys_msg_channel
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_msg_channel
<set>
<if test="record.msgChannelId != null">
msg_channel_id = #{record.msgChannelId,jdbcType=BIGINT},
</if>
<if test="record.channelName != null">
channel_name = #{record.channelName,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_msg_channel
set msg_channel_id = #{record.msgChannelId,jdbcType=BIGINT},
channel_name = #{record.channelName,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.SysMsgChannel">
update sys_msg_channel
<set>
<if test="channelName != null">
channel_name = #{channelName,jdbcType=VARCHAR},
</if>
</set>
where msg_channel_id = #{msgChannelId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SysMsgChannel">
update sys_msg_channel
set channel_name = #{channelName,jdbcType=VARCHAR}
where msg_channel_id = #{msgChannelId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -4,9 +4,8 @@
<resultMap id="BaseResultMap" type="io.dataease.base.domain.SysMsg">
<id column="msg_id" jdbcType="BIGINT" property="msgId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="type" jdbcType="INTEGER" property="type" />
<result column="type_id" jdbcType="BIGINT" property="typeId" />
<result column="status" jdbcType="BIT" property="status" />
<result column="router" jdbcType="VARCHAR" property="router" />
<result column="param" jdbcType="VARCHAR" property="param" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="read_time" jdbcType="BIGINT" property="readTime" />
@ -71,7 +70,7 @@
</where>
</sql>
<sql id="Base_Column_List">
msg_id, user_id, `type`, `status`, router, param, create_time, read_time, content
msg_id, user_id, type_id, `status`, param, create_time, read_time, content
</sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.SysMsgExample" resultMap="BaseResultMap">
select
@ -104,14 +103,12 @@
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.SysMsg">
insert into sys_msg (msg_id, user_id, `type`,
`status`, router, param,
create_time, read_time, content
)
values (#{msgId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{type,jdbcType=INTEGER},
#{status,jdbcType=BIT}, #{router,jdbcType=VARCHAR}, #{param,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{readTime,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR}
)
insert into sys_msg (msg_id, user_id, type_id,
`status`, param, create_time,
read_time, content)
values (#{msgId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{typeId,jdbcType=BIGINT},
#{status,jdbcType=BIT}, #{param,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{readTime,jdbcType=BIGINT}, #{content,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.SysMsg">
insert into sys_msg
@ -122,15 +119,12 @@
<if test="userId != null">
user_id,
</if>
<if test="type != null">
`type`,
<if test="typeId != null">
type_id,
</if>
<if test="status != null">
`status`,
</if>
<if test="router != null">
router,
</if>
<if test="param != null">
param,
</if>
@ -151,15 +145,12 @@
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="type != null">
#{type,jdbcType=INTEGER},
<if test="typeId != null">
#{typeId,jdbcType=BIGINT},
</if>
<if test="status != null">
#{status,jdbcType=BIT},
</if>
<if test="router != null">
#{router,jdbcType=VARCHAR},
</if>
<if test="param != null">
#{param,jdbcType=VARCHAR},
</if>
@ -189,15 +180,12 @@
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=INTEGER},
<if test="record.typeId != null">
type_id = #{record.typeId,jdbcType=BIGINT},
</if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=BIT},
</if>
<if test="record.router != null">
router = #{record.router,jdbcType=VARCHAR},
</if>
<if test="record.param != null">
param = #{record.param,jdbcType=VARCHAR},
</if>
@ -219,9 +207,8 @@
update sys_msg
set msg_id = #{record.msgId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
`type` = #{record.type,jdbcType=INTEGER},
type_id = #{record.typeId,jdbcType=BIGINT},
`status` = #{record.status,jdbcType=BIT},
router = #{record.router,jdbcType=VARCHAR},
param = #{record.param,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
read_time = #{record.readTime,jdbcType=BIGINT},
@ -236,15 +223,12 @@
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="type != null">
`type` = #{type,jdbcType=INTEGER},
<if test="typeId != null">
type_id = #{typeId,jdbcType=BIGINT},
</if>
<if test="status != null">
`status` = #{status,jdbcType=BIT},
</if>
<if test="router != null">
router = #{router,jdbcType=VARCHAR},
</if>
<if test="param != null">
param = #{param,jdbcType=VARCHAR},
</if>
@ -263,9 +247,8 @@
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SysMsg">
update sys_msg
set user_id = #{userId,jdbcType=BIGINT},
`type` = #{type,jdbcType=INTEGER},
type_id = #{typeId,jdbcType=BIGINT},
`status` = #{status,jdbcType=BIT},
router = #{router,jdbcType=VARCHAR},
param = #{param,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
read_time = #{readTime,jdbcType=BIGINT},

View File

@ -0,0 +1,30 @@
package io.dataease.base.mapper;
import io.dataease.base.domain.SysMsgSetting;
import io.dataease.base.domain.SysMsgSettingExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysMsgSettingMapper {
long countByExample(SysMsgSettingExample example);
int deleteByExample(SysMsgSettingExample example);
int deleteByPrimaryKey(Long msgSettingId);
int insert(SysMsgSetting record);
int insertSelective(SysMsgSetting record);
List<SysMsgSetting> selectByExample(SysMsgSettingExample example);
SysMsgSetting selectByPrimaryKey(Long msgSettingId);
int updateByExampleSelective(@Param("record") SysMsgSetting record, @Param("example") SysMsgSettingExample example);
int updateByExample(@Param("record") SysMsgSetting record, @Param("example") SysMsgSettingExample example);
int updateByPrimaryKeySelective(SysMsgSetting record);
int updateByPrimaryKey(SysMsgSetting record);
}

View File

@ -0,0 +1,211 @@
<?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.SysMsgSettingMapper">
<resultMap id="BaseResultMap" type="io.dataease.base.domain.SysMsgSetting">
<id column="msg_setting_id" jdbcType="BIGINT" property="msgSettingId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="type_id" jdbcType="BIGINT" property="typeId" />
<result column="channel_id" jdbcType="BIGINT" property="channelId" />
<result column="enable" jdbcType="BIT" property="enable" />
</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">
msg_setting_id, user_id, type_id, channel_id, `enable`
</sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.SysMsgSettingExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_msg_setting
<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 sys_msg_setting
where msg_setting_id = #{msgSettingId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from sys_msg_setting
where msg_setting_id = #{msgSettingId,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="io.dataease.base.domain.SysMsgSettingExample">
delete from sys_msg_setting
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.SysMsgSetting">
insert into sys_msg_setting (msg_setting_id, user_id, type_id,
channel_id, `enable`)
values (#{msgSettingId,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{typeId,jdbcType=BIGINT},
#{channelId,jdbcType=BIGINT}, #{enable,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.SysMsgSetting">
insert into sys_msg_setting
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="msgSettingId != null">
msg_setting_id,
</if>
<if test="userId != null">
user_id,
</if>
<if test="typeId != null">
type_id,
</if>
<if test="channelId != null">
channel_id,
</if>
<if test="enable != null">
`enable`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="msgSettingId != null">
#{msgSettingId,jdbcType=BIGINT},
</if>
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="typeId != null">
#{typeId,jdbcType=BIGINT},
</if>
<if test="channelId != null">
#{channelId,jdbcType=BIGINT},
</if>
<if test="enable != null">
#{enable,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.base.domain.SysMsgSettingExample" resultType="java.lang.Long">
select count(*) from sys_msg_setting
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_msg_setting
<set>
<if test="record.msgSettingId != null">
msg_setting_id = #{record.msgSettingId,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.typeId != null">
type_id = #{record.typeId,jdbcType=BIGINT},
</if>
<if test="record.channelId != null">
channel_id = #{record.channelId,jdbcType=BIGINT},
</if>
<if test="record.enable != null">
`enable` = #{record.enable,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_msg_setting
set msg_setting_id = #{record.msgSettingId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
type_id = #{record.typeId,jdbcType=BIGINT},
channel_id = #{record.channelId,jdbcType=BIGINT},
`enable` = #{record.enable,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.SysMsgSetting">
update sys_msg_setting
<set>
<if test="userId != null">
user_id = #{userId,jdbcType=BIGINT},
</if>
<if test="typeId != null">
type_id = #{typeId,jdbcType=BIGINT},
</if>
<if test="channelId != null">
channel_id = #{channelId,jdbcType=BIGINT},
</if>
<if test="enable != null">
`enable` = #{enable,jdbcType=BIT},
</if>
</set>
where msg_setting_id = #{msgSettingId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SysMsgSetting">
update sys_msg_setting
set user_id = #{userId,jdbcType=BIGINT},
type_id = #{typeId,jdbcType=BIGINT},
channel_id = #{channelId,jdbcType=BIGINT},
`enable` = #{enable,jdbcType=BIT}
where msg_setting_id = #{msgSettingId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -0,0 +1,30 @@
package io.dataease.base.mapper;
import io.dataease.base.domain.SysMsgType;
import io.dataease.base.domain.SysMsgTypeExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysMsgTypeMapper {
long countByExample(SysMsgTypeExample example);
int deleteByExample(SysMsgTypeExample example);
int deleteByPrimaryKey(Long msgTypeId);
int insert(SysMsgType record);
int insertSelective(SysMsgType record);
List<SysMsgType> selectByExample(SysMsgTypeExample example);
SysMsgType selectByPrimaryKey(Long msgTypeId);
int updateByExampleSelective(@Param("record") SysMsgType record, @Param("example") SysMsgTypeExample example);
int updateByExample(@Param("record") SysMsgType record, @Param("example") SysMsgTypeExample example);
int updateByPrimaryKeySelective(SysMsgType record);
int updateByPrimaryKey(SysMsgType record);
}

View File

@ -0,0 +1,211 @@
<?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.SysMsgTypeMapper">
<resultMap id="BaseResultMap" type="io.dataease.base.domain.SysMsgType">
<id column="msg_type_id" jdbcType="BIGINT" property="msgTypeId" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="type_name" jdbcType="VARCHAR" property="typeName" />
<result column="router" jdbcType="VARCHAR" property="router" />
<result column="callback" jdbcType="VARCHAR" property="callback" />
</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">
msg_type_id, pid, type_name, router, callback
</sql>
<select id="selectByExample" parameterType="io.dataease.base.domain.SysMsgTypeExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from sys_msg_type
<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 sys_msg_type
where msg_type_id = #{msgTypeId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from sys_msg_type
where msg_type_id = #{msgTypeId,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="io.dataease.base.domain.SysMsgTypeExample">
delete from sys_msg_type
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.dataease.base.domain.SysMsgType">
insert into sys_msg_type (msg_type_id, pid, type_name,
router, callback)
values (#{msgTypeId,jdbcType=BIGINT}, #{pid,jdbcType=BIGINT}, #{typeName,jdbcType=VARCHAR},
#{router,jdbcType=VARCHAR}, #{callback,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.SysMsgType">
insert into sys_msg_type
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="msgTypeId != null">
msg_type_id,
</if>
<if test="pid != null">
pid,
</if>
<if test="typeName != null">
type_name,
</if>
<if test="router != null">
router,
</if>
<if test="callback != null">
callback,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="msgTypeId != null">
#{msgTypeId,jdbcType=BIGINT},
</if>
<if test="pid != null">
#{pid,jdbcType=BIGINT},
</if>
<if test="typeName != null">
#{typeName,jdbcType=VARCHAR},
</if>
<if test="router != null">
#{router,jdbcType=VARCHAR},
</if>
<if test="callback != null">
#{callback,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.base.domain.SysMsgTypeExample" resultType="java.lang.Long">
select count(*) from sys_msg_type
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update sys_msg_type
<set>
<if test="record.msgTypeId != null">
msg_type_id = #{record.msgTypeId,jdbcType=BIGINT},
</if>
<if test="record.pid != null">
pid = #{record.pid,jdbcType=BIGINT},
</if>
<if test="record.typeName != null">
type_name = #{record.typeName,jdbcType=VARCHAR},
</if>
<if test="record.router != null">
router = #{record.router,jdbcType=VARCHAR},
</if>
<if test="record.callback != null">
callback = #{record.callback,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update sys_msg_type
set msg_type_id = #{record.msgTypeId,jdbcType=BIGINT},
pid = #{record.pid,jdbcType=BIGINT},
type_name = #{record.typeName,jdbcType=VARCHAR},
router = #{record.router,jdbcType=VARCHAR},
callback = #{record.callback,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.SysMsgType">
update sys_msg_type
<set>
<if test="pid != null">
pid = #{pid,jdbcType=BIGINT},
</if>
<if test="typeName != null">
type_name = #{typeName,jdbcType=VARCHAR},
</if>
<if test="router != null">
router = #{router,jdbcType=VARCHAR},
</if>
<if test="callback != null">
callback = #{callback,jdbcType=VARCHAR},
</if>
</set>
where msg_type_id = #{msgTypeId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.SysMsgType">
update sys_msg_type
set pid = #{pid,jdbcType=BIGINT},
type_name = #{typeName,jdbcType=VARCHAR},
router = #{router,jdbcType=VARCHAR},
callback = #{callback,jdbcType=VARCHAR}
where msg_type_id = #{msgTypeId,jdbcType=BIGINT}
</update>
</mapper>

View File

@ -1,5 +1,7 @@
package io.dataease.base.mapper.ext;
import io.dataease.base.domain.SysMsgExample;
import io.dataease.controller.message.dto.MsgGridDto;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -33,4 +35,7 @@ public interface ExtSysMsgMapper {
int batchDelete(@Param("msgIds") List<Long> msgIds);
List<MsgGridDto> queryGrid(SysMsgExample example);
}

View File

@ -0,0 +1,60 @@
<?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.ExtSysMsgMapper">
<resultMap id="msgGridDto" type="io.dataease.controller.message.dto.MsgGridDto" extends="io.dataease.base.mapper.SysMsgMapper.BaseResultMap">
<result column="router" property="router"></result>
<result column="callback" property="callback"></result>
</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>
<select id="queryGrid" parameterType="io.dataease.base.domain.SysMsgExample" resultMap="msgGridDto">
select sm.*, smt.router, smt.callback
from sys_msg sm
left join sys_msg_type smt on smt.msg_type_id = sm.type_id
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
<if test="orderByClause == null">
order by sm.status asc
</if>
</select>
</mapper>

View File

@ -0,0 +1,8 @@
package io.dataease.commons.constants;
public class SysMsgConstants {
public final static String SYS_MSG_CHANNEL = "sys_msg_channel";
public final static String SYS_MSG_TYPE = "sys_msg_type";
public final static String SYS_MSG_USER_SUBSCRIBE = "sys_msg_user_subscribe";
}

View File

@ -2,16 +2,20 @@ package io.dataease.controller.message;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.dataease.base.domain.SysMsg;
import io.dataease.base.domain.SysMsgChannel;
import io.dataease.base.domain.SysMsgSetting;
import io.dataease.base.domain.SysMsgType;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.PageUtils;
import io.dataease.commons.utils.Pager;
import io.dataease.controller.message.dto.MsgGridDto;
import io.dataease.controller.message.dto.MsgRequest;
import io.dataease.controller.message.dto.MsgSettingRequest;
import io.dataease.controller.message.dto.SettingTreeNode;
import io.dataease.service.message.SysMsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@ -25,10 +29,10 @@ public class MsgController {
@ApiOperation("查询消息")
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<SysMsg>> messages(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody MsgRequest msgRequest) {
public Pager<List<MsgGridDto>> messages(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody MsgRequest msgRequest) {
Long userId = AuthUtils.getUser().getUserId();
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
Pager<List<SysMsg>> listPager = PageUtils.setPageInfo(page, sysMsgService.query(userId, msgRequest));
Pager<List<MsgGridDto>> listPager = PageUtils.setPageInfo(page, sysMsgService.queryGrid(userId, msgRequest));
return listPager;
}
@ -47,4 +51,32 @@ public class MsgController {
public void batchDelete(@RequestBody List<Long> msgIds) {
sysMsgService.batchDelete(msgIds);
}
@PostMapping("/treeNodes")
public List<SettingTreeNode> treeNodes() {
return sysMsgService.treeNodes();
}
@PostMapping("/channelList")
public List<SysMsgChannel> channelList() {
return sysMsgService.channelList();
}
@PostMapping("/settingList")
public List<SysMsgSetting> settingList() {
return sysMsgService.settingList();
}
@PostMapping("/updateSetting")
public void updateSetting(@RequestBody MsgSettingRequest request) {
Long userId = AuthUtils.getUser().getUserId();
sysMsgService.updateSetting(request, userId);
}
@PostMapping("/types")
public List<SysMsgType> allTypes() {
List<SysMsgType> sysMsgTypes = sysMsgService.queryMsgTypes();
return sysMsgTypes;
}
}

View File

@ -0,0 +1,11 @@
package io.dataease.controller.message.dto;
import io.dataease.base.domain.SysMsg;
import lombok.Data;
@Data
public class MsgGridDto extends SysMsg {
private String router;
private String callback;
}

View File

@ -10,7 +10,7 @@ public class MsgRequest implements Serializable {
private static final long serialVersionUID = 1920091635946508658L;
private Integer type;
private Long type;
private Boolean status;

View File

@ -0,0 +1,14 @@
package io.dataease.controller.message.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class MsgSettingRequest implements Serializable {
private Long typeId;
private Long channelId;
}

View File

@ -0,0 +1,19 @@
package io.dataease.controller.message.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class SettingTreeNode implements Serializable {
private static final long serialVersionUID = -2416283978185545199L;
private Long id;
private String name;
private List<SettingTreeNode> children;
}

View File

@ -0,0 +1,20 @@
package io.dataease.controller.message.dto;
import lombok.Data;
import java.io.Serializable;
@Data
public class SubscribeNode implements Serializable {
private static final long serialVersionUID = -1680823237289721438L;
private Long typeId;
private Long channelId;
public Boolean match(Long type, Long channel) {
return type == typeId && channel == channelId;
}
}

View File

@ -1,5 +1,55 @@
package io.dataease.datasource.constants;
public enum DatasourceTypes {
mysql, sqlServer, excel, doris, oracle
excel("excel", "excel", "", "", "", "", ""),
mysql("mysql", "mysql", "com.mysql.jdbc.Driver", "`", "`", "'", "'"),
sqlServer("sqlServer", "sqlServer", "com.microsoft.sqlserver.jdbc.SQLServerDriver", "\"", "\"", "\"", "\""),
doris("doris", "doris", "com.mysql.jdbc.Driver", "`", "`", "", ""),
oracle("oracle", "oracle", "oracle.jdbc.driver.OracleDriver", "\"", "\"", "\"", "\"");
private String feature;
private String desc;
private String driver;
private String keywordPrefix;
private String keywordSuffix;
private String aliasPrefix;
private String aliasSuffix;
DatasourceTypes(String feature, String desc, String driver, String keywordPrefix, String keywordSuffix, String aliasPrefix, String aliasSuffix) {
this.feature = feature;
this.desc = desc;
this.driver = driver;
this.keywordPrefix = keywordPrefix;
this.keywordSuffix = keywordSuffix;
this.aliasPrefix = aliasPrefix;
this.aliasSuffix = aliasSuffix;
}
public String getFeature() {
return feature;
}
public String getDesc() {
return desc;
}
public String getDriver() {
return driver;
}
public String getKeywordPrefix() {
return keywordPrefix;
}
public String getKeywordSuffix() {
return keywordSuffix;
}
public String getAliasPrefix() {
return aliasPrefix;
}
public String getAliasSuffix() {
return aliasSuffix;
}
}

View File

@ -0,0 +1,29 @@
package io.dataease.dto.sqlObj;
import lombok.Builder;
import lombok.Data;
/**
* @Author gin
* @Date 2021/7/9 12:12 下午
*/
@Data
@Builder
public class SQLObj {
private String tableName;
private String tableAlias;
private String fieldName;
private String fieldAlias;
private String groupField;
private String groupAlias;
private String orderField;
private String orderAlias;
private String orderDirection;
private String whereField;
private String whereAlias;
private String whereTermAndValue;
}

View File

@ -8,9 +8,34 @@ import java.util.List;
* @Date 2021/7/8 3:12 下午
*/
public class SQLConstants {
/**
* 维度类型list
*/
public static final List<Integer> DIMENSION_TYPE = new ArrayList<Integer>() {{
add(0);// 文本
add(1);// 时间
add(5);// 地理位置
}};
/**
* 指标类型list
*/
public static final List<Integer> QUOTA_TYPE = new ArrayList<Integer>() {{
add(2);// 整型
add(3);// 浮点
add(4);// 布尔
}};
/**
* sql ST模板
*/
public static final String SQL_TEMPLATE = "sql/sqlTemplate.stg";
public static final String TABLE_ALIAS_PREFIX = "T_A_%s";
public static final String FIELD_ALIAS_X_PREFIX = "F_AX_%s";
public static final String FIELD_ALIAS_Y_PREFIX = "F_AY_%s";
public static final String GROUP_ALIAS_PREFIX = "G_A_%s";
public static final String ORDER_ALIAS_X_PREFIX = "O_AX_%s";
public static final String ORDER_ALIAS_Y_PREFIX = "O_AY_%s";
public static final String WHERE_ALIAS_PREFIX = "W_A_%s";
}

View File

@ -0,0 +1,41 @@
package io.dataease.provider.mysql;
import io.dataease.provider.SQLConstants;
import static io.dataease.datasource.constants.DatasourceTypes.mysql;
/**
* @Author gin
* @Date 2021/7/8 7:22 下午
*/
public class MySQLConstants extends SQLConstants {
public static final String KEYWORD_TABLE = mysql.getKeywordPrefix() + "%s" + mysql.getKeywordSuffix();
public static final String KEYWORD_FIX = "%s." + mysql.getKeywordPrefix() + "%s" + mysql.getKeywordSuffix();
public static final String UNIX_TIMESTAMP = "UNIX_TIMESTAMP(%s)";
public static final String DATE_FORMAT = "DATE_FORMAT(%s,'%s')";
public static final String FROM_UNIXTIME = "FROM_UNIXTIME(%s,'%s')";
public static final String CAST = "CAST(%s AS %s)";
public static final String DEFAULT_DATE_FORMAT = "%Y-%m-%d %H:%i:%S";
public static final String DEFAULT_INT_FORMAT = "DECIMAL(20,0)";
public static final String DEFAULT_FLOAT_FORMAT = "DECIMAL(20,2)";
public static final String WHERE_VALUE_NULL = "(null,'')";
public static final String WHERE_VALUE_VALUE = "'%s'";
public static final String AGG_COUNT = "COUNT(*)";
public static final String AGG_FIELD = "%s(%s)";
public static final String WHERE_BETWEEN = "'%s' AND '%s'";
public static final String BRACKETS = "(%s)";
}

View File

@ -4,19 +4,25 @@ import io.dataease.base.domain.DatasetTableField;
import io.dataease.controller.request.chart.ChartExtFilterRequest;
import io.dataease.dto.chart.ChartCustomFilterDTO;
import io.dataease.dto.chart.ChartViewFieldDTO;
import io.dataease.dto.sqlObj.SQLObj;
import io.dataease.provider.QueryProvider;
import io.dataease.provider.SQLConstants;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.stringtemplate.v4.ST;
import org.stringtemplate.v4.STGroup;
import org.stringtemplate.v4.STGroupFile;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static io.dataease.provider.SQLConstants.TABLE_ALIAS_PREFIX;
/**
* @Author gin
* @Date 2021/5/17 2:43 下午
@ -75,40 +81,59 @@ public class MysqlQueryProvider extends QueryProvider {
@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.getOriginName()).append("`)*1000 AS ").append(f.getDataeaseName());
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MySQLConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build();
List<SQLObj> xFields = new ArrayList<>();
if (CollectionUtils.isNotEmpty(fields)) {
for (int i = 0; i < fields.size(); i++) {
DatasetTableField f = fields.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), f.getOriginName());
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
String fieldName = "";
// 处理横轴字段
if (f.getDeExtractType() == 1) {
if (f.getDeType() == 2 || f.getDeType() == 3) {
fieldName = String.format(MySQLConstants.UNIX_TIMESTAMP, originField) + "*1000";
} else {
fieldName = originField;
}
} else if (f.getDeExtractType() == 0) {
if (f.getDeType() == 2) {
fieldName = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_INT_FORMAT);
} else if (f.getDeType() == 3) {
fieldName = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_FLOAT_FORMAT);
} else if (f.getDeType() == 1) {
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, MySQLConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
} else {
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
}
} else if (f.getDeExtractType() == 0) {
if (f.getDeType() == 2) {
stringBuilder.append("CAST(`").append(f.getOriginName()).append("` AS DECIMAL(20,0)) AS ").append(f.getDataeaseName());
} else if (f.getDeType() == 3) {
stringBuilder.append("CAST(`").append(f.getOriginName()).append("` AS DECIMAL(20,2)) AS ").append(f.getDataeaseName());
} else if (f.getDeType() == 1) {
stringBuilder.append("DATE_FORMAT(`").append(f.getOriginName()).append("`,'%Y-%m-%d %H:%i:%S') AS _").append(f.getDataeaseName());
} else {
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
}
} else {
if (f.getDeType() == 1) {
stringBuilder.append("FROM_UNIXTIME(CAST(`").append(f.getOriginName()).append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') AS ").append(f.getDataeaseName());
} else {
stringBuilder.append("`").append(f.getOriginName()).append("` AS ").append(f.getDataeaseName());
if (f.getDeType() == 1) {
String cast = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
fieldName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
} else {
fieldName = originField;
}
}
xFields.add(SQLObj.builder()
.fieldName(fieldName)
.fieldAlias(fieldAlias)
.build());
}
return stringBuilder.toString();
}).toArray(String[]::new);
return MessageFormat.format("SELECT {0} FROM {1} ORDER BY null", StringUtils.join(array, ","), table);
}
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
ST st_sql = stg.getInstanceOf("querySql");
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
return st_sql.render();
}
@Override
public String createQuerySQLAsTmp(String sql, List<DatasetTableField> fields) {
return createQuerySQL(" (" + sqlFix(sql) + ") AS tmp ", fields);
return createQuerySQL("(" + sqlFix(sql) + ")", fields);
}
@Override
@ -133,145 +158,98 @@ public class MysqlQueryProvider extends QueryProvider {
@Override
public String getSQL(String table, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) {
// 字段汇总 排序等
String[] field = yAxis.stream().map(y -> {
StringBuilder f = new StringBuilder();
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
f.append(y.getSummary()).append("(").append(y.getOriginName()).append(")");
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
f.append(y.getSummary()).append("(`").append(y.getOriginName()).append("`)");
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
f.append("CAST(")
.append(y.getSummary()).append("(")
.append("CAST(`").append(y.getOriginName()).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.getOriginName()).append("` AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
.append(")");
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MySQLConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build();
List<SQLObj> xFields = new ArrayList<>();
List<SQLObj> xWheres = new ArrayList<>();
List<SQLObj> xOrders = new ArrayList<>();
if (CollectionUtils.isNotEmpty(xAxis)) {
for (int i = 0; i < xAxis.size(); i++) {
ChartViewFieldDTO x = xAxis.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), x.getOriginName());
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_X_PREFIX, i);
// 处理横轴字段
xFields.add(getXFields(x, originField, fieldAlias));
// 处理横轴过滤
xWheres.addAll(getXWheres(x, originField, fieldAlias));
// 处理横轴排序
if (StringUtils.isNotEmpty(x.getSort()) && !StringUtils.equalsIgnoreCase(x.getSort(), "none")) {
xOrders.add(SQLObj.builder()
.orderField(originField)
.orderAlias(fieldAlias)
.orderDirection(x.getSort())
.build());
}
}
f.append(" AS `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
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.getOriginName()).append("`)*1000 AS `_").append(x.getOriginName()).append("`");
} else if (x.getDeType() == 1) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
stringBuilder.append("DATE_FORMAT(`").append(x.getOriginName()).append("`,'").append(format).append("') AS `_").append(x.getOriginName()).append("`");
} else {
stringBuilder.append("`").append(x.getOriginName()).append("` AS `_").append(x.getOriginName()).append("`");
}
} else {
if (x.getDeType() == 1) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == 0) {
stringBuilder.append("DATE_FORMAT(`").append(x.getOriginName()).append("`,'").append(format).append("') AS `_").append(x.getOriginName()).append("`");
} else {
stringBuilder.append("DATE_FORMAT(").append("FROM_UNIXTIME(CAST(`").append(x.getOriginName()).append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S')").append(",'").append(format).append("') AS `_").append(x.getOriginName()).append("`");
}
} else {
stringBuilder.append("`").append(x.getOriginName()).append("` AS `_").append(x.getOriginName()).append("`");
}
List<SQLObj> yFields = new ArrayList<>();
List<SQLObj> yWheres = new ArrayList<>();
List<SQLObj> yOrders = new ArrayList<>();
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
// 处理纵轴过滤
yWheres.addAll(getYWheres(y, originField, fieldAlias));
// 处理纵轴排序
if (StringUtils.isNotEmpty(y.getSort()) && !StringUtils.equalsIgnoreCase(y.getSort(), "none")) {
yOrders.add(SQLObj.builder()
.orderField(originField)
.orderAlias(fieldAlias)
.orderDirection(y.getSort())
.build());
}
}
return stringBuilder.toString();
}).toArray(String[]::new);
String[] group = xAxis.stream().map(x -> "`_" + x.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();
if (x.getDeType() == 1 && x.getDeExtractType() != 1) {
filter.append(" AND FROM_UNIXTIME(cast(`")
.append(x.getOriginName())
.append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
} else {
filter.append(" AND `").append(x.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `").append(x.getOriginName()).append("`").append(" <> ''");
} 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, " ") : "") + transCustomFilter(customFilter) + transExtFilter(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.getOriginName(), "*") ? "" : y.getOriginName()).append("`")
.append(" AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
} else {
filter.append(" AND `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())
.append("`").append(" <> ''");
} 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} ORDER BY {2}",
"(" + sql + ") AS tmp",
StringUtils.join(resultFilter, " "),
ObjectUtils.isNotEmpty(yOrder) ? StringUtils.join(yOrder, ",") : "null");
return filterSql;
}
// 处理视图中字段过滤
List<SQLObj> customWheres = transCustomFilterList(tableObj, customFilter);
// 处理仪表板字段过滤
List<SQLObj> extWheres = transExtFilterList(tableObj, extFilterRequestList);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(xFields);
fields.addAll(yFields);
List<SQLObj> wheres = new ArrayList<>();
wheres.addAll(xWheres);
if (customWheres != null) wheres.addAll(customWheres);
if (extWheres != null) wheres.addAll(extWheres);
List<SQLObj> groups = new ArrayList<>();
groups.addAll(xFields);
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();
orders.addAll(xOrders);
orders.addAll(yOrders);
List<SQLObj> aggWheres = new ArrayList<>();
aggWheres.addAll(yWheres);
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
ST st_sql = stg.getInstanceOf("querySql");
if (CollectionUtils.isNotEmpty(xFields)) st_sql.add("groups", xFields);
if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String sql = st_sql.render();
ST st = stg.getInstanceOf("querySql");
SQLObj tableSQL = SQLObj.builder()
.tableName(String.format(MySQLConstants.BRACKETS, sql))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
.build();
if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres);
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return st.render();
}
@Override
public String getSQLAsTmp(String sql, List<ChartViewFieldDTO> xAxis, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) {
return getSQL(" (" + sqlFix(sql) + ") AS tmp ", xAxis, yAxis, customFilter, extFilterRequestList);
return getSQL("(" + sqlFix(sql) + ")", xAxis, yAxis, customFilter, extFilterRequestList);
}
@Override
@ -282,84 +260,70 @@ public class MysqlQueryProvider extends QueryProvider {
@Override
public String getSQLSummary(String table, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) {
// 字段汇总 排序等
String[] field = yAxis.stream().map(y -> {
StringBuilder f = new StringBuilder();
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
f.append(y.getSummary()).append("(").append(y.getOriginName()).append(")");
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
f.append(y.getSummary()).append("(`").append(y.getOriginName()).append("`)");
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
f.append("CAST(")
.append(y.getSummary()).append("(")
.append("CAST(`").append(y.getOriginName()).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.getOriginName()).append("` AS ").append(y.getDeType() == 2 ? "DECIMAL(20,0)" : "DECIMAL(20,2)").append(")")
.append(")");
SQLObj tableObj = SQLObj.builder()
.tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MySQLConstants.KEYWORD_TABLE, table))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 0))
.build();
List<SQLObj> yFields = new ArrayList<>();
List<SQLObj> yWheres = new ArrayList<>();
List<SQLObj> yOrders = new ArrayList<>();
if (CollectionUtils.isNotEmpty(yAxis)) {
for (int i = 0; i < yAxis.size(); i++) {
ChartViewFieldDTO y = yAxis.get(i);
String originField = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), y.getOriginName());
String fieldAlias = String.format(SQLConstants.FIELD_ALIAS_Y_PREFIX, i);
// 处理纵轴字段
yFields.add(getYFields(y, originField, fieldAlias));
// 处理纵轴过滤
yWheres.addAll(getYWheres(y, originField, fieldAlias));
// 处理纵轴排序
if (StringUtils.isNotEmpty(y.getSort()) && !StringUtils.equalsIgnoreCase(y.getSort(), "none")) {
yOrders.add(SQLObj.builder()
.orderField(originField)
.orderAlias(fieldAlias)
.orderDirection(y.getSort())
.build());
}
}
f.append(" AS `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
return f.toString();
}).toArray(String[]::new);
String[] order = 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 sql = MessageFormat.format("SELECT {0} FROM {1} WHERE 1=1 {2} ORDER BY null,{3}",
StringUtils.join(field, ","),
table,
transCustomFilter(customFilter) + transExtFilter(extFilterRequestList),// origin field filter and panel field filter
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.getOriginName(), "*") ? "" : y.getOriginName()).append("`")
.append(" AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
} else {
filter.append(" AND `_").append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName()).append("`");
}
filter.append(transMysqlFilterTerm(f.getTerm()));
if (StringUtils.equalsIgnoreCase(f.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(f.getTerm(), "not_null")) {
filter.append(" AND `_")
.append(y.getSummary()).append("_").append(StringUtils.equalsIgnoreCase(y.getOriginName(), "*") ? "" : y.getOriginName())
.append("`").append(" <> ''");
} 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} ORDER BY {2}",
"(" + sql + ") AS tmp",
StringUtils.join(resultFilter, " "),
ObjectUtils.isNotEmpty(order) ? StringUtils.join(order, ",") : "null");
return filterSql;
}
// 处理视图中字段过滤
List<SQLObj> customWheres = transCustomFilterList(tableObj, customFilter);
// 处理仪表板字段过滤
List<SQLObj> extWheres = transExtFilterList(tableObj, extFilterRequestList);
// 构建sql所有参数
List<SQLObj> fields = new ArrayList<>();
fields.addAll(yFields);
List<SQLObj> wheres = new ArrayList<>();
if (customWheres != null) wheres.addAll(customWheres);
if (extWheres != null) wheres.addAll(extWheres);
List<SQLObj> groups = new ArrayList<>();
// 外层再次套sql
List<SQLObj> orders = new ArrayList<>();
orders.addAll(yOrders);
List<SQLObj> aggWheres = new ArrayList<>();
aggWheres.addAll(yWheres);
STGroup stg = new STGroupFile(SQLConstants.SQL_TEMPLATE);
ST st_sql = stg.getInstanceOf("querySql");
if (CollectionUtils.isNotEmpty(yFields)) st_sql.add("aggregators", yFields);
if (CollectionUtils.isNotEmpty(wheres)) st_sql.add("filters", wheres);
if (ObjectUtils.isNotEmpty(tableObj)) st_sql.add("table", tableObj);
String sql = st_sql.render();
ST st = stg.getInstanceOf("querySql");
SQLObj tableSQL = SQLObj.builder()
.tableName(String.format(MySQLConstants.BRACKETS, sql))
.tableAlias(String.format(TABLE_ALIAS_PREFIX, 1))
.build();
if (CollectionUtils.isNotEmpty(aggWheres)) st.add("filters", aggWheres);
if (CollectionUtils.isNotEmpty(orders)) st.add("orders", orders);
if (ObjectUtils.isNotEmpty(tableSQL)) st.add("table", tableSQL);
return st.render();
}
@Override
public String getSQLSummaryAsTmp(String sql, List<ChartViewFieldDTO> yAxis, List<ChartCustomFilterDTO> customFilter, List<ChartExtFilterRequest> extFilterRequestList) {
return getSQLSummary(" (" + sqlFix(sql) + ") AS tmp ", yAxis, customFilter, extFilterRequestList);
return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, customFilter, extFilterRequestList);
}
@Override
@ -416,7 +380,7 @@ public class MysqlQueryProvider extends QueryProvider {
case "null":
return " IN ";
case "not_null":
return " IS NOT NULL ";
return " NOT IN ";
case "between":
return " BETWEEN ";
default:
@ -424,77 +388,86 @@ public class MysqlQueryProvider extends QueryProvider {
}
}
public String transCustomFilter(List<ChartCustomFilterDTO> requestList) {
public List<SQLObj> transCustomFilterList(SQLObj tableObj, List<ChartCustomFilterDTO> requestList) {
if (CollectionUtils.isEmpty(requestList)) {
return "";
return null;
}
StringBuilder filter = new StringBuilder();
List<SQLObj> list = new ArrayList<>();
for (ChartCustomFilterDTO request : requestList) {
String value = request.getValue();
DatasetTableField field = request.getField();
if (ObjectUtils.isEmpty(field)) {
continue;
}
String value = request.getValue();
String whereName = "";
String whereTerm = transMysqlFilterTerm(request.getTerm());
String whereValue = "";
String originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
filter.append(" AND FROM_UNIXTIME(CAST(`")
.append(field.getOriginName())
.append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
} else {
filter.append(" AND `").append(field.getOriginName()).append("`");
whereName = originName;
}
filter.append(" ")
.append(transMysqlFilterTerm(request.getTerm()))
.append(" ");
if (StringUtils.equalsIgnoreCase(request.getTerm(), "null")) {
filter.append("(null,'')");
} else if (StringUtils.equalsIgnoreCase(request.getTerm(), "not_null")) {
filter.append(" AND `").append(field.getOriginName()).append("`").append(" <> ''");
if (StringUtils.containsIgnoreCase(request.getTerm(), "null")) {
whereValue = MySQLConstants.WHERE_VALUE_NULL;
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "in")) {
filter.append("('").append(StringUtils.join(value, "','")).append("')");
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getTerm(), "like")) {
filter.append("'%").append(value).append("%'");
whereValue = "'%" + value + "%'";
} else {
filter.append("'").append(value).append("'");
whereValue = String.format(MySQLConstants.WHERE_VALUE_VALUE, value);
}
list.add(SQLObj.builder()
.whereField(whereName)
.whereTermAndValue(whereTerm + whereValue)
.build());
}
return filter.toString();
return list;
}
public String transExtFilter(List<ChartExtFilterRequest> requestList) {
public List<SQLObj> transExtFilterList(SQLObj tableObj, List<ChartExtFilterRequest> requestList) {
if (CollectionUtils.isEmpty(requestList)) {
return "";
return null;
}
StringBuilder filter = new StringBuilder();
List<SQLObj> list = new ArrayList<>();
for (ChartExtFilterRequest request : requestList) {
List<String> value = request.getValue();
if (CollectionUtils.isEmpty(value)) {
DatasetTableField field = request.getDatasetTableField();
if (CollectionUtils.isEmpty(value) || ObjectUtils.isEmpty(field)) {
continue;
}
DatasetTableField field = request.getDatasetTableField();
String whereName = "";
String whereTerm = transMysqlFilterTerm(request.getOperator());
String whereValue = "";
String originName = String.format(MySQLConstants.KEYWORD_FIX, tableObj.getTableAlias(), field.getOriginName());
if (field.getDeType() == 1 && field.getDeExtractType() != 1) {
filter.append(" AND FROM_UNIXTIME(CAST(`")
.append(field.getOriginName())
.append("` AS DECIMAL(20,0))/1000,'%Y-%m-%d %H:%i:%S') ");
String cast = String.format(MySQLConstants.CAST, originName, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
} else {
filter.append(" AND `").append(field.getOriginName()).append("`");
whereName = originName;
}
filter.append(" ")
.append(transMysqlFilterTerm(request.getOperator()))
.append(" ");
if (StringUtils.containsIgnoreCase(request.getOperator(), "in")) {
filter.append("('").append(StringUtils.join(value, "','")).append("')");
whereValue = "('" + StringUtils.join(value, "','") + "')";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "like")) {
filter.append("'%").append(value.get(0)).append("%'");
whereValue = "'%" + value.get(0) + "%'";
} else if (StringUtils.containsIgnoreCase(request.getOperator(), "between")) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String startTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(0))));
String endTime = simpleDateFormat.format(new Date(Long.parseLong(value.get(1))));
filter.append("'").append(startTime).append("' AND '").append(endTime).append("'");
whereValue = String.format(MySQLConstants.WHERE_BETWEEN, startTime, endTime);
} else {
filter.append("'").append(value.get(0)).append("'");
whereValue = String.format(MySQLConstants.WHERE_VALUE_VALUE, value.get(0));
}
list.add(SQLObj.builder()
.whereField(whereName)
.whereTermAndValue(whereTerm + whereValue)
.build());
}
return filter.toString();
return list;
}
private String sqlFix(String sql) {
@ -529,4 +502,115 @@ public class MysqlQueryProvider extends QueryProvider {
return "%Y-%m-%d %H:%i:%S";
}
}
private SQLObj getXFields(ChartViewFieldDTO x, String originField, String fieldAlias) {
String fieldName = "";
if (x.getDeExtractType() == 1) {
if (x.getDeType() == 2 || x.getDeType() == 3) {
fieldName = String.format(MySQLConstants.UNIX_TIMESTAMP, originField) + "*1000";
} else if (x.getDeType() == 1) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, format);
} else {
fieldName = originField;
}
} else {
if (x.getDeType() == 1) {
String format = transDateFormat(x.getDateStyle(), x.getDatePattern());
if (x.getDeExtractType() == 0) {
fieldName = String.format(MySQLConstants.DATE_FORMAT, originField, format);
} else {
String cast = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
String from_unixtime = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
fieldName = String.format(MySQLConstants.DATE_FORMAT, from_unixtime, format);
}
} else {
fieldName = originField;
}
}
return SQLObj.builder()
.fieldName(fieldName)
.fieldAlias(fieldAlias)
.build();
}
private List<SQLObj> getXWheres(ChartViewFieldDTO x, String originField, String fieldAlias) {
List<SQLObj> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(x.getFilter()) && x.getFilter().size() > 0) {
x.getFilter().forEach(f -> {
String whereName = "";
String whereTerm = transMysqlFilterTerm(f.getTerm());
String whereValue = "";
if (x.getDeType() == 1 && x.getDeExtractType() != 1) {
String cast = String.format(MySQLConstants.CAST, originField, MySQLConstants.DEFAULT_INT_FORMAT) + "/1000";
whereName = String.format(MySQLConstants.FROM_UNIXTIME, cast, MySQLConstants.DEFAULT_DATE_FORMAT);
} else {
whereName = originField;
}
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
whereValue = MySQLConstants.WHERE_VALUE_NULL;
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
whereValue = "('" + StringUtils.join(f.getValue(), "','") + "')";
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
whereValue = "'%" + f.getValue() + "%'";
} else {
whereValue = String.format(MySQLConstants.WHERE_VALUE_VALUE, f.getValue());
}
list.add(SQLObj.builder()
.whereField(whereName)
.whereAlias(fieldAlias)
.whereTermAndValue(whereTerm + whereValue)
.build());
});
}
return list;
}
private SQLObj getYFields(ChartViewFieldDTO y, String originField, String fieldAlias) {
String fieldName = "";
if (StringUtils.equalsIgnoreCase(y.getOriginName(), "*")) {
fieldName = MySQLConstants.AGG_COUNT;
} else if (SQLConstants.DIMENSION_TYPE.contains(y.getDeType())) {
fieldName = String.format(MySQLConstants.AGG_FIELD, y.getSummary(), originField);
} else {
if (StringUtils.equalsIgnoreCase(y.getSummary(), "avg") || StringUtils.containsIgnoreCase(y.getSummary(), "pop")) {
String cast = String.format(MySQLConstants.CAST, originField, y.getDeType() == 2 ? MySQLConstants.DEFAULT_INT_FORMAT : MySQLConstants.DEFAULT_FLOAT_FORMAT);
String agg = String.format(MySQLConstants.AGG_FIELD, y.getSummary(), cast);
fieldName = String.format(MySQLConstants.CAST, agg, MySQLConstants.DEFAULT_FLOAT_FORMAT);
} else {
String cast = String.format(MySQLConstants.CAST, originField, y.getDeType() == 2 ? MySQLConstants.DEFAULT_INT_FORMAT : MySQLConstants.DEFAULT_FLOAT_FORMAT);
fieldName = String.format(MySQLConstants.AGG_FIELD, y.getSummary(), cast);
}
}
return SQLObj.builder()
.fieldName(fieldName)
.fieldAlias(fieldAlias)
.build();
}
private List<SQLObj> getYWheres(ChartViewFieldDTO y, String originField, String fieldAlias) {
List<SQLObj> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(y.getFilter()) && y.getFilter().size() > 0) {
y.getFilter().forEach(f -> {
String whereTerm = transMysqlFilterTerm(f.getTerm());
String whereValue = "";
// 原始类型不是时间在de中被转成时间的字段做处理
if (StringUtils.containsIgnoreCase(f.getTerm(), "null")) {
whereValue = MySQLConstants.WHERE_VALUE_NULL;
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) {
whereValue = "('" + StringUtils.join(f.getValue(), "','") + "')";
} else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) {
whereValue = "'%" + f.getValue() + "%'";
} else {
whereValue = String.format(MySQLConstants.WHERE_VALUE_VALUE, f.getValue());
}
list.add(SQLObj.builder()
.whereField(fieldAlias)
.whereAlias(fieldAlias)
.whereTermAndValue(whereTerm + whereValue)
.build());
});
}
return list;
}
}

View File

@ -25,7 +25,6 @@ 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.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.poi.hssf.usermodel.HSSFSheet;
@ -60,11 +59,9 @@ import org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassDef;
import org.pentaho.di.trans.steps.userdefinedjavaclass.UserDefinedJavaClassMeta;
import org.pentaho.di.www.SlaveServerJobStatus;
import org.quartz.JobExecutionContext;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
@ -403,6 +400,7 @@ public class ExtractDataService {
private void sendWebMsg(DatasetTable datasetTable, String taskId, Boolean status) {
String msg = status ? "成功" : "失败";
Long typeId = status ? 5L : 6L;
String id = datasetTable.getId();
AuthURD authURD = AuthUtils.authURDR(id);
Set<Long> userIds = AuthUtils.userIdsByURD(authURD);
@ -413,7 +411,7 @@ public class ExtractDataService {
if(StringUtils.isNotEmpty(taskId)){
param.put("taskId", taskId);
}
DeMsgutil.sendMsg(userId, 1, "数据集【"+datasetTable.getName()+"】同步"+msg, gson.toJson(param));
DeMsgutil.sendMsg(userId, typeId, 1L, "数据集【"+datasetTable.getName()+"】同步"+msg, gson.toJson(param));
});
}

View File

@ -1,24 +1,13 @@
package io.dataease.service.message;
import io.dataease.base.domain.SysMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;
@Component
public class DeMsgutil {
private static Map<Integer, String> routerMap ;
@PostConstruct
public void init() {
routerMap = new HashMap<>();
routerMap.put(0, "panel");
routerMap.put(1, "dataset");
}
private static SysMsgService sysMsgService;
@ -27,27 +16,18 @@ public class DeMsgutil {
DeMsgutil.sysMsgService = sysMsgService;
}
public static void sendMsg(Long userId, int type, String content) {
SysMsg sysMsg = new SysMsg();
sysMsg.setUserId(userId);
sysMsg.setType(type);
sysMsg.setContent(content);
sysMsg.setRouter(routerMap.get(type));
sysMsg.setStatus(false);
sysMsg.setCreateTime(System.currentTimeMillis());
sysMsgService.save(sysMsg);
public static void sendMsg(Long userId, Long typeId, Long channelId, String content, String param) {
// SysMsg sysMsg = new SysMsg();
// sysMsg.setUserId(userId);
// sysMsg.setTypeId(typeId);
// sysMsg.setContent(content);
// sysMsg.setStatus(false);
// sysMsg.setCreateTime(System.currentTimeMillis());
// sysMsg.setParam(param);
sysMsgService.sendMsg(userId, typeId, channelId, content, param);
}
public static void sendMsg(Long userId, int type, String content, String param) {
SysMsg sysMsg = new SysMsg();
sysMsg.setUserId(userId);
sysMsg.setType(type);
sysMsg.setContent(content);
sysMsg.setRouter(routerMap.get(type));
sysMsg.setStatus(false);
sysMsg.setCreateTime(System.currentTimeMillis());
sysMsg.setParam(param);
sysMsgService.save(sysMsg);
}
}

View File

@ -0,0 +1,60 @@
package io.dataease.service.message;
import io.dataease.controller.message.dto.SubscribeNode;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Aspect
@Component
public class MsgAop {
@Resource
private SysMsgService sysMsgService;
/**
* 对sendMsg 切面拦截
* @param point
*/
@Around("(execution(* io.dataease.service.message.SysMsgService.sendMsg(..)))")
public Object cutPoint(ProceedingJoinPoint point) {
Object[] args = point.getArgs();
Object arg0 = args[0];
Object arg1 = args[1];
Object arg2 = args[2];
if (ObjectUtils.isEmpty(arg0) || ObjectUtils.isEmpty(arg1) || ObjectUtils.isEmpty(arg2)) {
return null;
}
Long userId = (Long) arg0;
Long typeId = (Long) arg1;
Long channelId = (Long) arg2;
List<SubscribeNode> subscribes = sysMsgService.subscribes(userId);
try {
// 如果已经订阅了这种类型的消息 直接发送 否则直接返回
if (CollectionUtils.isNotEmpty(subscribes) && subscribes.stream().anyMatch(item -> item.match(typeId, channelId)))
return point.proceed(args);
return null;
} catch (Throwable throwable) {
throwable.printStackTrace();
}
return null;
}
}

View File

@ -1,16 +1,26 @@
package io.dataease.service.message;
import io.dataease.base.domain.SysMsg;
import io.dataease.base.domain.SysMsgExample;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.SysMsgChannelMapper;
import io.dataease.base.mapper.SysMsgMapper;
import io.dataease.base.mapper.SysMsgSettingMapper;
import io.dataease.base.mapper.SysMsgTypeMapper;
import io.dataease.base.mapper.ext.ExtSysMsgMapper;
import io.dataease.controller.message.dto.MsgRequest;
import io.dataease.commons.constants.SysMsgConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.CommonBeanFactory;
import io.dataease.controller.message.dto.*;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
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.stream.Collectors;
@Service
public class SysMsgService {
@ -21,6 +31,17 @@ public class SysMsgService {
@Resource
private ExtSysMsgMapper extSysMsgMapper;
@Resource
private SysMsgTypeMapper sysMsgTypeMapper;
@Resource
private SysMsgChannelMapper sysMsgChannelMapper;
@Resource
private SysMsgSettingMapper sysMsgSettingMapper;
public List<SysMsg> query(Long userId, MsgRequest msgRequest) {
String orderClause = " create_time desc";
SysMsgExample example = new SysMsgExample();
@ -34,7 +55,7 @@ public class SysMsgService {
}
if (ObjectUtils.isNotEmpty(msgRequest.getType())) {
criteria.andTypeEqualTo(msgRequest.getType());
criteria.andTypeIdEqualTo(msgRequest.getType());
}
if (ObjectUtils.isNotEmpty(msgRequest.getStatus())) {
@ -46,6 +67,36 @@ public class SysMsgService {
return sysMsgs;
}
public List<MsgGridDto> queryGrid(Long userId, MsgRequest msgRequest) {
String orderClause = " create_time desc";
SysMsgExample example = new SysMsgExample();
SysMsgExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
List<String> orders = msgRequest.getOrders();
if (CollectionUtils.isNotEmpty(orders)) {
orderClause = String.join(", ", orders);
}
if (ObjectUtils.isNotEmpty(msgRequest.getType())) {
SysMsgTypeExample sysMsgTypeExample = new SysMsgTypeExample();
sysMsgTypeExample.createCriteria().andPidEqualTo(msgRequest.getType());
List<SysMsgType> sysMsgTypes = sysMsgTypeMapper.selectByExample(sysMsgTypeExample);
List<Long> typeIds = sysMsgTypes.stream().map(SysMsgType::getMsgTypeId).collect(Collectors.toList());
criteria.andTypeIdIn(typeIds);
}
if (ObjectUtils.isNotEmpty(msgRequest.getStatus())) {
criteria.andStatusEqualTo(msgRequest.getStatus());
}
example.setOrderByClause(orderClause);
List<MsgGridDto> msgGridDtos = extSysMsgMapper.queryGrid(example);
return msgGridDtos;
}
public void setReaded(Long msgId) {
SysMsg sysMsg = new SysMsg();
sysMsg.setMsgId(msgId);
@ -67,4 +118,121 @@ public class SysMsgService {
}
public List<SettingTreeNode> treeNodes() {
SysMsgService proxy = CommonBeanFactory.getBean(SysMsgService.class);
List<SysMsgType> sysMsgTypes = proxy.queryMsgTypes();
return buildTree(sysMsgTypes);
}
@Cacheable(SysMsgConstants.SYS_MSG_TYPE)
public List<SysMsgType> queryMsgTypes() {
SysMsgTypeExample example = new SysMsgTypeExample();
List<SysMsgType> sysMsgTypes = sysMsgTypeMapper.selectByExample(example);
return sysMsgTypes;
}
private List<SettingTreeNode> buildTree(List<SysMsgType> lists){
List<SettingTreeNode> rootNodes = new ArrayList<>();
lists.forEach(node -> {
SettingTreeNode settingTreeNode = convert(node);
if (isParent(node)) {
rootNodes.add(settingTreeNode);
}
lists.forEach(tNode -> {
if (tNode.getPid() == settingTreeNode.getId()) {
if (settingTreeNode.getChildren() == null) {
settingTreeNode.setChildren(new ArrayList<SettingTreeNode>());
}
settingTreeNode.getChildren().add(convert(tNode));
}
});
});
return rootNodes;
}
private Boolean isParent(SysMsgType typeNode) {
return typeNode.getPid() == 0L;
}
public SettingTreeNode convert(SysMsgType typeNode) {
SettingTreeNode settingTreeNode = new SettingTreeNode();
settingTreeNode.setId(typeNode.getMsgTypeId());
settingTreeNode.setName(typeNode.getTypeName());
return settingTreeNode;
}
@Cacheable(SysMsgConstants.SYS_MSG_CHANNEL)
public List<SysMsgChannel> channelList() {
SysMsgChannelExample example = new SysMsgChannelExample();
return sysMsgChannelMapper.selectByExample(example);
}
public List<SysMsgSetting> settingList() {
Long userId = AuthUtils.getUser().getUserId();
SysMsgSettingExample example = new SysMsgSettingExample();
example.createCriteria().andUserIdEqualTo(userId);
List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example);
return sysMsgSettings;
}
/**
* 修改了订阅信息 需要清除缓存
* @param request
* @param userId
*/
@Transactional
@CacheEvict(value = SysMsgConstants.SYS_MSG_USER_SUBSCRIBE, key = "#userId")
public void updateSetting(MsgSettingRequest request, Long userId) {
Long typeId = request.getTypeId();
Long channelId = request.getChannelId();
// Long userId = AuthUtils.getUser().getUserId();
SysMsgSettingExample example = new SysMsgSettingExample();
example.createCriteria().andUserIdEqualTo(userId).andTypeIdEqualTo(typeId).andChannelIdEqualTo(channelId);
List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example);
if (CollectionUtils.isNotEmpty(sysMsgSettings)) {
sysMsgSettings.forEach(setting -> {
setting.setEnable(!setting.getEnable());
sysMsgSettingMapper.updateByPrimaryKeySelective(setting);
});
return;
}
SysMsgSetting sysMsgSetting = new SysMsgSetting();
sysMsgSetting.setEnable(true);
sysMsgSetting.setChannelId(channelId);
sysMsgSetting.setTypeId(typeId);
sysMsgSetting.setUserId(userId);
sysMsgSettingMapper.insert(sysMsgSetting);
}
public void sendMsg(Long userId, Long typeId, Long channelId, String content, String param) {
SysMsg sysMsg = new SysMsg();
sysMsg.setUserId(userId);
sysMsg.setTypeId(typeId);
sysMsg.setContent(content);
sysMsg.setStatus(false);
sysMsg.setCreateTime(System.currentTimeMillis());
sysMsg.setParam(param);
save(sysMsg);
}
/**
* 查询用户订阅的消息 并缓存
* @param userId
* @return
*/
@Cacheable(value = SysMsgConstants.SYS_MSG_USER_SUBSCRIBE, key = "#userId")
public List<SubscribeNode> subscribes(Long userId) {
SysMsgSettingExample example = new SysMsgSettingExample();
example.createCriteria().andUserIdEqualTo(userId).andEnableEqualTo(true);
List<SysMsgSetting> sysMsgSettings = sysMsgSettingMapper.selectByExample(example);
List<SubscribeNode> resultLists = sysMsgSettings.stream().map(item -> {
SubscribeNode subscribeNode = new SubscribeNode();
subscribeNode.setTypeId(item.getTypeId());
subscribeNode.setChannelId(item.getChannelId());
return subscribeNode;
}).collect(Collectors.toList());
return resultLists;
}
}

View File

@ -133,14 +133,14 @@ public class ShareService {
List<String> msgParam = new ArrayList<String>();
msgParam.add(panelGroupId);
addUserIdSet.forEach(userId -> {
if (!redUserIdSet.contains(userId)){
DeMsgutil.sendMsg(userId, 0, user.getNickName()+" 分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
if (!redUserIdSet.contains(userId) && user.getUserId() != userId){
DeMsgutil.sendMsg(userId, 2L, 1L,user.getNickName()+" 分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
}
});
redUserIdSet.forEach(userId -> {
if (!addUserIdSet.contains(userId)){
DeMsgutil.sendMsg(userId, 0, user.getNickName()+" 取消分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
if (!addUserIdSet.contains(userId) && user.getUserId() != userId){
DeMsgutil.sendMsg(userId, 3L, 1L,user.getNickName()+" 取消分享了仪表板【"+msg+"】,请查收!", gson.toJson(msgParam));
}
});
@ -263,7 +263,7 @@ public class ShareService {
Gson gson = new Gson();
userIdSet.forEach(userId -> {
// DeMsgutil.sendMsg(userId, 0, user.getNickName()+" 分享了仪表板【"+msg+"】给您,请查收!");
DeMsgutil.sendMsg(userId, 0, user.getNickName()+" 分享了仪表板【"+msg+"】给您,请查收!", gson.toJson(panelIds));
DeMsgutil.sendMsg(userId, 2L,1L, user.getNickName()+" 分享了仪表板【"+msg+"】给您,请查收!", gson.toJson(panelIds));
});
}

View File

@ -5,24 +5,81 @@ DROP TABLE IF EXISTS `sys_msg`;
CREATE TABLE `sys_msg` (
`msg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '消息主键',
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
`type` int(4) NOT NULL COMMENT '类型',
`type_id` bigint(20) NOT NULL COMMENT '类型',
`status` tinyint(1) NOT NULL COMMENT '状态',
`router` varchar(255) DEFAULT NULL COMMENT '跳转路由',
`param` varchar(255) DEFAULT NULL COMMENT '路由参数',
`create_time` bigint(13) NOT NULL COMMENT '发送时间',
`read_time` bigint(13) DEFAULT NULL COMMENT '读取时间',
`content` varchar(255) DEFAULT NULL COMMENT '消息内容',
PRIMARY KEY (`msg_id`) USING BTREE,
KEY `inx_msg_userid` (`user_id`) USING BTREE,
KEY `inx_msg_type` (`type`) USING BTREE,
KEY `inx_msg_type` (`type_id`) USING BTREE,
KEY `inx_msg_status` (`status`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 COMMENT='消息通知表';
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='消息通知表';
-- ----------------------------
-- Table structure for sys_msg_channel
-- ----------------------------
DROP TABLE IF EXISTS `sys_msg_channel`;
CREATE TABLE `sys_msg_channel` (
`msg_channel_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`channel_name` varchar(255) DEFAULT NULL COMMENT '渠道名称',
PRIMARY KEY (`msg_channel_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='消息渠道表';
-- ----------------------------
-- Records of sys_msg_channel
-- ----------------------------
BEGIN;
INSERT INTO `sys_msg_channel` VALUES (1, 'webmsg.channel_inner_msg');
COMMIT;
-- ----------------------------
-- Table structure for sys_msg_type
-- ----------------------------
DROP TABLE IF EXISTS `sys_msg_type`;
CREATE TABLE `sys_msg_type` (
`msg_type_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`pid` bigint(20) NOT NULL COMMENT '父类ID',
`type_name` varchar(255) DEFAULT NULL COMMENT '类型名称',
`router` varchar(255) DEFAULT NULL COMMENT '跳转路由',
`callback` varchar(255) DEFAULT NULL COMMENT '回调方法',
PRIMARY KEY (`msg_type_id`) USING BTREE,
KEY `inx_msgtype_pid` (`pid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8 COMMENT='消息类型表';
-- ----------------------------
-- Records of sys_msg_type
-- ----------------------------
BEGIN;
INSERT INTO `sys_msg_type` VALUES (1, 0, 'i18n_msg_type_panel_share', 'panel', 'to-msg-share');
INSERT INTO `sys_msg_type` VALUES (2, 1, 'i18n_msg_type_panel_share', 'panel', 'to-msg-share');
INSERT INTO `sys_msg_type` VALUES (3, 1, 'i18n_msg_type_panel_share_cacnel', 'panel', 'to-msg-share');
INSERT INTO `sys_msg_type` VALUES (4, 0, 'i18n_msg_type_dataset_sync', 'dataset', 'to-msg-dataset');
INSERT INTO `sys_msg_type` VALUES (5, 4, 'i18n_msg_type_dataset_sync_success', 'dataset', 'to-msg-dataset');
INSERT INTO `sys_msg_type` VALUES (6, 4, 'i18n_msg_type_dataset_sync_faild', 'dataset', 'to-msg-dataset');
COMMIT;
-- ----------------------------
-- Table structure for sys_msg_setting
-- ----------------------------
DROP TABLE IF EXISTS `sys_msg_setting`;
CREATE TABLE `sys_msg_setting` (
`msg_setting_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
`type_id` bigint(20) NOT NULL COMMENT '类型ID',
`channel_id` bigint(20) NOT NULL COMMENT '渠道ID',
`enable` tinyint(1) DEFAULT NULL COMMENT '是否启用',
PRIMARY KEY (`msg_setting_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='消息设置表';
BEGIN;
INSERT INTO `sys_menu` VALUES (53, 1, 3, 1, '站内消息', 'sys-msg-web', 'msg/index', 1000, 'all-msg', 'system-msg-web', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (54, 53, 0, 1, '所有消息', 'sys-msg-web-all', 'msg/all', 1, 'web-msg', 'all', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (55, 53, 0, 1, '未读消息', 'sys-msg-web-unread', 'msg/unread', 2, 'unread-msg', 'unread', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (56, 53, 0, 1, '已读消息', 'sys-msg-web-readed', 'msg/readed', 3, 'readed-msg', 'readed', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
INSERT INTO `sys_menu` VALUES (59, 53, 0, 1, '接收管理', 'sys-msg-setting', 'msg/setting', 4, 'msg-setting', 'setting', b'0', b'0', b'0', NULL, NULL, NULL, NULL, NULL);
COMMIT;
BEGIN;

View File

@ -95,4 +95,38 @@
/>
<!--消息渠道缓存-->
<cache
name="sys_msg_channel"
eternal="true"
maxElementsInMemory="100"
maxElementsOnDisk="1000"
overflowToDisk="true"
diskPersistent="false"
/>
<!--消息类型缓存-->
<cache
name="sys_msg_type"
eternal="true"
maxElementsInMemory="100"
maxElementsOnDisk="1000"
overflowToDisk="true"
diskPersistent="false"
/>
<!--消息类型缓存-->
<cache
name="sys_msg_user_subscribe"
eternal="false"
maxElementsInMemory="100"
maxElementsOnDisk="10000"
overflowToDisk="true"
diskPersistent="false"
timeToIdleSeconds="28800"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU"
/>
</ehcache>

View File

@ -266,4 +266,10 @@ i18n_schema_is_empty=Database schema is empty
所有消息=All Messages
未读消息=Unread Messages
已读消息=Read Messages
接收管理=Receive Manage
i18n_msg_type_panel_share=Dashboard sharing
i18n_msg_type_panel_share_cacnel=Dashboard unshared
i18n_msg_type_dataset_sync=Data set synchronization
i18n_msg_type_dataset_sync_success=Dataset synchronization successful
i18n_msg_type_dataset_sync_faild=Dataset synchronization failed
i18n_data_not_sync=Please sync data first

View File

@ -265,4 +265,10 @@ i18n_schema_is_empty=数据库 Schema 为空
所有消息=所有消息
未读消息=未读消息
已读消息=已读消息
接收管理=接收管理
i18n_msg_type_panel_share=仪表板分享
i18n_msg_type_panel_share_cacnel=仪表板取消分享
i18n_msg_type_dataset_sync=数据集同步
i18n_msg_type_dataset_sync_success=数据集同步成功
i18n_msg_type_dataset_sync_faild=数据集同步失败
i18n_data_not_sync=请先完成数据同步

View File

@ -268,4 +268,10 @@ i18n_schema_is_empty=數據庫 Schema 為空
所有消息=所有消息
未读消息=未讀消息
已读消息=已讀消息
接收管理=接收管理
i18n_msg_type_panel_share=儀表板分享
i18n_msg_type_panel_share_cacnel=儀表板取消分享
i18n_msg_type_dataset_sync=數據集同步
i18n_msg_type_dataset_sync_success=數據集同步成功
i18n_msg_type_dataset_sync_faild=數據集同步失敗
i18n_data_not_sync=請先完成數據同步

View File

@ -0,0 +1,28 @@
querySql(groups, aggregators, filters, orders, table)
::=<<
SELECT
<if(!groups && !aggregators)>
*
<endif>
<if(groups)>
<groups:{group|<if(group)><group.fieldName> AS <group.fieldAlias><endif>}; separator=",\n">
<endif>
<if(groups && aggregators)>,<endif>
<if(aggregators)>
<aggregators:{agg|<if(agg)><agg.fieldName> AS <agg.fieldAlias><endif>}; separator=",\n">
<endif>
FROM
<table.tableName> AS <table.tableAlias>
<if(filters)>
WHERE
<filters:{filter|<if(filter)><filter.whereField> <filter.whereTermAndValue><endif>}; separator="\nAND ">
<endif>
<if(groups)>
GROUP BY
<groups:{group|<if(group)><group.fieldName><endif>}; separator=",\n">
<endif>
<if(orders)>
ORDER BY
<orders:{order|<if(order)><order.orderAlias> <order.orderDirection><endif>}; separator=",\n">
<endif>
>>

View File

@ -26,3 +26,44 @@ export function batchRead(data) {
})
}
export function treeList() {
return request({
url: '/api/sys_msg/treeNodes',
method: 'post',
loading: true
})
}
export function channelList() {
return request({
url: '/api/sys_msg/channelList',
method: 'post',
loading: true
})
}
export function settingList() {
return request({
url: '/api/sys_msg/settingList',
method: 'post',
loading: true
})
}
export function updateSetting(data) {
return request({
url: '/api/sys_msg/updateSetting',
method: 'post',
loading: true,
data
})
}
export function allTypes(data) {
return request({
url: '/api/sys_msg/types',
method: 'post',
loading: true
})
}

View File

@ -31,7 +31,7 @@
<div class="start-item">
<div class="filter-db-row star-item-content" @click="showDetail(scope.row)">
<!-- <svg-icon icon-class="panel" class="ds-icon-scene" /> -->
<div class="title-div"><span>{{ $t(getTypeName(scope.row.type)) }}&nbsp;&nbsp;{{ scope.row.content }}</span></div>
<div class="title-div"><span>{{ getTypeName(scope.row.typeId) }}&nbsp;&nbsp;{{ scope.row.content }}</span></div>
<div class="title-div"><span>{{ scope.row.createTime | timestampFormatDate }}</span></div>
</div>
<!-- <div class="star-item-close">
@ -61,13 +61,12 @@
<script>
import { query, updateStatus } from '@/api/system/msg'
import { msgTypes, getTypeName } from '@/utils/webMsg'
import { getTypeName, loadMsgTypes } from '@/utils/webMsg'
import { mapGetters } from 'vuex'
import bus from '@/utils/bus'
export default {
data() {
return {
msgTypes: msgTypes,
showSetting: false,
data: [],
visible: false,
@ -85,6 +84,8 @@ export default {
])
},
created() {
//
loadMsgTypes()
this.search()
// 30s
this.timer = setInterval(() => {
@ -107,12 +108,18 @@ export default {
// console.log(lang)
// },
showDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.visible = false
if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) {
bus.$emit('to-msg-share', param)
} else if (this.$route && this.$route.name && this.$route.name.includes('dataset') && row.type === 1) {
bus.$emit('to-msg-dataset', param)
// if (this.$route && this.$route.name && this.$route.name.includes('panel') && row.type === 0) {
// bus.$emit('to-msg-share', param)
// } else if (this.$route && this.$route.name && this.$route.name.includes('dataset') && row.type === 1) {
// bus.$emit('to-msg-dataset', param)
// } else {
// this.$router.push({ name: row.router, params: param })
// }
if (this.$route && this.$route.name && this.$route.name === row.router) {
// 使router.push 使
row.callback && bus.$emit(row.callback, param)
} else {
this.$router.push({ name: row.router, params: param })
}
@ -155,7 +162,7 @@ export default {
})
},
getTypeName(value) {
return getTypeName(value)
return this.$t('webmsg.' + getTypeName(value))
},
open() {
this.visible = true

View File

@ -20,7 +20,7 @@
<span style="position: absolute;right: 70px;top:15px">
<el-button size="mini" @click="exportExcel">
<svg-icon icon-class="ds-excel" class="ds-icon-excel" />
{{$t('chart.export_details')}}
{{ $t('chart.export_details') }}
</el-button>
</span>
<UserViewDialog ref="userViewDialog" :chart="showChartInfo" :chart-table="showChartTableInfo" />

View File

@ -100,7 +100,7 @@
:destroy-on-close="true"
>
<span style="position: absolute;right: 70px;top:15px">
<el-button class="el-icon-download" size="mini" @click="exportExcel">
<el-button size="mini" @click="exportExcel">
<svg-icon icon-class="ds-excel" class="ds-icon-excel" />
{{ $t('chart.export_details') }}
</el-button>

View File

@ -43,7 +43,7 @@ export default {
debugger
const excelHeader = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.name)
const excelHeaderKeys = JSON.parse(JSON.stringify(this.chart.data.fields)).map(item => item.dataeaseName)
const excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => excelHeaderKeys.map(i => item[i] || ''))
const excelData = JSON.parse(JSON.stringify(this.chart.data.tableRow)).map(item => excelHeaderKeys.map(i => item[i]))
const excelName = this.chart.name
export_json_to_excel(excelHeader, excelData, excelName)
}

View File

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1625803255741" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2522" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M692.8 557.8c-49.3 0-89.4 40-89.4 89.1s40.1 89.1 89.4 89.1c49.3 0 89.4-40 89.4-89.1 0-49.2-40-89.1-89.4-89.1zM693 681c-18.2-0.8-32.6-15.9-32.6-34.1 0-18.3 14.4-33.3 32.6-34.1 18.5 0.5 33.2 15.6 33.2 34.1S711.5 680.5 693 681z" p-id="2523"></path><path d="M955.1 593.9c-2.9-15.2-12.1-24.9-23.3-24.7h-2.3c-38.5 0-69.9-31-69.9-69.1 0-12.5 6-26.3 6.1-26.4 5.9-13.6 1.4-29.3-10.7-37.8l-0.7-0.5-67.3-36.8-0.7-0.3c-13-5.3-28-2.3-38.1 7.5-8.2 8.4-34 30.1-54.9 30.1-21.1 0-47.2-22.1-55.4-30.7-10-9.9-24.9-13-38.1-7.8l-0.7 0.3-69.6 37.8-0.7 0.5c-12.1 8.4-16.6 24.2-10.7 37.8 0.1 0.1 6.1 13.9 6.1 26.4 0 38.1-31.3 69.1-69.9 69.1H452c-11.2-0.2-20.4 9.5-23.3 24.7-0.2 1.1-5.6 29.6-5.6 52.1 0 22.4 5.4 50.8 5.6 52.1 2.8 15 11.9 24.7 22.9 24.7l0.4-0.1h2.3c38.5 0 69.9 31 69.9 69.1 0 12.5-6 26.3-6.1 26.4-5.9 13.6-1.4 29.3 10.6 37.8l0.6 0.5 66 36.4 0.7 0.3c13.1 5.4 28.3 2.3 38.2-7.9 7.8-8.4 34.6-32.1 56.2-32.1 21.7 0 48.2 23.5 56.6 32.6 6.6 6.9 15.8 10.8 25.4 10.7 4.3 0.1 8.7-0.8 12.7-2.5l0.7-0.3 68.4-37.4 0.7-0.5c12-8.5 16.5-24.3 10.7-37.8-0.1-0.1-6.1-13.9-6.1-26.4 0-38.1 31.3-69.1 69.9-69.1h2.3c11.2 0.3 20.4-9.5 23.3-24.6 0.2-1.1 5.6-29.6 5.6-52.1 0.1-22.3-5.2-50.4-5.5-52z m-62.2 92.2c-46.1 2.3-82.9 40-82.9 86 0 15.4 6.1 30.1 7.4 33.1l-55 29.9h-0.1c-0.6 0-1.3-0.2-1.8-0.5-1-1.1-9-9.4-20.5-17.9-17.1-12.6-33.4-18.9-48.4-18.9-14.8 0-31 6.2-48 18.5-11.4 8.2-19.3 16.5-20.3 17.6-0.5 0.3-1.1 0.4-1.7 0.4h-0.1l-53-29.2c1.3-3 7.4-17.8 7.4-33.2 0-45.9-36.8-83.6-82.9-86-0.7-3.6-4.3-23.8-4.3-39.1 0-15.2 3.6-35.5 4.3-39.1 46.1-2.4 82.9-40 82.9-86 0-15.3-6-30.1-7.4-33.1l56.1-30.3h0.2c0.7 0 1.4 0.2 2.1 0.5 6.2 6.2 12.9 11.8 20.1 16.9 16.8 11.8 32.7 17.7 47.3 17.7 14.4 0 30.2-5.9 46.8-17.4 7.2-5 13.9-10.5 20-16.6 0.6-0.4 1.3-0.5 2.1-0.5h0.2l54.1 29.6c-1.3 3.1-7.4 17.8-7.4 33.2 0 45.9 36.8 83.6 82.9 86 0.7 3.6 4.3 23.9 4.3 39.1s-3.8 35.7-4.4 39.3z" p-id="2524"></path><path d="M426 831.2H198.1c-30.8 0-67.3-35.9-67.3-66V348.6l248.4 168.9v-80.1L130.8 268.5v-30c0-30 14.3-43.9 44.9-43.9h672.5c30.6 0 44.6 13.9 44.6 43.9v9.5h0.2v111.5c0 18.4 15.1 33.5 33.5 33.5s33.5-15.1 33.5-33.5V248v-2.5-7.1c0-66.6-43.7-109.7-111.8-109.7H175.7c-68.1 0-112.1 43-112.1 109.7v526.8c0 66.5 66.6 131.8 134.5 131.8H426c18.1 0 32.9-14.8 32.9-32.9 0-18.1-14.8-32.9-32.9-32.9z" p-id="2525"></path></svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -1242,9 +1242,17 @@ export default {
content: 'Content',
sned_time: 'Send Time',
read_time: 'Read Time',
type: 'Type',
type: 'Message Type',
mark_readed: 'Mark As Read',
please_select: 'Please select at least one message',
mark_success: 'Mark read successfully'
mark_success: 'Mark read successfully',
receive_manage: 'Receive Manage',
i18n_msg_type_panel_share: 'Dashboard sharing',
i18n_msg_type_panel_share_cacnel: 'Dashboard unshared',
i18n_msg_type_dataset_sync: 'Data set synchronization',
i18n_msg_type_dataset_sync_success: 'Dataset synchronization successful',
i18n_msg_type_dataset_sync_faild: 'Dataset synchronization failed',
i18n_msg_type_all: 'All type',
channel_inner_msg: 'On site news'
}
}

View File

@ -1242,9 +1242,17 @@ export default {
content: '消息內容',
sned_time: '提交時間',
read_time: '查看時間',
type: '類型',
type: '消息類型',
mark_readed: '標記已讀',
please_select: '請至少選擇一條消息',
mark_success: '標記已讀成功'
mark_success: '標記已讀成功',
receive_manage: '接收管理',
i18n_msg_type_panel_share: '儀表板分享',
i18n_msg_type_panel_share_cacnel: '儀表板取消分享',
i18n_msg_type_dataset_sync: '數據集同步',
i18n_msg_type_dataset_sync_success: '數據集同步成功',
i18n_msg_type_dataset_sync_faild: '數據集同步失敗',
i18n_msg_type_all: '全部類型',
channel_inner_msg: '站內消息'
}
}

View File

@ -1244,9 +1244,17 @@ export default {
content: '消息内容',
sned_time: '提交时间',
read_time: '查看时间',
type: '类型',
type: '消息类型',
mark_readed: '标记已读',
please_select: '请至少选择一条消息',
mark_success: '标记已读成功'
mark_success: '标记已读成功',
receive_manage: '接收管理',
i18n_msg_type_panel_share: '仪表板分享',
i18n_msg_type_panel_share_cacnel: '仪表板取消分享',
i18n_msg_type_dataset_sync: '数据集同步',
i18n_msg_type_dataset_sync_success: '数据集同步成功',
i18n_msg_type_dataset_sync_faild: '数据集同步失败',
i18n_msg_type_all: '全部类型',
channel_inner_msg: '站内消息'
}
}

View File

@ -25,6 +25,7 @@ const getters = {
validate: state => state.lic.validate,
licMsg: state => state.lic.licMsg,
uiInfo: state => state.user.uiInfo,
conditions: state => state.conditions.conditions
conditions: state => state.conditions.conditions,
msgTypes: state => state.msg.msgTypes
}
export default getters

View File

@ -11,6 +11,7 @@ import request from './modules/request'
import panel from './modules/panel'
import application from './modules/application'
import lic from './modules/lic'
import msg from './modules/msg'
import animation from '@/components/canvas/store/animation'
import compose from '@/components/canvas/store/compose'
import contextmenu from '@/components/canvas/store/contextmenu'
@ -182,7 +183,8 @@ const data = {
request,
panel,
application,
lic
lic,
msg
},
getters
}

View File

@ -0,0 +1,25 @@
const state = {
msgTypes: []
}
const mutations = {
SET_MSG_TYPES: (state, value) => {
state.msgTypes = value
}
}
const actions = {
setMsgTypes({ commit }, data) {
commit('SET_MSG_TYPES', data)
}
}
export default {
namespaced: true,
state,
mutations,
actions
}

View File

@ -1,14 +1,24 @@
export const msgTypes = [
{ value: -1, label: 'webmsg.all_type' },
{ value: 0, label: 'webmsg.panel_type' },
{ value: 1, label: 'webmsg.dataset_type' }
]
import { allTypes } from '@/api/system/msg'
import store from '@/store'
export const loadMsgTypes = value => {
let msgTypes = store.getters.msgTypes
if (!msgTypes || Object.keys(msgTypes).length === 0) {
allTypes().then(res => {
msgTypes = res.data
const defaultType = { msgTypeId: -1, pid: 0, typeName: 'i18n_msg_type_all' }
msgTypes.splice(0, 0, defaultType)
store.dispatch('msg/setMsgTypes', msgTypes)
})
}
}
export const getTypeName = value => {
const msgTypes = store.getters.msgTypes
for (let index = 0; index < msgTypes.length; index++) {
const element = msgTypes[index]
if (element.value === value) {
return element.label
if (element.msgTypeId === value) {
return element.typeName
}
}
}

View File

@ -99,15 +99,16 @@ export default {
toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) {
//
if (routerParam.msgType === 1) { //
const panelShareTypeIds = [4, 5, 6]
//
if (panelShareTypeIds.includes(routerParam.msgType)) { //
if (routerParam.sourceParam) {
try {
const msgParam = JSON.parse(routerParam.sourceParam)
this.param = msgParam.tableId
this.component = ViewTable
this.$nextTick(() => {
this.$refs.dynamic_component.msg2Current(routerParam.sourceParam)
this.$refs.dynamic_component && this.$refs.dynamic_component.msg2Current && this.$refs.dynamic_component.msg2Current(routerParam.sourceParam)
})
} catch (error) {
console.error(error)

View File

@ -2,7 +2,7 @@
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
<el-radio-button v-for="(item,index) in msgTypes" :key="index" class="de-msg-radio-class" :label="item.value">{{ $t(item.label) }}</el-radio-button>
<el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t('webmsg.' + item.typeName) }}</el-radio-button>
</el-radio-group>
<complex-table
@ -36,9 +36,9 @@
</template>
</el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
<template slot-scope="scope">
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
<span>{{ getTypeName(scope.row.typeId) }}</span>
</template>
</el-table-column>
@ -52,7 +52,7 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query, updateStatus } from '@/api/system/msg'
import { msgTypes, getTypeName } from '@/utils/webMsg'
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
import bus from '@/utils/bus'
import { addOrder, formatOrders } from '@/utils/index'
export default {
@ -85,6 +85,10 @@ export default {
mounted() {
this.search()
},
created() {
//
loadMsgTypes()
},
methods: {
select(selection) {
},
@ -109,13 +113,13 @@ export default {
})
},
getTypeName(value) {
return getTypeName(value)
return this.$t('webmsg.' + getTypeName(value))
},
typeChange(value) {
this.search()
},
toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param })
row.status || this.setReaded(row)
},

View File

@ -2,7 +2,7 @@
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
<el-radio-button v-for="(item,index) in msgTypes" :key="index" class="de-msg-radio-class" :label="item.value">{{ $t(item.label) }}</el-radio-button>
<el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t('webmsg.' + item.typeName) }}</el-radio-button>
</el-radio-group>
<complex-table
@ -42,9 +42,9 @@
</template>
</el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
<template slot-scope="scope">
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
<span>{{ getTypeName(scope.row.typeId) }}</span>
</template>
</el-table-column>
@ -58,7 +58,7 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query } from '@/api/system/msg'
import { msgTypes, getTypeName } from '@/utils/webMsg'
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
import { addOrder, formatOrders } from '@/utils/index'
export default {
components: {
@ -90,6 +90,10 @@ export default {
mounted() {
this.search()
},
created() {
//
loadMsgTypes()
},
methods: {
select(selection) {
},
@ -114,13 +118,13 @@ export default {
})
},
getTypeName(value) {
return getTypeName(value)
return this.$t('webmsg.' + getTypeName(value))
},
typeChange(value) {
this.search()
},
toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param })
},
sortChange({ column, prop, order }) {

View File

@ -0,0 +1,161 @@
<template xmlns:el-col="http://www.w3.org/1999/html">
<layout-content :header="$t('webmsg.receive_manage')">
<el-col>
<el-row class="tree-head">
<span style="float: left;padding-left: 10px">{{ $t('webmsg.type') }}</span>
<span v-for="channel in msg_channels" :key="channel.msgChannelId" class="auth-span">
{{ $t(channel.channelName) }}
</span>
</el-row>
<el-row style="margin-top: 5px">
<el-tree
:props="defaultProps"
:data="treeData"
default-expand-all
:node-key="defaultProps.id"
:highlight-current="highlightCurrent"
@node-click="nodeClick"
>
<span slot-scope="{ node, data }" class="custom-tree-node">
<span>
<span style="margin-left: 6px">{{ $t('webmsg.' + data.name) }}</span>
</span>
<span @click.stop>
<!-- <div v-if="setting_data[data.id]">
<span v-for="channel in setting_data[data.id]" :key="channel.channelId" class="auth-span">
<a href="javascript:;" @click="clickAuth(data.id,channel)">
<svg-icon style="width: 25px;height: 25px" :icon-class="channel.enable ? 'lock_open' : 'lock_closed'" />
</a>
</span>
</div> -->
<div>
<span v-for="channel in msg_channels" :key="channel.msgChannelId" class="auth-span">
<a href="javascript:;" @click="clickAuth(node,channel)">
<svg-icon style="width: 25px;height: 25px" :icon-class="checkBoxStatus(node, channel)?'lock_open':'lock_closed'" />
</a>
</span>
</div></span>
</span>
</el-tree>
</el-row>
</el-col>
</layout-content>
</template>
<script>
import LayoutContent from '@/components/business/LayoutContent'
import { treeList, channelList, settingList, updateSetting } from '@/api/system/msg'
export default {
name: 'LazyTree',
components: { LayoutContent },
data() {
return {
treeData: [],
defaultProps: {
children: 'children',
label: 'name',
id: 'id'
},
highlightCurrent: true,
msg_channels: [],
setting_data: {}
}
},
computed: {
},
mounted() {
},
created() {
this.loadChannelData()
this.loadSettingData(this.loadTreeData)
},
methods: {
//
loadTreeData() {
treeList().then(res => {
this.treeData = res.data
})
},
//
loadChannelData() {
channelList().then(res => {
this.msg_channels = res.data
})
},
//
loadSettingData(callBack) {
// this.setting_data = {}
const temp_setting_data = {}
settingList().then(res => {
const lists = res.data
lists.forEach(item => {
const key = item.typeId
if (!Object.keys(temp_setting_data).includes(key)) {
temp_setting_data[key] = []
}
temp_setting_data[key].push(item)
})
this.setting_data = temp_setting_data
callBack && callBack()
})
},
checkBoxStatus(node, channel) {
const nodeId = node.data.id
return this.setting_data[nodeId] && this.setting_data[nodeId].some(item => item.channelId === channel.msgChannelId && item.enable)
},
clickAuth(node, channel) {
// const status = this.checkBoxStatus(nodeId, channel)
const param = {
typeId: node.data.id,
channelId: channel.msgChannelId
}
updateSetting(param).then(res => {
this.loadSettingData()
// node.checked = true
})
},
nodeClick(data, node) {
console.log(data)
}
}
}
</script>
<style scoped>
.custom-tree-node {
flex: 1;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
padding-left: 8px;
}
.tree-main{
height: calc(100vh - 210px);
border: 1px solid #e6e6e6;
overflow-y: auto;
}
.tree-head{
height: 30px;
line-height: 30px;
border-bottom: 1px solid #e6e6e6;
background-color: #f7f8fa;
font-size: 12px;
color: #3d4d66 ;
}
.auth-span{
float: right;
width:50px;
margin-right: 30px
}
.highlights-text {
color: #faaa39 !important;
}
</style>

View File

@ -2,7 +2,7 @@
<layout-content v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-radio-group v-model="selectType" style="margin-bottom: 15px;" @change="typeChange">
<el-radio-button v-for="(item,index) in msgTypes" :key="index" class="de-msg-radio-class" :label="item.value">{{ $t(item.label) }}</el-radio-button>
<el-radio-button v-for="(item,index) in $store.getters.msgTypes.filter(type => type.pid <= 0)" :key="index" class="de-msg-radio-class" :label="item.msgTypeId">{{ $t('webmsg.' + item.typeName) }}</el-radio-button>
</el-radio-group>
<complex-table
@ -45,9 +45,9 @@
</template>
</el-table-column>
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="120">
<el-table-column prop="type" sortable="custom" :label="$t('webmsg.type')" width="140">
<template slot-scope="scope">
<span>{{ $t(getTypeName(scope.row.type)) }}</span>
<span>{{ getTypeName(scope.row.typeId) }}</span>
</template>
</el-table-column>
@ -61,7 +61,7 @@
import LayoutContent from '@/components/business/LayoutContent'
import ComplexTable from '@/components/business/complex-table'
import { query, updateStatus, batchRead } from '@/api/system/msg'
import { msgTypes, getTypeName } from '@/utils/webMsg'
import { msgTypes, getTypeName, loadMsgTypes } from '@/utils/webMsg'
import bus from '@/utils/bus'
import { addOrder, formatOrders } from '@/utils/index'
@ -100,6 +100,10 @@ export default {
mounted() {
this.search()
},
created() {
//
loadMsgTypes()
},
methods: {
select(selection) {
},
@ -124,13 +128,13 @@ export default {
})
},
getTypeName(value) {
return getTypeName(value)
return this.$t('webmsg.' + getTypeName(value))
},
typeChange(value) {
this.search()
},
toDetail(row) {
const param = { ...{ msgNotification: true, msgType: row.type, sourceParam: row.param }}
const param = { ...{ msgNotification: true, msgType: row.typeId, sourceParam: row.param }}
this.$router.push({ name: row.router, params: param })
this.setReaded(row)
},

View File

@ -75,11 +75,12 @@ export default {
methods: {
toMsgShare(routerParam) {
if (routerParam !== null && routerParam.msgNotification) {
//
if (routerParam.msgType === 0) { //
const panelShareTypeIds = [1, 2, 3]
//
if (panelShareTypeIds.includes(routerParam.msgType)) { //
this.componentName = 'PanelMain'
this.$nextTick(() => {
this.$refs.panel_main.msg2Current(routerParam.sourceParam)
this.$refs.panel_main && this.$refs.panel_main.msg2Current && this.$refs.panel_main.msg2Current(routerParam.sourceParam)
})
}
}