Kaynağa Gözat

优化代码

java110 4 yıl önce
ebeveyn
işleme
b231b8b708

+ 27 - 10
java110-bean/src/main/java/com/java110/dto/reportCustomComponentRel/ReportCustomComponentRelDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.reportCustomComponentRel;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,9 +16,10 @@ import java.util.Date;
 public class ReportCustomComponentRelDto extends PageDto implements Serializable {
 
     private String relId;
-private String componentId;
-private String customId;
-private String seq;
+    private String componentId;
+    private String customId;
+    private String seq;
+    private String componentName;
 
 
     private Date createTime;
@@ -28,25 +30,32 @@ private String seq;
     public String getRelId() {
         return relId;
     }
-public void setRelId(String relId) {
+
+    public void setRelId(String relId) {
         this.relId = relId;
     }
-public String getComponentId() {
+
+    public String getComponentId() {
         return componentId;
     }
-public void setComponentId(String componentId) {
+
+    public void setComponentId(String componentId) {
         this.componentId = componentId;
     }
-public String getCustomId() {
+
+    public String getCustomId() {
         return customId;
     }
-public void setCustomId(String customId) {
+
+    public void setCustomId(String customId) {
         this.customId = customId;
     }
-public String getSeq() {
+
+    public String getSeq() {
         return seq;
     }
-public void setSeq(String seq) {
+
+    public void setSeq(String seq) {
         this.seq = seq;
     }
 
@@ -66,4 +75,12 @@ public void setSeq(String seq) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String getComponentName() {
+        return componentName;
+    }
+
+    public void setComponentName(String componentName) {
+        this.componentName = componentName;
+    }
 }

+ 65 - 68
java110-db/src/main/resources/mapper/report/ReportCustomComponentRelV1ServiceDaoImplMapper.xml

@@ -5,93 +5,90 @@
 <mapper namespace="reportCustomComponentRelV1ServiceDaoImpl">
 
 
-
-
-
     <!-- 保存报表组件关系信息 add by wuxw 2018-07-03 -->
     <insert id="saveReportCustomComponentRelInfo" parameterType="Map">
         insert into report_custom_component_rel(
-rel_id,component_id,custom_id,seq
-) values (
-#{relId},#{componentId},#{customId},#{seq}
-)
+        rel_id,component_id,custom_id,seq
+        ) values (
+        #{relId},#{componentId},#{customId},#{seq}
+        )
     </insert>
 
 
-
     <!-- 查询报表组件关系信息 add by wuxw 2018-07-03 -->
     <select id="getReportCustomComponentRelInfo" parameterType="Map" resultType="Map">
-        select  t.rel_id,t.rel_id relId,t.component_id,t.component_id componentId,t.status_cd,t.status_cd statusCd,t.custom_id,t.custom_id customId,t.seq 
-from report_custom_component_rel t 
-where 1 =1 
-<if test="relId !=null and relId != ''">
-   and t.rel_id= #{relId}
-</if> 
-<if test="componentId !=null and componentId != ''">
-   and t.component_id= #{componentId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="customId !=null and customId != ''">
-   and t.custom_id= #{customId}
-</if> 
-<if test="seq !=null and seq != ''">
-   and t.seq= #{seq}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.rel_id,t.rel_id relId,t.component_id,t.component_id componentId,t.status_cd,t.status_cd
+        statusCd,t.custom_id,t.custom_id customId,t.seq,cc.`name` componentName,t.create_time createTime
+        from report_custom_component_rel t
+        left join report_custom_component cc on t.component_id = cc.component_id and cc.status_cd = '0'
+        where 1 =1
+        <if test="relId !=null and relId != ''">
+            and t.rel_id= #{relId}
+        </if>
+        <if test="componentId !=null and componentId != ''">
+            and t.component_id= #{componentId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="customId !=null and customId != ''">
+            and t.custom_id= #{customId}
+        </if>
+        <if test="seq !=null and seq != ''">
+            and t.seq= #{seq}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改报表组件关系信息 add by wuxw 2018-07-03 -->
     <update id="updateReportCustomComponentRelInfo" parameterType="Map">
-        update  report_custom_component_rel t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="componentId !=null and componentId != ''">
-, t.component_id= #{componentId}
-</if> 
-<if test="customId !=null and customId != ''">
-, t.custom_id= #{customId}
-</if> 
-<if test="seq !=null and seq != ''">
-, t.seq= #{seq}
-</if> 
- where 1=1 <if test="relId !=null and relId != ''">
-and t.rel_id= #{relId}
-</if> 
+        update report_custom_component_rel t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="componentId !=null and componentId != ''">
+            , t.component_id= #{componentId}
+        </if>
+        <if test="customId !=null and customId != ''">
+            , t.custom_id= #{customId}
+        </if>
+        <if test="seq !=null and seq != ''">
+            , t.seq= #{seq}
+        </if>
+        where 1=1
+        <if test="relId !=null and relId != ''">
+            and t.rel_id= #{relId}
+        </if>
 
     </update>
 
     <!-- 查询报表组件关系数量 add by wuxw 2018-07-03 -->
-     <select id="queryReportCustomComponentRelsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from report_custom_component_rel t 
-where 1 =1 
-<if test="relId !=null and relId != ''">
-   and t.rel_id= #{relId}
-</if> 
-<if test="componentId !=null and componentId != ''">
-   and t.component_id= #{componentId}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="customId !=null and customId != ''">
-   and t.custom_id= #{customId}
-</if> 
-<if test="seq !=null and seq != ''">
-   and t.seq= #{seq}
-</if> 
+    <select id="queryReportCustomComponentRelsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from report_custom_component_rel t
+        where 1 =1
+        <if test="relId !=null and relId != ''">
+            and t.rel_id= #{relId}
+        </if>
+        <if test="componentId !=null and componentId != ''">
+            and t.component_id= #{componentId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="customId !=null and customId != ''">
+            and t.custom_id= #{customId}
+        </if>
+        <if test="seq !=null and seq != ''">
+            and t.seq= #{seq}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 11 - 16
java110-generator/src/main/java/com/java110/code/TableToJsonWeb.java

@@ -7,25 +7,20 @@ import com.java110.utils.util.StringUtil;
 public class TableToJsonWeb {
 
     //show create table c_orders  用这个语句获取
-    public static final String createTableSql = "CREATE TABLE `report_custom_component` (\n" +
+    public static final String createTableSql = "CREATE TABLE `report_custom_component_rel` (\n" +
+            "  `rel_id` varchar(30) NOT NULL COMMENT '关系编号',\n" +
             "  `component_id` varchar(30) NOT NULL COMMENT '组件ID',\n" +
-            "  `name` varchar(64) NOT NULL COMMENT '组件名称',\n" +
-            "  `component_group` varchar(12) NOT NULL DEFAULT 'C' COMMENT '组件组',\n" +
-            "  `component_type` varchar(12) NOT NULL COMMENT '组件类型',\n" +
-            "  `query_model` varchar(1) NOT NULL COMMENT '查询方式',\n" +
-            "  `sql` longtext(1024) COMMENT '执行sql',\n" +
-            "  `java_script`  longtext(1024) COMMENT '执行java脚本代码',\n" +
-            "  `remark` varchar(512) DEFAULT NULL COMMENT '描述',\n" +
-            "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间'\n" +
-            ") ";
-
+            "  `custom_id` varchar(30) NOT NULL COMMENT '报表编号',\n" +
+            "  `seq` int(11) NOT NULL COMMENT '组件序号',\n" +
+            "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
+            ")";
     public static void main(String[] args) {
         String templateName = "报表组件"; //业务名称
-        String templateCode = "reportCustomComponent"; //表名大写
-        String templateKey = "componentId"; //表主键
-        String templateKeyName = "组件ID";//主键说明
-        String searchCode = "componentId"; //分片字段
-        String searchName = "组件ID"; //分片字段说明
+        String templateCode = "reportCustomComponentRel"; //表名大写
+        String templateKey = "relId"; //表主键
+        String templateKeyName = "关系编号";//主键说明
+        String searchCode = "relId"; //分片字段
+        String searchName = "关系编号"; //分片字段说明
         String directories = "dev"; //前端生成到那个目录下
         // templateName 业务名称 业务编码名称生成后文件名 templateCode 主键 templateKey
         // 业务主键名称 templateKeyName=templateName+ID 主机驼峰 searchCode 主键名称 searchName

+ 24 - 66
java110-generator/src/main/resources/web/template_1.json

@@ -1,103 +1,61 @@
 {
-  "templateKeyName": "组件ID",
+  "templateKeyName": "关系编号",
   "templateName": "报表组件",
   "columns": [
     {
       "hasDefaultValue": false,
-      "limitParam": "64",
-      "code": "name",
-      "limitErrInfo": "组件名称不能超过64",
-      "cnCode": "组件名称",
+      "limitParam": "30",
+      "code": "componentId",
+      "limitErrInfo": "组件ID不能超过30",
+      "cnCode": "组件ID",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,组件名称"
+      "desc": "必填,组件ID"
     },
     {
       "hasDefaultValue": false,
-      "limitParam": "12",
-      "code": "componentType",
-      "limitErrInfo": "组件类型不能超过12",
-      "cnCode": "组件类型",
+      "limitParam": "30",
+      "code": "customId",
+      "limitErrInfo": "报表编号不能超过30",
+      "cnCode": "报表编号",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,组件类型"
+      "desc": "必填,报表编号"
     },
     {
       "hasDefaultValue": false,
-      "limitParam": "1",
-      "code": "queryModel",
-      "limitErrInfo": "查询方式不能超过1",
-      "cnCode": "查询方式",
+      "limitParam": "11",
+      "code": "seq",
+      "limitErrInfo": "组件序号不能超过11",
+      "cnCode": "组件序号",
       "limit": "maxLength",
       "show": true,
       "inputType": "input",
       "required": true,
-      "desc": "必填,查询方式"
-    },
-    {
-      "hasDefaultValue": false,
-      "limitParam": "1024",
-      "code": "sql",
-      "limitErrInfo": "执行sql不能超过1024",
-      "cnCode": "执行sql",
-      "limit": "maxLength",
-      "show": true,
-      "inputType": "input",
-      "required": false,
-      "desc": "执行sql"
-    },
-    {
-      "hasDefaultValue": false,
-      "limitParam": "1024",
-      "code": "javaScript",
-      "limitErrInfo": "执行java脚本代码不能超过1024",
-      "cnCode": "执行java脚本代码",
-      "limit": "maxLength",
-      "show": true,
-      "inputType": "input",
-      "required": false,
-      "desc": "执行java脚本代码"
-    },
-    {
-      "hasDefaultValue": false,
-      "limitParam": "512",
-      "code": "remark",
-      "limitErrInfo": "描述不能超过512",
-      "cnCode": "描述",
-      "limit": "maxLength",
-      "show": true,
-      "inputType": "input",
-      "required": false,
-      "desc": "描述"
+      "desc": "必填,组件序号"
     }
   ],
-  "searchName": "组件ID",
+  "searchName": "关系编号",
   "directories": "dev",
-  "searchCode": "componentId",
-  "templateCode": "reportCustomComponent",
+  "searchCode": "relId",
+  "templateCode": "reportCustomComponentRel",
   "conditions": [
     {
       "whereCondition": "equal",
-      "code": "componentId",
-      "name": "组件ID",
+      "code": "relId",
+      "name": "关系编号",
       "inputType": "input"
     },
     {
       "whereCondition": "equal",
-      "code": "name",
-      "name": "组件名称",
-      "inputType": "input"
-    },
-    {
-      "whereCondition": "equal",
-      "code": "componentType",
-      "name": "组件类型",
+      "code": "componentId",
+      "name": "组件ID",
       "inputType": "input"
     }
   ],
-  "templateKey": "componentId"
+  "templateKey": "relId"
 }

+ 4 - 5
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentCondition/UpdateReportCustomComponentConditionCmd.java

@@ -21,16 +21,15 @@ import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.AbstractServiceCmdListener;
 import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.intf.report.IReportCustomComponentConditionV1InnerServiceSMO;
 import com.java110.po.reportCustomComponentCondition.ReportCustomComponentConditionPo;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
 
 /**
@@ -46,7 +45,7 @@ import org.slf4j.LoggerFactory;
 @Java110Cmd(serviceCode = "reportCustomComponentCondition.updateReportCustomComponentCondition")
 public class UpdateReportCustomComponentConditionCmd extends AbstractServiceCmdListener {
 
-  private static Logger logger = LoggerFactory.getLogger(UpdateReportCustomComponentConditionCmd.class);
+    private static Logger logger = LoggerFactory.getLogger(UpdateReportCustomComponentConditionCmd.class);
 
 
     @Autowired
@@ -55,7 +54,7 @@ public class UpdateReportCustomComponentConditionCmd extends AbstractServiceCmdL
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "conditionId", "conditionId不能为空");
-Assert.hasKeyAndValue(reqJson, "conditionId", "conditionId不能为空");
+        Assert.hasKeyAndValue(reqJson, "conditionId", "conditionId不能为空");
 
     }
 
@@ -63,7 +62,7 @@ Assert.hasKeyAndValue(reqJson, "conditionId", "conditionId不能为空");
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-       ReportCustomComponentConditionPo reportCustomComponentConditionPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentConditionPo.class);
+        ReportCustomComponentConditionPo reportCustomComponentConditionPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentConditionPo.class);
         int flag = reportCustomComponentConditionV1InnerServiceSMOImpl.updateReportCustomComponentCondition(reportCustomComponentConditionPo);
 
         if (flag < 1) {

+ 4 - 4
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentRel/SaveReportCustomComponentRelCmd.java

@@ -28,9 +28,9 @@ import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 
 /**
  * 类表述:保存
@@ -55,8 +55,8 @@ public class SaveReportCustomComponentRelCmd extends AbstractServiceCmdListener
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "componentId", "请求报文中未包含componentId");
-Assert.hasKeyAndValue(reqJson, "customId", "请求报文中未包含customId");
-Assert.hasKeyAndValue(reqJson, "seq", "请求报文中未包含seq");
+        Assert.hasKeyAndValue(reqJson, "customId", "请求报文中未包含customId");
+        Assert.hasKeyAndValue(reqJson, "seq", "请求报文中未包含seq");
 
     }
 
@@ -64,7 +64,7 @@ Assert.hasKeyAndValue(reqJson, "seq", "请求报文中未包含seq");
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-       ReportCustomComponentRelPo reportCustomComponentRelPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentRelPo.class);
+        ReportCustomComponentRelPo reportCustomComponentRelPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentRelPo.class);
         reportCustomComponentRelPo.setRelId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
         int flag = reportCustomComponentRelV1InnerServiceSMOImpl.saveReportCustomComponentRel(reportCustomComponentRelPo);