diff --git a/modules/i3plus-pojo-model/pom.xml b/modules/i3plus-pojo-model/pom.xml
index edac7f5..24763f0 100644
--- a/modules/i3plus-pojo-model/pom.xml
+++ b/modules/i3plus-pojo-model/pom.xml
@@ -24,10 +24,10 @@
i3plus-pojo-platform
-
-
-
-
+
+ i3plus.pojo
+ i3plus-pojo-report
+
diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/common/ClassFieldModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/common/ClassFieldModel.java
index 5278ac4..a7575d5 100644
--- a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/common/ClassFieldModel.java
+++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/common/ClassFieldModel.java
@@ -1,13 +1,9 @@
package cn.estsh.i3plus.pojo.model.common;
-import cn.estsh.i3plus.pojo.base.annotation.RefPojo;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiParam;
import lombok.Data;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
import javax.persistence.Column;
import java.io.Serializable;
diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/report/BeanBrPojoAttrModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/report/BeanBrPojoAttrModel.java
new file mode 100644
index 0000000..49e1cc3
--- /dev/null
+++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/report/BeanBrPojoAttrModel.java
@@ -0,0 +1,35 @@
+package cn.estsh.i3plus.pojo.model.report;
+
+import cn.estsh.i3plus.pojo.report.bean.BrPojoAttr;
+import cn.estsh.i3plus.pojo.report.bean.BrTemplateCustomHql;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiParam;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Description ://TODO 提交注意修改 临时使用 带改动
+ * @Reference :
+ * @Author : Adair Peng
+ * @CreateDate : 2019-01-25 18:19
+ * @Modify:
+ **/
+@Data
+public class BeanBrPojoAttrModel {
+
+ @ApiParam(value = "表单模板ID")
+ @JsonSerialize(using = ToStringSerializer.class)
+ private Long templateId;
+
+ @ApiParam(value = "数据类型")
+ private Integer dataType;
+
+ @ApiParam(value = "对象属性")
+ private List attrList;
+
+ @ApiParam(value = "自定义HQL")
+ private BrTemplateCustomHql customHql;
+
+}
diff --git a/modules/i3plus-pojo-report/pom.xml b/modules/i3plus-pojo-report/pom.xml
index e5de4f4..e36fcf7 100644
--- a/modules/i3plus-pojo-report/pom.xml
+++ b/modules/i3plus-pojo-report/pom.xml
@@ -19,9 +19,5 @@
i3plus.pojo
i3plus-pojo-base
-
- i3plus.pojo
- i3plus-pojo-model
-
\ No newline at end of file
diff --git a/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/bean/BrTemplate.java b/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/bean/BrTemplate.java
index 07dc0f3..d8496ac 100644
--- a/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/bean/BrTemplate.java
+++ b/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/bean/BrTemplate.java
@@ -12,6 +12,7 @@ import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
+import java.util.ArrayList;
import java.util.List;
/**
@@ -100,39 +101,39 @@ public class BrTemplate extends BaseBean {
@Transient
@ApiParam(value ="模板服务编号集合")
- private List serverIdList;
+ private List serverIdList = new ArrayList<>();
@Transient
@ApiParam(value ="模板服务")
- private List serverList;
+ private List serverList = new ArrayList<>();
@Transient
@ApiParam(value ="模板服务对象")
- private List serverPojoList;
+ private List serverPojoList = new ArrayList<>();
@Transient
@ApiParam(value ="模板服务对象关系")
- private List serverPojoRefList;
+ private List serverPojoRefList = new ArrayList<>();
@Transient
@ApiParam(value ="模板服务对象关联属性")
- private List pojoAttrList;
+ private List pojoAttrList = new ArrayList<>();
@Transient
@ApiParam(value ="模板服务对象查询条件")
- private List pojoAttrWhereList;
+ private List pojoAttrWhereList = new ArrayList<>();
@Transient
@ApiParam(value ="模板服务对象分组条件")
- private List pojoAttrGroupList;
+ private List pojoAttrGroupList = new ArrayList<>();
@Transient
@ApiParam(value ="模板服务对象聚合条件")
- private List pojoAttrAggrList;
+ private List pojoAttrAggrList = new ArrayList<>();
@Transient
@ApiParam(value ="模板服务对象显示属性")
- private List pojoAttrShowList;
+ private List pojoAttrShowList = new ArrayList<>();
}
diff --git a/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/sqlpack/ReportHqlPack.java b/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/sqlpack/ReportHqlPack.java
index 83b6b54..4e295e3 100644
--- a/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/sqlpack/ReportHqlPack.java
+++ b/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/sqlpack/ReportHqlPack.java
@@ -2,9 +2,7 @@ package cn.estsh.i3plus.pojo.report.sqlpack;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
-import cn.estsh.i3plus.pojo.report.bean.BrElement;
-import cn.estsh.i3plus.pojo.report.bean.BrLayout;
-import cn.estsh.i3plus.pojo.report.bean.BrMenu;
+import cn.estsh.i3plus.pojo.report.bean.*;
import org.apache.commons.lang3.StringUtils;
/**
diff --git a/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/sqlpack/TemplateHqlPack.java b/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/sqlpack/TemplateHqlPack.java
deleted file mode 100644
index 2da95c0..0000000
--- a/modules/i3plus-pojo-report/src/main/java/cn/estsh/i3plus/pojo/report/sqlpack/TemplateHqlPack.java
+++ /dev/null
@@ -1,422 +0,0 @@
-package cn.estsh.i3plus.pojo.report.sqlpack;
-
-import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
-import cn.estsh.i3plus.pojo.base.enumutil.BlockReportEnumUtil;
-import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
-import cn.estsh.i3plus.pojo.model.report.TemplateModel;
-import cn.estsh.i3plus.pojo.report.bean.BrPojoAttr;
-import cn.estsh.i3plus.pojo.report.bean.BrRefServerPojo;
-import cn.estsh.i3plus.pojo.report.bean.BrTemplateCustomHql;
-import com.alibaba.fastjson.JSON;
-import org.apache.commons.lang3.StringUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-/**
- * @Description : 报表对象封装
- * @Reference :
- * @Author : wei peng
- * @CreateDate : 2019-01-17 15:41
- * @Modify:
- **/
-public class TemplateHqlPack {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(TemplateHqlPack.class);
-
- /**
- * 拼接查询字段
- *
- * @param attrs
- * @return
- */
- public static String getSelectHqlColumn(List attrs) {
- StringBuffer result = new StringBuffer();
- BlockReportEnumUtil.HQL_AGGREGATION aggr = null;
- if (attrs != null && attrs.size() > 0) {
- for (BrPojoAttr attr : attrs) {
- aggr = BlockReportEnumUtil.HQL_AGGREGATION.valueOf(attr.getAggregationType());
-
- // 聚合函数控制
- if (aggr == null) {
- result.append("," + attr.getPojoNameAlias() + "." + attr.getAttrName());
- } else {
- result.append(", " + aggr.getName() + "(" + attr.getPojoNameAlias() + "." + attr.getAttrName() + ")");
- }
-
- // 添加别名
- if (StringUtils.isNotBlank(attr.getAttrNameAlias())) {
- result.append(" AS " + attr.getAttrNameAlias());
- } else {
- result.append(" AS " + attr.getPojoNameAlias() + "_" + attr.getAttrName());
- }
- }
- return result.substring(result.indexOf(",") + 1, result.length());
- }
- return result.toString();
- }
-
- /**
- * 拼接分组字段
- *
- * @param attrs
- * @return
- */
- public static String getSelectHqlGroupColumn(List attrs) {
- StringBuffer result = new StringBuffer();
- BlockReportEnumUtil.HQL_AGGREGATION aggr = null;
- if (attrs != null && attrs.size() > 0) {
- for (BrPojoAttr attr : attrs) {
- result.append("," + attr.getPojoNameAlias() + "." + attr.getAttrName());
- }
- }
- return result.toString();
- }
-
- public static StringBuffer getSelectHqlJoin(List list) {
- StringBuffer hqlJoin = new StringBuffer();
- if (list != null && list.size() > 0) {
- BrRefServerPojo masterPojo = list.get(0);
- BrRefServerPojo pojo;
- BlockReportEnumUtil.HQL_REF refType;
- BlockReportEnumUtil.HQL_WHERE whereType;// 对象连接封装
- hqlJoin.append(" " + masterPojo.getMasterPojoName() + " AS " + masterPojo.getMasterPojoNameAlias());
- for (int i = 1; i < list.size(); i++) {
- pojo = list.get(i);
- refType = BlockReportEnumUtil.HQL_REF.valueOf(pojo.getPojoRefType());
- whereType = BlockReportEnumUtil.HQL_WHERE.valueOf(pojo.getPojoWhereType());
- if (refType != null && whereType != null) {
- hqlJoin.append(" " + refType.getName());
- hqlJoin.append(" " + pojo.getMasterPojoName() + " AS " + pojo.getMasterPojoNameAlias());
- hqlJoin.append(" ON " + pojo.getMasterPojoNameAlias() + "." + pojo.getMasterPojoAttrName());
- hqlJoin.append(" " + whereType.getName() + " " + pojo.getSecondaryPojoNameAlias() + "." + pojo.getSecondaryPojoAttrName());
- } else {
- LOGGER.info("");
- }
- }
- }
- return hqlJoin;
- }
-
- public static String getSelectHqlWhere(List attrs, Map map) {
- StringBuffer hqlWhere = new StringBuffer();
- if (attrs != null && attrs.size() > 0) {
- BlockReportEnumUtil.HQL_WHERE whereType = null;
- for (BrPojoAttr attr : attrs) {
- whereType = BlockReportEnumUtil.HQL_WHERE.valueOf(attr.getAttrRefType());
- if (whereType != null) {
- hqlWhere.append(" AND " + attr.getPojoNameAlias() + "." + attr.getAttrName());
- if (BlockReportEnumUtil.HQL_WHERE.LIKE.equals(whereType)) { // like %%
- hqlWhere.append(" " + whereType.getName() + " :" + attr.getPojoNameAlias() + "_" + attr.getAttrName());
- map.put(attr.getPojoNameAlias() + "_" + attr.getAttrName(), "%" + attr.getAttrDefaultValue() + "%");
- } else if (BlockReportEnumUtil.HQL_WHERE.LIKE_LEFT.equals(whereType)) {
- hqlWhere.append(" " + whereType.getName() + " :" + attr.getPojoNameAlias() + "_" + attr.getAttrName());
- map.put(attr.getPojoNameAlias() + "_" + attr.getAttrName(), "%" + attr.getAttrDefaultValue());
- } else if (BlockReportEnumUtil.HQL_WHERE.LIKE_RIGHT.equals(whereType)) {
- hqlWhere.append(" " + whereType.getName() + " :" + attr.getPojoNameAlias() + "_" + attr.getAttrName());
- map.put(attr.getPojoNameAlias() + "_" + attr.getAttrName(), attr.getAttrDefaultValue() + "%");
- }
- } else {
- LOGGER.info("");
- }
- }
- }
- return hqlWhere.toString();
- }
-
- public static String getSelectHqlWhereCustomHql(List customList) {
- StringBuffer hqlWhere = new StringBuffer();
- if (customList != null && customList.size() > 0) {
- for (BrTemplateCustomHql hql : customList) {
- if(hql.getDataType().intValue() == BlockReportEnumUtil.HQL_ATTR_DATA_TYPE.WHERE.getValue()){
- hqlWhere.append(" " + hql.getCustomContent());
- }
- }
- }
- return hqlWhere.toString();
- }
-
- public static String getSelectHqlWhereGroup(List customList) {
- StringBuffer hql = new StringBuffer();
- if (customList != null && customList.size() > 0) {
- hql.append(" GROUP BY ");
- for (BrPojoAttr attr : customList) {
- hql.append(" " + attr.getPojoNameAlias() + "." + attr.getAttrName());
- }
- }
- return hql.toString();
- }
-
- /**
- * 拼接查询语句
- *
- * @param list
- * @return
- */
- public static TemplateModel getTemplateModel(List list,BrTemplateCustomHql hqlList) {
- if (list != null && list.size() > 0) {
- TemplateModel model = new TemplateModel();
- StringBuffer result = new StringBuffer(); // 查询语句主体
- List attrShowList = new ArrayList<>(); // 查询列的属性
- List attrWhereList = new ArrayList<>(); // 查询列的属性
- List attrGroupList = new ArrayList<>(); // 查询列的属性
- Map paramMap = new HashMap<>();
- List tmpList = null;
-
- // list 先排序下
- list.sort(Comparator.comparing(BrRefServerPojo::getPojoSort));
-
- // 对象属性封装
- for (BrRefServerPojo refServerPojo : list) {
- tmpList = refServerPojo.getPojoAttrList();
- if (tmpList != null && tmpList.size() > 0) {
- for (BrPojoAttr attr : tmpList) {
- if (BlockReportEnumUtil.HQL_ATTR_DATA_TYPE.SHOW.getValue() == attr.getDataType().intValue()
- || BlockReportEnumUtil.HQL_ATTR_DATA_TYPE.AGGREGATION.getValue() == attr.getDataType().intValue()) {
- attrShowList.add(attr);
- } else if (BlockReportEnumUtil.HQL_ATTR_DATA_TYPE.WHERE.getValue() == attr.getDataType().intValue()) {
- attrWhereList.add(attr);
- } else if (BlockReportEnumUtil.HQL_ATTR_DATA_TYPE.GROUP.getValue() == attr.getDataType().intValue()) {
- attrGroupList.add(attr);
- }
- }
- }
- }
- attrShowList.sort(Comparator.comparing(BrPojoAttr::getAttrSort));
- attrGroupList.sort(Comparator.comparing(BrPojoAttr::getAttrSort));
- attrWhereList.sort(Comparator.comparing(BrPojoAttr::getAttrSort));
- // HQL 拼接
-
- result.append(" SELECT ");
- result.append(getSelectHqlColumn(attrShowList));
- result.append(" FROM ");
- result.append(getSelectHqlJoin(list));
- result.append(" WHERE 1=1 ");
- result.append(getSelectHqlWhere(attrWhereList, paramMap));
- result.append(getSelectHqlWhereGroup(attrGroupList));
- if(hqlList != null){
- result.append(getSelectHqlWhereCustomHql(Arrays.asList(hqlList)));
- }
-
- model.setHql(result.toString());
- model.setParamName(paramMap.keySet().stream().toArray(String[]::new));
- model.setParamValue(paramMap.values().stream().toArray(Object[]::new));
-
- return model;
- }
- return null;
- }
-
- public static List