iterator = params.iterator();
+ while (iterator.hasNext()) {
+ sb.append("'" + iterator.next() + "',");
+ }
+ String string = sb.toString();
+ if (!"".equals(string) || string.endsWith(",")) {
+ return string.substring(0, string.length() - 1);
+ }
+ return null;
+ }
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/SqlUtils.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/SqlUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..c21a9b209e54164a2fcc41d3588c493d349e43e0
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/dynamic/db/SqlUtils.java
@@ -0,0 +1,212 @@
+package org.jeecg.common.util.dynamic.db;
+
+import java.text.MessageFormat;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.jeecg.common.constant.DataBaseConstant;
+import org.jeecg.common.system.vo.DynamicDataSourceModel;
+
+/**
+ * 根据不同的数据库,动态生成SQL,例如分页
+ */
+public class SqlUtils {
+
+ public static final String DATABSE_TYPE_MYSQL = "mysql";
+ public static final String DATABSE_TYPE_POSTGRE = "postgresql";
+ public static final String DATABSE_TYPE_ORACLE = "oracle";
+ public static final String DATABSE_TYPE_SQLSERVER = "sqlserver";
+
+
+ /**
+ * 分页SQL
+ */
+ public static final String MYSQL_SQL = "select * from ( {0}) sel_tab00 limit {1},{2}";
+ public static final String POSTGRE_SQL = "select * from ( {0}) sel_tab00 limit {2} offset {1}";
+ public static final String ORACLE_SQL = "select * from (select row_.*,rownum rownum_ from ({0}) row_ where rownum <= {1}) where rownum_>{2}";
+ public static final String SQLSERVER_SQL = "select * from ( select row_number() over(order by tempColumn) tempRowNumber, * from (select top {1} tempColumn = 0, {0}) t ) tt where tempRowNumber > {2}";
+
+ /**
+ * 获取所有表的SQL
+ */
+ public static final String MYSQL_ALLTABLES_SQL = "select distinct table_name from information_schema.columns where table_schema = {0}";
+ public static final String POSTGRE__ALLTABLES_SQL = "SELECT distinct c.relname AS table_name FROM pg_class c";
+ public static final String ORACLE__ALLTABLES_SQL = "select distinct colstable.table_name as table_name from user_tab_cols colstable";
+ public static final String SQLSERVER__ALLTABLES_SQL = "select distinct c.name as table_name from sys.objects c";
+
+ /**
+ * 获取指定表的所有列名
+ */
+ public static final String MYSQL_ALLCOLUMNS_SQL = "select column_name from information_schema.columns where table_name = {0} and table_schema = {1}";
+ public static final String POSTGRE_ALLCOLUMNS_SQL = "select table_name from information_schema.columns where table_name = {0}";
+ public static final String ORACLE_ALLCOLUMNS_SQL = "select column_name from all_tab_columns where table_name ={0}";
+ public static final String SQLSERVER_ALLCOLUMNS_SQL = "select name from syscolumns where id={0}";
+
+ /*
+ * 判断数据库类型
+ */
+
+ public static boolean dbTypeIsMySQL(String dbType) {
+ return dbTypeIf(dbType, DATABSE_TYPE_MYSQL, DataBaseConstant.DB_TYPE_MYSQL_NUM);
+ }
+
+ public static boolean dbTypeIsOracle(String dbType) {
+ return dbTypeIf(dbType, DATABSE_TYPE_ORACLE, DataBaseConstant.DB_TYPE_ORACLE_NUM);
+ }
+
+ public static boolean dbTypeIsSQLServer(String dbType) {
+ return dbTypeIf(dbType, DATABSE_TYPE_SQLSERVER, DataBaseConstant.DB_TYPE_SQLSERVER_NUM);
+ }
+
+ public static boolean dbTypeIsPostgre(String dbType) {
+ return dbTypeIf(dbType, DATABSE_TYPE_POSTGRE, DataBaseConstant.DB_TYPE_POSTGRESQL_NUM);
+ }
+
+ /**
+ * 判断数据库类型
+ */
+ public static boolean dbTypeIf(String dbType, String... correctTypes) {
+ for (String type : correctTypes) {
+ if (type.equalsIgnoreCase(dbType)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 获取全 SQL
+ * 拼接 where 条件
+ *
+ * @param sql
+ * @param params
+ * @return
+ */
+ public static String getFullSql(String sql, Map params) {
+ return getFullSql(sql, params, null, null);
+ }
+
+ /**
+ * 获取全 SQL
+ * 拼接 where 条件
+ * 拼接 order 排序
+ *
+ * @param sql
+ * @param params
+ * @param orderColumn 排序字段
+ * @param orderBy 排序方式,只能是 DESC 或 ASC
+ * @return
+ */
+ public static String getFullSql(String sql, Map params, String orderColumn, String orderBy) {
+ StringBuilder sqlBuilder = new StringBuilder();
+ sqlBuilder.append("SELECT t.* FROM ( ").append(sql).append(" ) t ");
+ if (params != null && params.size() >= 1) {
+ sqlBuilder.append("WHERE 1=1 ");
+ for (Object key : params.keySet()) {
+ String value = String.valueOf(params.get(key));
+ if (StringUtils.isNotBlank(value)) {
+ sqlBuilder.append(" AND (").append(key).append(" = N'").append(value).append("')");
+ }
+ }
+ if (StringUtils.isNotBlank(orderColumn) && StringUtils.isNotBlank(orderBy)) {
+ sqlBuilder.append("ORDER BY ").append(orderColumn).append(" ").append("DESC".equalsIgnoreCase(orderBy) ? "DESC" : "ASC");
+ }
+ }
+ return sqlBuilder.toString();
+ }
+
+ /**
+ * 获取求数量 SQL
+ *
+ * @param sql
+ * @return
+ */
+ public static String getCountSql(String sql) {
+ return String.format("SELECT COUNT(1) \"total\" FROM ( %s ) temp_count", sql);
+ }
+
+ /**
+ * 生成分页查询 SQL
+ *
+ * @param dbType 数据库类型
+ * @param sql
+ * @param page
+ * @param rows
+ * @return
+ */
+ public static String createPageSqlByDBType(String dbType, String sql, int page, int rows) {
+ int beginNum = (page - 1) * rows;
+ Object[] sqlParam = new Object[3];
+ sqlParam[0] = sql;
+ sqlParam[1] = String.valueOf(beginNum);
+ sqlParam[2] = String.valueOf(rows);
+ if (dbTypeIsMySQL(dbType)) {
+ sql = MessageFormat.format(MYSQL_SQL, sqlParam);
+ } else if (dbTypeIsPostgre(dbType)) {
+ sql = MessageFormat.format(POSTGRE_SQL, sqlParam);
+ } else {
+ int beginIndex = (page - 1) * rows;
+ int endIndex = beginIndex + rows;
+ sqlParam[2] = Integer.toString(beginIndex);
+ sqlParam[1] = Integer.toString(endIndex);
+ if (dbTypeIsOracle(dbType)) {
+ sql = MessageFormat.format(ORACLE_SQL, sqlParam);
+ } else if (dbTypeIsSQLServer(dbType)) {
+ sqlParam[0] = sql.substring(getAfterSelectInsertPoint(sql));
+ sql = MessageFormat.format(SQLSERVER_SQL, sqlParam);
+ }
+ }
+ return sql;
+ }
+
+ /**
+ * 生成分页查询 SQL
+ *
+ * @param sql
+ * @param page
+ * @param rows
+ * @return
+ */
+ public static String createPageSqlByDBKey(String dbKey, String sql, int page, int rows) {
+ DynamicDataSourceModel dynamicSourceEntity = DataSourceCachePool.getCacheDynamicDataSourceModel(dbKey);
+ String dbType = dynamicSourceEntity.getDbType();
+ return createPageSqlByDBType(dbType, sql, page, rows);
+ }
+
+ private static int getAfterSelectInsertPoint(String sql) {
+ int selectIndex = sql.toLowerCase().indexOf("select");
+ int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct");
+ return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
+ }
+
+ public static String getAllTableSql(String dbType, Object... params) {
+ if (StringUtils.isNotEmpty(dbType)) {
+ if (dbTypeIsMySQL(dbType)) {
+ return MessageFormat.format(MYSQL_ALLTABLES_SQL, params);
+ } else if (dbTypeIsOracle(dbType)) {
+ return ORACLE__ALLTABLES_SQL;
+ } else if (dbTypeIsPostgre(dbType)) {
+ return POSTGRE__ALLTABLES_SQL;
+ } else if (dbTypeIsSQLServer(dbType)) {
+ return SQLSERVER__ALLTABLES_SQL;
+ }
+ }
+ return null;
+ }
+
+ public static String getAllColumnSQL(String dbType, Object... params) {
+ if (StringUtils.isNotEmpty(dbType)) {
+ if (dbTypeIsMySQL(dbType)) {
+ return MessageFormat.format(MYSQL_ALLCOLUMNS_SQL, params);
+ } else if (dbTypeIsOracle(dbType)) {
+ return MessageFormat.format(ORACLE_ALLCOLUMNS_SQL, params);
+ } else if (dbTypeIsPostgre(dbType)) {
+ return MessageFormat.format(POSTGRE_ALLCOLUMNS_SQL, params);
+ } else if (dbTypeIsSQLServer(dbType)) {
+ return MessageFormat.format(SQLSERVER_ALLCOLUMNS_SQL, params);
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java
new file mode 100644
index 0000000000000000000000000000000000000000..b59028fdd80dcd78b40e09e67b65c195267707d0
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/BaseColumn.java
@@ -0,0 +1,28 @@
+package org.jeecg.common.util.jsonschema;
+
+import lombok.Data;
+
+/**
+ * 列 配置基本信息
+ */
+@Data
+public class BaseColumn {
+
+ /**
+ * 列配置 描述 -对应数据库字段描述
+ */
+ private String title;
+
+ /**
+ * 列配置 名称 -对应数据库字段名
+ */
+ private String field;
+
+ public BaseColumn(){}
+
+ public BaseColumn(String title,String field){
+ this.title = title;
+ this.field = field;
+ }
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..d0d6339bff610747d8ad23f21089a0e330f712b5
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/CommonProperty.java
@@ -0,0 +1,170 @@
+package org.jeecg.common.util.jsonschema;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.Map;
+
+import org.jeecg.common.system.vo.DictModel;
+
+/**
+ * 验证通用属性
+ */
+public abstract class CommonProperty implements Serializable{
+
+ private static final long serialVersionUID = -426159949502493187L;
+
+
+ protected String key;
+
+
+ /**
+ * 此关键字的值必须是字符串或数组。如果它是一个数组,那么数组的元素必须是字符串,并且必须是唯一的。
+ *
字符串值必须是六种基本类型之一(“null”,“boolean”,“object”,“array”,“number”或“string”),或“integer”,它匹配任何数字,零分数部分。
+ *
当且仅当实例位于为此关键字列出的任何集合中时,实例才会验证。
+ *
+ */
+ protected String type;
+
+ /**
+ * 对应JsonSchema的enum
+ *
该关键字的值必须是一个数组。这个数组应该至少有一个元素。数组中的元素应该是唯一的。如果实例的值等于此关键字的数组值中的某个元素,则实例将对此关键字成功验证。
+ * 数组中的元素可以是任何值,包括null
+ *
+ * {
+ * "type": "string",
+ * "enum": ["1", "2", "3"] 需要的话可以通过这个include转一下
+ * }
+ */
+ protected List include;
+
+ /**
+ * 对应JsonSchema的const
+ * 此关键字的值可以是任何类型,包括null。
+ * 如果实例的值等于关键字的值,则实例将针对此关键字成功验证。
+ */
+ protected Object constant;
+
+ //三个自定义 属性
+ protected String view;// 展示类型
+ protected String title;//数据库字段备注
+ protected Integer order;//字段显示排序
+
+ protected boolean disabled;//是否禁用
+
+ protected String defVal; // 字段默认值
+
+ public String getDefVal() {
+ return defVal;
+ }
+
+ public void setDefVal(String defVal) {
+ this.defVal = defVal;
+ }
+
+ public boolean isDisabled() {
+ return disabled;
+ }
+
+ public void setDisabled(boolean disabled) {
+ this.disabled = disabled;
+ }
+
+ public String getView() {
+ return view;
+ }
+
+ public void setView(String view) {
+ this.view = view;
+ }
+
+ public String getKey() {
+ return key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public List getInclude() {
+ return include;
+ }
+
+ public void setInclude(List include) {
+ this.include = include;
+ }
+
+ public Object getConstant() {
+ return constant;
+ }
+
+ public void setConstant(Object constant) {
+ this.constant = constant;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public Integer getOrder() {
+ return order;
+ }
+
+ public void setOrder(Integer order) {
+ this.order = order;
+ }
+
+ /**
+ * 返回一个map有两个key
+ * key ---> Property JSON的key
+ *
prop --> JSON object
+ * @return
+ */
+ public abstract Map getPropertyJson();
+
+ public JSONObject getCommonJson() {
+ JSONObject json = new JSONObject();
+ json.put("type", type);
+ if(include!=null && include.size()>0) {
+ json.put("enum", include);
+ }
+ if(constant!=null) {
+ json.put("const", constant);
+ }
+ if(title!=null) {
+ json.put("title", title);
+ }
+ if(order!=null) {
+ json.put("order", order);
+ }
+ if(view==null) {
+ json.put("view", "input");
+ }else {
+ json.put("view", view);
+ }
+ if(disabled) {
+ String str = "{\"widgetattrs\":{\"disabled\":true}}";
+ JSONObject ui = JSONObject.parseObject(str);
+ json.put("ui", ui);
+ }
+ if (defVal!=null && defVal.length()>0) {
+ json.put("defVal", defVal);
+ }
+ return json;
+ }
+
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java
new file mode 100644
index 0000000000000000000000000000000000000000..58c12f9ba920251cf1cdfcb7f567d8735b1f6aaa
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonSchemaDescrip.java
@@ -0,0 +1,87 @@
+package org.jeecg.common.util.jsonschema;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * JsonSchema 模式类
+ * < http://json-schema.org/draft-07/schema# >
+ */
+public class JsonSchemaDescrip implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 7682073117441544718L;
+
+
+ private String $schema = "http://json-schema.org/draft-07/schema#";
+
+ /**
+ * 用它给我们的模式提供了标题。
+ */
+ private String title;
+
+ /**
+ * 关于模式的描述。
+ */
+ private String description;
+
+ /**
+ *type 关键字在我们的 JSON 数据上定义了第一个约束:必须是一个 JSON 对象。 可以直接设置成object
+ */
+ private String type;
+
+ private List required;
+
+
+ public List getRequired() {
+ return required;
+ }
+
+ public void setRequired(List required) {
+ this.required = required;
+ }
+
+ public String get$schema() {
+ return $schema;
+ }
+
+ public void set$schema(String $schema) {
+ this.$schema = $schema;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public JsonSchemaDescrip() {}
+
+ public JsonSchemaDescrip(List required) {
+ this.description="我是一个jsonschema description";
+ this.title="我是一个jsonschema title";
+ this.type="object";
+ this.required = required;
+ }
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java
new file mode 100644
index 0000000000000000000000000000000000000000..fc0af57d3d560af232128c52511f657cfa7a7c66
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/JsonschemaUtil.java
@@ -0,0 +1,69 @@
+package org.jeecg.common.util.jsonschema;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class JsonschemaUtil {
+
+ /**
+ * 生成JsonSchema
+ *
+ * @param descrip
+ * @param propertyList
+ * @return
+ */
+ public static JSONObject getJsonSchema(JsonSchemaDescrip descrip, List propertyList) {
+ JSONObject obj = new JSONObject();
+ obj.put("$schema", descrip.get$schema());
+ obj.put("type", descrip.getType());
+ obj.put("title", descrip.getTitle());
+
+ List requiredArr = descrip.getRequired();
+ obj.put("required", requiredArr);
+
+ JSONObject properties = new JSONObject();
+ for (CommonProperty commonProperty : propertyList) {
+ Map map = commonProperty.getPropertyJson();
+ properties.put(map.get("key").toString(), map.get("prop"));
+ }
+ obj.put("properties", properties);
+ //鬼知道这里为什么报错 org.jeecg.modules.system.model.DictModel cannot be cast to org.jeecg.modules.system.model.DictModel
+ log.info("---JSONSchema--->"+obj.toJSONString());
+ return obj;
+ }
+
+ /**
+ * 生成JsonSchema 用于子对象
+ * @param title 子对象描述
+ * @param requiredArr 子对象必填属性名集合
+ * @param propertyList 子对象属性集合
+ * @return
+ */
+ public static JSONObject getSubJsonSchema(String title,List requiredArr,List propertyList) {
+ JSONObject obj = new JSONObject();
+ obj.put("type", "object");
+ obj.put("view", "tab");
+ obj.put("title", title);
+
+ if(requiredArr==null) {
+ requiredArr = new ArrayList();
+ }
+ obj.put("required", requiredArr);
+
+ JSONObject properties = new JSONObject();
+ for (CommonProperty commonProperty : propertyList) {
+ Map map = commonProperty.getPropertyJson();
+ properties.put(map.get("key").toString(), map.get("prop"));
+ }
+ obj.put("properties", properties);
+ //log.info("---JSONSchema--->"+obj.toString());
+ return obj;
+ }
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..92e147c174f252422bfbb7c24ec0e07a30410792
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/DictProperty.java
@@ -0,0 +1,82 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+/**
+ * 字典属性
+ * @author 86729
+ *
+ */
+public class DictProperty extends CommonProperty {
+
+ private static final long serialVersionUID = 3786503639885610767L;
+
+ //字典三属性
+ private String dictCode;
+ private String dictTable;
+ private String dictText;
+
+ public String getDictCode() {
+ return dictCode;
+ }
+
+ public void setDictCode(String dictCode) {
+ this.dictCode = dictCode;
+ }
+
+ public String getDictTable() {
+ return dictTable;
+ }
+
+ public void setDictTable(String dictTable) {
+ this.dictTable = dictTable;
+ }
+
+ public String getDictText() {
+ return dictText;
+ }
+
+ public void setDictText(String dictText) {
+ this.dictText = dictText;
+ }
+
+ public DictProperty() {}
+
+ /**
+ * 构造器
+ */
+ public DictProperty(String key,String title,String dictTable,String dictCode,String dictText) {
+ this.type = "string";
+ this.view = "sel_search";
+ this.key = key;
+ this.title = title;
+ this.dictCode = dictCode;
+ this.dictTable= dictTable;
+ this.dictText= dictText;
+ }
+
+ @Override
+ public Map getPropertyJson() {
+ Map map = new HashMap<>();
+ map.put("key",getKey());
+ JSONObject prop = getCommonJson();
+ if(dictCode!=null) {
+ prop.put("dictCode",dictCode);
+ }
+ if(dictTable!=null) {
+ prop.put("dictTable",dictTable);
+ }
+ if(dictText!=null) {
+ prop.put("dictText",dictText);
+ }
+ map.put("prop",prop);
+ return map;
+ }
+
+ //TODO 重构问题:数据字典 只是字符串类的还是有存储的数值类型?只有字符串请跳过这个 只改前端
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..08e5c1723b53e980acbf5949172844bddb4eae64
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/HiddenProperty.java
@@ -0,0 +1,38 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+/**
+ * 字典属性
+ * @author 86729
+ *
+ */
+public class HiddenProperty extends CommonProperty {
+
+ private static final long serialVersionUID = -8939298551502162479L;
+
+ public HiddenProperty() {}
+
+ public HiddenProperty(String key,String title) {
+ this.type = "string";
+ this.view = "hidden";
+ this.key = key;
+ this.title = title;
+ }
+
+ @Override
+ public Map getPropertyJson() {
+ Map map = new HashMap<>();
+ map.put("key",getKey());
+ JSONObject prop = getCommonJson();
+ prop.put("hidden",true);
+ map.put("prop",prop);
+ return map;
+ }
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..c07ced3fb368a5f554c5a1fc3dfe78ee09afaae3
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/LinkDownProperty.java
@@ -0,0 +1,69 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jeecg.common.util.jsonschema.BaseColumn;
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+/**
+ * 级联下拉
+ */
+public class LinkDownProperty extends CommonProperty {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 配置信息
+ */
+ String dictTable;
+
+ /**
+ * 级联下拉组件 的其他级联列
+ */
+ List otherColumns;
+
+ public String getDictTable(){
+ return this.dictTable;
+ }
+
+ public void setDictTable(String dictTable){
+ this.dictTable = dictTable;
+ }
+
+ public List getOtherColumns(){
+ return this.otherColumns;
+ }
+
+ public void setOtherColumns(List otherColumns){
+ this.otherColumns = otherColumns;
+ }
+
+ public LinkDownProperty() {}
+
+ /**
+ * 构造器
+ */
+ public LinkDownProperty(String key,String title,String dictTable) {
+ this.type = "string";
+ this.view = "link_down";
+ this.key = key;
+ this.title = title;
+ this.dictTable= dictTable;
+ }
+
+ @Override
+ public Map getPropertyJson() {
+ Map map = new HashMap<>();
+ map.put("key", getKey());
+ JSONObject prop = getCommonJson();
+ JSONObject temp = JSONObject.parseObject(this.dictTable);
+ prop.put("config", temp);
+ prop.put("others", otherColumns);
+ map.put("prop", prop);
+ return map;
+ }
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..c0ad605ad9a7bd513cfc3eb60f1b4d210d46b512
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/NumberProperty.java
@@ -0,0 +1,169 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jeecg.common.system.vo.DictModel;
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+public class NumberProperty extends CommonProperty {
+
+ private static final long serialVersionUID = -558615331436437200L;
+
+ /**
+ * 倍数
+ * 验证实例是否为此数值的倍数
+ * “multipleOf”的值必须是一个数字,严格大于0。
+ */
+ private Integer multipleOf;
+
+ /**
+ * 小于等于
+ * “maximum”的值必须是一个数字,表示数字实例的包含上限。
+ * 如果实例是数字,则仅当实例小于或等于“最大”时,此关键字才会生效。
+ */
+ private Integer maximum;
+
+ /**
+ * 小于
+ * “exclusiveMaximum”的值必须是数字,表示数字实例的独占上限。
+ * 如果实例是数字,则实例仅在其值严格小于(不等于)“exclusiveMaximum”时才有效。
+ */
+ private Integer exclusiveMaximum;
+
+ /**
+ * 大于等于
+ */
+ private Integer minimum;
+
+ /**
+ * 大于等于
+ */
+ private Integer exclusiveMinimum;
+
+ private String pattern;
+
+ /**
+ * 错误提示信息
+ */
+ private String errorInfo;
+
+ public String getErrorInfo() {
+ return errorInfo;
+ }
+
+ public void setErrorInfo(String errorInfo) {
+ this.errorInfo = errorInfo;
+ }
+
+ public Integer getMultipleOf() {
+ return multipleOf;
+ }
+
+ public void setMultipleOf(Integer multipleOf) {
+ this.multipleOf = multipleOf;
+ }
+
+ public Integer getMaximum() {
+ return maximum;
+ }
+
+ public void setMaximum(Integer maximum) {
+ this.maximum = maximum;
+ }
+
+ public Integer getExclusiveMaximum() {
+ return exclusiveMaximum;
+ }
+
+ public void setExclusiveMaximum(Integer exclusiveMaximum) {
+ this.exclusiveMaximum = exclusiveMaximum;
+ }
+
+ public Integer getMinimum() {
+ return minimum;
+ }
+
+ public void setMinimum(Integer minimum) {
+ this.minimum = minimum;
+ }
+
+ public Integer getExclusiveMinimum() {
+ return exclusiveMinimum;
+ }
+
+ public void setExclusiveMinimum(Integer exclusiveMinimum) {
+ this.exclusiveMinimum = exclusiveMinimum;
+ }
+
+ public String getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(String pattern) {
+ this.pattern = pattern;
+ }
+
+ public NumberProperty() {}
+
+ /**
+ * 构造器
+ * @param key 字段名
+ * @param title 字段备注
+ * @param type number和integer
+ */
+ public NumberProperty(String key,String title,String type) {
+ this.key = key;
+ this.type = type;
+ this.title = title;
+ this.view = "number";
+ }
+
+ /**
+ * 列表类型的走这个构造器 字典里存储的都是字符串 没法走这个构造器
+ * @param key
+ * @param title
+ * @param view list-checkbox-radio
+ * @param include
+ */
+ public NumberProperty(String key,String title,String view,List include) {
+ this.type = "integer";
+ this.key = key;
+ this.view = view;
+ this.title = title;
+ this.include = include;
+ }
+
+ @Override
+ public Map getPropertyJson() {
+ Map map = new HashMap<>();
+ map.put("key",getKey());
+ JSONObject prop = getCommonJson();
+ if(multipleOf!=null) {
+ prop.put("multipleOf",multipleOf);
+ }
+ if(maximum!=null) {
+ prop.put("maximum",maximum);
+ }
+ if(exclusiveMaximum!=null) {
+ prop.put("exclusiveMaximum",exclusiveMaximum);
+ }
+ if(minimum!=null) {
+ prop.put("minimum",minimum);
+ }
+ if(exclusiveMinimum!=null) {
+ prop.put("exclusiveMinimum",exclusiveMinimum);
+ }
+ if(pattern!=null) {
+ prop.put("pattern",pattern);
+ }
+ if(errorInfo!=null) {
+ prop.put("errorInfo",errorInfo);
+ }
+ map.put("prop",prop);
+ return map;
+ }
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/PopupProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/PopupProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..0df143a59c2800a02a2f97feb07e0436a456cd5e
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/PopupProperty.java
@@ -0,0 +1,89 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+public class PopupProperty extends CommonProperty {
+
+ private static final long serialVersionUID = -3200493311633999539L;
+
+ private String code;
+
+ private String destFields;
+
+ private String orgFields;
+
+ private String extendJson;
+
+ public String getExtendJson() {
+ return extendJson;
+ }
+
+ public void setExtendJson(String extendJson) {
+ this.extendJson = extendJson;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(String code) {
+ this.code = code;
+ }
+
+ public String getDestFields() {
+ return destFields;
+ }
+
+ public void setDestFields(String destFields) {
+ this.destFields = destFields;
+ }
+
+ public String getOrgFields() {
+ return orgFields;
+ }
+
+ public void setOrgFields(String orgFields) {
+ this.orgFields = orgFields;
+ }
+
+ public PopupProperty() {}
+
+ public PopupProperty(String key,String title,String code,String destFields,String orgFields,String extendJson) {
+ this.view = "popup";
+ this.type = "string";
+ this.key = key;
+ this.title = title;
+ this.code = code;
+ this.destFields=destFields;
+ this.orgFields=orgFields;
+ this.extendJson = extendJson;
+ }
+
+
+ @Override
+ public Map getPropertyJson() {
+ Map map = new HashMap<>();
+ map.put("key",getKey());
+ JSONObject prop = getCommonJson();
+ if(code!=null) {
+ prop.put("code",code);
+ }
+ if(destFields!=null) {
+ prop.put("destFields",destFields);
+ }
+ if(orgFields!=null) {
+ prop.put("orgFields",orgFields);
+ }
+ if(extendJson!=null){
+ prop.put("extendJson",extendJson);
+ }
+ map.put("prop",prop);
+ return map;
+ }
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..9c2a5671b437cd4003f2d55c05ffc1741db53aea
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/StringProperty.java
@@ -0,0 +1,119 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jeecg.common.system.vo.DictModel;
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+public class StringProperty extends CommonProperty {
+
+ private static final long serialVersionUID = -3200493311633999539L;
+
+ private Integer maxLength;
+
+ private Integer minLength;
+
+ /**
+ * 根据ECMA 262正则表达式方言,该字符串应该是有效的正则表达式。
+ */
+ private String pattern;
+
+ /**
+ * 错误提示信息
+ */
+ private String errorInfo;
+
+ public Integer getMaxLength() {
+ return maxLength;
+ }
+
+
+ public void setMaxLength(Integer maxLength) {
+ this.maxLength = maxLength;
+ }
+
+ public Integer getMinLength() {
+ return minLength;
+ }
+
+ public void setMinLength(Integer minLength) {
+ this.minLength = minLength;
+ }
+
+ public String getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(String pattern) {
+ this.pattern = pattern;
+ }
+
+ public String getErrorInfo() {
+ return errorInfo;
+ }
+
+
+ public void setErrorInfo(String errorInfo) {
+ this.errorInfo = errorInfo;
+ }
+
+
+ public StringProperty() {}
+
+ /**
+ * 一般字符串类型走这个构造器
+ * @param key 字段名
+ * @param title 字段备注
+ * @param view 展示控件
+ * @param maxLength 数据库字段最大长度
+ */
+ public StringProperty(String key,String title,String view,Integer maxLength) {
+ this.maxLength = maxLength;
+ this.key = key;
+ this.view = view;
+ this.title = title;
+ this.type = "string";
+ }
+
+ /**
+ * 列表类型的走这个构造器
+ * @param key 字段名
+ * @param title 字段备注
+ * @param view 展示控件 list-checkbox-radio
+ * @param maxLength 数据库字段最大长度
+ * @param include 数据字典
+ */
+ public StringProperty(String key,String title,String view,Integer maxLength,List include) {
+ this.maxLength = maxLength;
+ this.key = key;
+ this.view = view;
+ this.title = title;
+ this.type = "string";
+ this.include = include;
+ }
+ @Override
+ public Map getPropertyJson() {
+ Map map = new HashMap<>();
+ map.put("key",getKey());
+ JSONObject prop = getCommonJson();
+ if(maxLength!=null) {
+ prop.put("maxLength",maxLength);
+ }
+ if(minLength!=null) {
+ prop.put("minLength",minLength);
+ }
+ if(pattern!=null) {
+ prop.put("pattern",pattern);
+ }
+ if(errorInfo!=null) {
+ prop.put("errorInfo",errorInfo);
+ }
+ map.put("prop",prop);
+ return map;
+ }
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..6dd6abb1de171c7351ce588aaed3738a9ae88e6f
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/SwitchProperty.java
@@ -0,0 +1,48 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+/**
+ * 开关 属性
+ */
+public class SwitchProperty extends CommonProperty {
+
+ private static final long serialVersionUID = 6047019098806560250L;
+ //扩展参数配置信息
+ private String extendStr;
+
+ public SwitchProperty() {}
+
+ /**
+ * 构造器
+ */
+ public SwitchProperty(String key, String title, String extendStr) {
+ this.type = "string";
+ this.view = "switch";
+ this.key = key;
+ this.title = title;
+ this.extendStr = extendStr;
+ }
+
+ @Override
+ public Map getPropertyJson() {
+ Map map = new HashMap<>();
+ map.put("key",getKey());
+ JSONObject prop = getCommonJson();
+ JSONArray array = new JSONArray();
+ if(extendStr!=null) {
+ array = JSONArray.parseArray(extendStr);
+ prop.put("extendOption",array);
+ }
+ map.put("prop",prop);
+ return map;
+ }
+
+ //TODO 重构问题:数据字典 只是字符串类的还是有存储的数值类型?只有字符串请跳过这个 只改前端
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java
new file mode 100644
index 0000000000000000000000000000000000000000..97bb6f46eb2f41244d8f391512ae3273f64b39c4
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/util/jsonschema/validate/TreeSelectProperty.java
@@ -0,0 +1,146 @@
+package org.jeecg.common.util.jsonschema.validate;
+
+import com.alibaba.fastjson.JSONObject;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jeecg.common.util.jsonschema.CommonProperty;
+
+/**
+ * 字典属性
+ * @author 86729
+ *
+ */
+public class TreeSelectProperty extends CommonProperty {
+
+ private static final long serialVersionUID = 3786503639885610767L;
+
+ private String dict;//表名,文本,id
+ private String pidField;//父级字段 默认pid
+ private String pidValue;//父级节点的值 暂时没用到 默认为0
+ private String hasChildField;
+ private String textField;//树形下拉保存text值的字段名
+
+ /**
+ * 是不是pid 组件 1是 0否
+ */
+ private Integer pidComponent = 0;
+
+ public String getDict() {
+ return dict;
+ }
+
+ public void setDict(String dict) {
+ this.dict = dict;
+ }
+
+ public String getPidField() {
+ return pidField;
+ }
+
+ public void setPidField(String pidField) {
+ this.pidField = pidField;
+ }
+
+ public String getPidValue() {
+ return pidValue;
+ }
+
+ public void setPidValue(String pidValue) {
+ this.pidValue = pidValue;
+ }
+
+ public String getHasChildField() {
+ return hasChildField;
+ }
+
+ public void setHasChildField(String hasChildField) {
+ this.hasChildField = hasChildField;
+ }
+
+ public TreeSelectProperty() {}
+
+ public String getTextField() {
+ return textField;
+ }
+
+ public void setTextField(String textField) {
+ this.textField = textField;
+ }
+
+ public Integer getPidComponent() {
+ return pidComponent;
+ }
+
+ public void setPidComponent(Integer pidComponent) {
+ this.pidComponent = pidComponent;
+ }
+
+ /**
+ * 构造器 构造普通树形下拉
+ */
+ public TreeSelectProperty(String key,String title,String dict,String pidField,String pidValue) {
+ this.type = "string";
+ this.view = "sel_tree";
+ this.key = key;
+ this.title = title;
+ this.dict = dict;
+ this.pidField= pidField;
+ this.pidValue= pidValue;
+ }
+
+ /**
+ * 分类字典下拉专用
+ * @param key
+ * @param title
+ * @param pidValue
+ */
+ public TreeSelectProperty(String key,String title,String pidValue) {
+ this.type = "string";
+ this.view = "cat_tree";
+ this.key = key;
+ this.title = title;
+ this.pidValue = pidValue;
+ }
+
+ /**
+ * 分类字典 支持存储text 下拉专用
+ * @param key
+ * @param title
+ * @param pidValue
+ * @param textField
+ */
+ public TreeSelectProperty(String key,String title,String pidValue,String textField) {
+ this(key,title,pidValue);
+ this.textField = textField;
+ }
+
+ @Override
+ public Map getPropertyJson() {
+ Map map = new HashMap<>();
+ map.put("key",getKey());
+ JSONObject prop = getCommonJson();
+ if(dict!=null) {
+ prop.put("dict",dict);
+ }
+ if(pidField!=null) {
+ prop.put("pidField",pidField);
+ }
+ if(pidValue!=null) {
+ prop.put("pidValue",pidValue);
+ }
+ if(textField!=null) {
+ prop.put("textField",textField);
+ }
+ if(hasChildField!=null) {
+ prop.put("hasChildField",hasChildField);
+ }
+ if(pidComponent!=null) {
+ prop.put("pidComponent",pidComponent);
+ }
+ map.put("prop",prop);
+ return map;
+ }
+
+}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/DruidConfig.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/DruidConfig.java
index 7659172bacb16a1fc1ffb8a1182739cf19371d16..1555fbc76f65624de37b65578f892ee65f2b4db1 100644
--- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/DruidConfig.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/DruidConfig.java
@@ -83,5 +83,15 @@ public class DruidConfig {
response.resetBuffer();
response.getWriter().write(newJs);
}
+
+ @Override
+ public void init(FilterConfig filterConfig) throws ServletException {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
}
}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/WebSocketConfig.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/WebSocketConfig.java
index 52230f865bae517d3218ba7456348911e0dc3795..52024ea051bf0dd39bfdcf4534c174a42c983504 100644
--- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/WebSocketConfig.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/WebSocketConfig.java
@@ -8,7 +8,7 @@ import org.springframework.web.socket.server.standard.ServerEndpointExporter;
* @Description: WebSocketConfig
* @author: jeecg-boot
*/
-@Configuration
+//@Configuration
public class WebSocketConfig {
/**
* 注入ServerEndpointExporter,
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java
index 99c075a511800e3d776a7986e20da86d96cc9d93..0ae1258eef3468dc7044d7f5610f24d2d8dfc6e9 100644
--- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/MybatisPlusSaasConfig.java
@@ -5,6 +5,8 @@ import java.util.List;
import org.jeecg.common.util.oConvertUtils;
import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -13,6 +15,8 @@ import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
+import javax.annotation.Resource;
+
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.LongValue;
@@ -24,52 +28,15 @@ import net.sf.jsqlparser.expression.LongValue;
@Configuration
@MapperScan(value={"org.jeecg.modules.**.mapper*"})
public class MybatisPlusSaasConfig {
- /**
- * tenant_id 字段名
- */
- private static final String TENANT_FIELD_NAME = "tenant_id";
- /**
- * 哪些表需要做多租户 表需要添加一个字段 tenant_id
- */
- private static final List TENANT_TABLE = new ArrayList();
-
- static {
- TENANT_TABLE.add("demo");
-
-// //角色、菜单、部门
-// tenantTable.add("sys_role");
-// tenantTable.add("sys_permission");
-// tenantTable.add("sys_depart");
- }
+ @Resource
+ private TenantHandler tenantHandler;
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
// 先 add TenantLineInnerInterceptor 再 add PaginationInnerInterceptor
- interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(new TenantLineHandler() {
- @Override
- public Expression getTenantId() {
- String tenantId = oConvertUtils.getString(TenantContext.getTenant(),"0");
- return new LongValue(tenantId);
- }
-
- @Override
- public String getTenantIdColumn(){
- return TENANT_FIELD_NAME;
- }
-
- // 返回 true 表示不走租户逻辑
- @Override
- public boolean ignoreTable(String tableName) {
- for(String temp: TENANT_TABLE){
- if(temp.equalsIgnoreCase(tableName)){
- return false;
- }
- }
- return true;
- }
- }));
+ interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(tenantHandler));
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/TenantHandler.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/TenantHandler.java
new file mode 100644
index 0000000000000000000000000000000000000000..23d857f355b4bff2994a19b16d69e35559a0f534
--- /dev/null
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/mybatis/TenantHandler.java
@@ -0,0 +1,58 @@
+package org.jeecg.config.mybatis;
+
+import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
+
+import java.util.List;
+
+import org.jeecg.common.util.oConvertUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import net.sf.jsqlparser.expression.Expression;
+import net.sf.jsqlparser.expression.LongValue;
+
+/**
+ * Copyright (c) 2001-2019 GuaHao.com Corporation Limited. All rights reserved.
+ * This software is the confidential and proprietary information of GuaHao
+ * Company. ("Confidential Information"). You shall not disclose such
+ * Confidential Information and shall use it only in accordance with the terms
+ * of the license agreement you entered into with GuaHao.com.
+ *
+ * @author zhouhuan
+ * @date 2022/6/13 16:45
+ * @Desc
+ **/
+@Component
+public class TenantHandler implements TenantLineHandler {
+ /**
+ * 哪些表需要做多租户 表需要添加一个字段 tenant_id
+ */
+ @Value("${tenant.table}")
+ private String[] TENANT_TABLE;
+ /**
+ * tenant_id 字段名
+ */
+ private static final String TENANT_FIELD_NAME = "tenant_id";
+
+ @Override
+ public Expression getTenantId() {
+ String tenantId = oConvertUtils.getString(TenantContext.getTenant(),"1");
+ return new LongValue(tenantId);
+ }
+
+ @Override
+ public String getTenantIdColumn(){
+ return TENANT_FIELD_NAME;
+ }
+
+ // 返回 true 表示不走租户逻辑
+ @Override
+ public boolean ignoreTable(String tableName) {
+ for(String temp: TENANT_TABLE){
+ if(temp.equalsIgnoreCase(tableName)){
+ return false;
+ }
+ }
+ return true;
+ }
+}
\ No newline at end of file
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
index f0fe2d2378b4b3a96bb9c1c3183b7cb4bd1064f3..4c04bae2b70f0cbdfe4a485070bb5cdb094a9c6b 100644
--- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java
@@ -94,6 +94,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/sys/getLoginQrcode/**", "anon"); //登录二维码
filterChainDefinitionMap.put("/sys/getQrcodeToken/**", "anon"); //监听扫码
filterChainDefinitionMap.put("/sys/checkAuth", "anon"); //授权接口排除
+ filterChainDefinitionMap.put("/sport/**", "anon"); //运动接口排除
filterChainDefinitionMap.put("/", "anon");
diff --git a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-tools/pom.xml b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-tools/pom.xml
index aa3c4e4abff694ef5d1ae5897d774b4bb74ee18b..801a634b81bdd69634c9764925a3257da12d6511 100644
--- a/jeecg-boot/jeecg-boot-base/jeecg-boot-base-tools/pom.xml
+++ b/jeecg-boot/jeecg-boot-base/jeecg-boot-base-tools/pom.xml
@@ -27,6 +27,10 @@
commons-pool2