java110
2021-11-14 257d26ec3d166b181e7e937a21fa65c704e6f3f4
优化代码
2个文件已修改
9个文件已添加
892 ■■■■■ 已修改文件
java110-db/src/main/resources/mapper/report/ReportCustomComponentFooterV1ServiceDaoImplMapper.xml 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-generator/src/main/java/com/java110/code/TableToJson.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-generator/src/main/resources/newBack/template_1.json 72 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/intf/report/IReportCustomComponentFooterV1InnerServiceSMO.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentFooter/DeleteReportCustomComponentFooterCmd.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentFooter/ListReportCustomComponentFooterCmd.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentFooter/SaveReportCustomComponentFooterCmd.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentFooter/UpdateReportCustomComponentFooterCmd.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/dao/IReportCustomComponentFooterV1ServiceDao.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/dao/impl/ReportCustomComponentFooterV1ServiceDaoImpl.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-report/src/main/java/com/java110/report/smo/impl/ReportCustomComponentFooterV1InnerServiceSMOImpl.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/report/ReportCustomComponentFooterV1ServiceDaoImplMapper.xml
New file
@@ -0,0 +1,124 @@
<?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="reportCustomComponentFooterV1ServiceDaoImpl">
    <!-- 保存底部统计信息 add by wuxw 2018-07-03 -->
    <insert id="saveReportCustomComponentFooterInfo" parameterType="Map">
        insert into report_custom_component_footer(
footer_id,component_id,java_script,name,remark,query_model,component_sql
) values (
#{footerId},#{componentId},#{javaScript},#{name},#{remark},#{queryModel},#{componentSql}
)
    </insert>
    <!-- 查询底部统计信息 add by wuxw 2018-07-03 -->
    <select id="getReportCustomComponentFooterInfo" parameterType="Map" resultType="Map">
        select  t.footer_id,t.footer_id footerId,t.component_id,t.component_id componentId,t.java_script,t.java_script javaScript,t.name,t.remark,t.status_cd,t.status_cd statusCd,t.query_model,t.query_model queryModel,t.component_sql,t.component_sql componentSql
from report_custom_component_footer t
where 1 =1
<if test="footerId !=null and footerId != ''">
   and t.footer_id= #{footerId}
</if>
<if test="componentId !=null and componentId != ''">
   and t.component_id= #{componentId}
</if>
<if test="javaScript !=null and javaScript != ''">
   and t.java_script= #{javaScript}
</if>
<if test="name !=null and name != ''">
   and t.name= #{name}
</if>
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="queryModel !=null and queryModel != ''">
   and t.query_model= #{queryModel}
</if>
<if test="componentSql !=null and componentSql != ''">
   and t.component_sql= #{componentSql}
</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="updateReportCustomComponentFooterInfo" parameterType="Map">
        update  report_custom_component_footer 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="javaScript !=null and javaScript != ''">
, t.java_script= #{javaScript}
</if>
<if test="name !=null and name != ''">
, t.name= #{name}
</if>
<if test="remark !=null and remark != ''">
, t.remark= #{remark}
</if>
<if test="queryModel !=null and queryModel != ''">
, t.query_model= #{queryModel}
</if>
<if test="componentSql !=null and componentSql != ''">
, t.component_sql= #{componentSql}
</if>
 where 1=1 <if test="footerId !=null and footerId != ''">
and t.footer_id= #{footerId}
</if>
    </update>
    <!-- 查询底部统计数量 add by wuxw 2018-07-03 -->
     <select id="queryReportCustomComponentFootersCount" parameterType="Map" resultType="Map">
        select  count(1) count
from report_custom_component_footer t
where 1 =1
<if test="footerId !=null and footerId != ''">
   and t.footer_id= #{footerId}
</if>
<if test="componentId !=null and componentId != ''">
   and t.component_id= #{componentId}
</if>
<if test="javaScript !=null and javaScript != ''">
   and t.java_script= #{javaScript}
</if>
<if test="name !=null and name != ''">
   and t.name= #{name}
</if>
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="queryModel !=null and queryModel != ''">
   and t.query_model= #{queryModel}
</if>
<if test="componentSql !=null and componentSql != ''">
   and t.component_sql= #{componentSql}
</if>
     </select>
</mapper>
java110-generator/src/main/java/com/java110/code/TableToJson.java
@@ -7,38 +7,25 @@
public class TableToJson {
    //show create table c_orders  用这个语句获取
    public static final String createTableSql = "CREATE TABLE `machine` (\n" +
            "  `machine_id` varchar(30) NOT NULL COMMENT '设备ID',\n" +
            "  `b_id` varchar(30) NOT NULL COMMENT '业务Id',\n" +
            "  `machine_code` varchar(30) NOT NULL COMMENT '设备编码',\n" +
            "  `machine_version` varchar(30) NOT NULL COMMENT '设备版本',\n" +
            "  `machine_type_cd` varchar(30) NOT NULL COMMENT '设备类型 门禁9999 详情查看t_dict 表',\n" +
            "  `community_id` varchar(30) NOT NULL COMMENT '小区ID',\n" +
            "  `machine_name` varchar(200) NOT NULL COMMENT '设备名称',\n" +
            "  `auth_code` varchar(64) NOT NULL COMMENT '授权码',\n" +
            "  `machine_ip` varchar(64) DEFAULT NULL COMMENT '设备IP',\n" +
            "  `machine_mac` varchar(64) DEFAULT NULL COMMENT '设备mac',\n" +
    public static final String createTableSql = "CREATE TABLE `report_custom_component_footer` (\n" +
            "  `footer_id` varchar(30) NOT NULL COMMENT '报表底部同步ID',\n" +
            "  `component_id` varchar(30) NOT NULL COMMENT '组件ID',\n" +
            "  `name` varchar(64) NOT NULL COMMENT '名称',\n" +
            "  `query_model` varchar(1) NOT NULL COMMENT '查询方式 1、sql,2、java',\n" +
            "  `java_script` longtext(1024) COMMENT '执行java脚本代码',\n" +
            "  `component_sql` longtext(1024) COMMENT '执行sql',\n" +
            "  `remark` varchar(512) DEFAULT NULL COMMENT '描述',\n" +
            "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',\n" +
            "  `location_type_cd` varchar(30) NOT NULL COMMENT '位置ID,请查看 community_location',\n" +
            "  `location_obj_id` varchar(30) NOT NULL DEFAULT '-1' COMMENT '对象ID,大门时小区ID,单元门 时单元ID 房屋时房屋ID',\n" +
            "  `state` varchar(12) NOT NULL DEFAULT '1000' COMMENT '设备状态,设备配置同步状态 1000 未同步 1100 同步中 1200 已同步',\n" +
            "  `direction` varchar(12) NOT NULL DEFAULT '3306' COMMENT '设备方向进出,3306 进 3307 出',\n" +
            "  `heartbeat_time` datetime NOT NULL COMMENT '设备心跳时间',\n" +
            "  `type_id` varchar(30) NOT NULL COMMENT '设备类型ID',\n" +
            "  UNIQUE KEY `machine_id` (`machine_id`) USING BTREE,\n" +
            "  KEY `idx_machine_id` (`machine_id`) USING BTREE,\n" +
            "  KEY `idx_machine_b_id` (`b_id`) USING BTREE,\n" +
            "  KEY `i_m_community_id` (`community_id`)\n" +
            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效'\n" +
            ")";
    public static void main(String[] args) {
        String desc = "设备信息";
        String id = "machineId";
        String name = "machine";
        String shareName = "common"; //生成到那个服务下
        String shareColumn = "community_id";
        String shareParam = "communityId";
        String desc = "底部统计";
        String id = "footerId";
        String name = "reportCustomComponentFooter";
        String shareName = "report"; //生成到那个服务下
        String shareColumn = "footer_id";
        String shareParam = "footerId";
        //业务名称 desc 业务编码名称生成后类名 name 主键 id  需要放到那个服务 shareName
        String newSql = createTableSql.substring(createTableSql.indexOf("(") + 1, createTableSql.lastIndexOf(")"));
        String tableName = createTableSql.substring(createTableSql.indexOf("TABLE") + 5, createTableSql.indexOf("("));
java110-generator/src/main/resources/newBack/template_1.json
@@ -1,66 +1,34 @@
{
  "param": {
    "heartbeatTime": "heartbeat_time",
    "machineCode": "machine_code",
    "authCode": "auth_code",
    "locationTypeCd": "location_type_cd",
    "machineVersion": "machine_version",
    "footerId": "footer_id",
    "componentId": "component_id",
    "javaScript": "java_script",
    "name": "name",
    "remark": "remark",
    "statusCd": "status_cd",
    "machineName": "machine_name",
    "machineMac": "machine_mac",
    "machineId": "machine_id",
    "typeId": "type_id",
    "state": "state",
    "communityId": "community_id",
    "locationObjId": "location_obj_id",
    "machineTypeCd": "machine_type_cd",
    "machineIp": "machine_ip",
    "direction": "direction"
    "queryModel": "query_model",
    "componentSql": "component_sql"
  },
  "name": "machine",
  "shareColumn": "community_id",
  "id": "machineId",
  "shareName": "common",
  "name": "reportCustomComponentFooter",
  "shareColumn": "footer_id",
  "id": "footerId",
  "shareName": "report",
  "autoMove": true,
  "required": [
    {
      "msg": "设备ID不能为空",
      "code": "machineId"
      "msg": "报表底部同步ID不能为空",
      "code": "footerId"
    },
    {
      "msg": "设备编码不能为空",
      "code": "machineCode"
      "msg": "组件ID不能为空",
      "code": "componentId"
    },
    {
      "msg": "设备版本不能为空",
      "code": "machineVersion"
    },
    {
      "msg": "设备类型不能为空",
      "code": "machineTypeCd"
    },
    {
      "msg": "小区ID不能为空",
      "code": "communityId"
    },
    {
      "msg": "设备名称不能为空",
      "code": "machineName"
    },
    {
      "msg": "授权码不能为空",
      "code": "authCode"
    },
    {
      "msg": "设备方向进出不能为空",
      "code": "direction"
    },
    {
      "msg": "设备类型ID不能为空",
      "code": "typeId"
      "msg": "名称不能为空",
      "code": "name"
    }
  ],
  "desc": "设备信息",
  "shareParam": "communityId",
  "tableName": "machine"
  "desc": "底部统计",
  "shareParam": "footerId",
  "tableName": "report_custom_component_footer"
}
java110-interface/src/main/java/com/java110/intf/report/IReportCustomComponentFooterV1InnerServiceSMO.java
New file
@@ -0,0 +1,68 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.intf.report;
import com.java110.config.feign.FeignConfiguration;
import com.java110.dto.reportCustomComponentFooter.ReportCustomComponentFooterDto;
import com.java110.po.reportCustomComponentFooter.ReportCustomComponentFooterPo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.List;
/**
 * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用
 * add by 吴学文 at 2021-11-14 01:21:59 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@FeignClient(name = "report-service", configuration = {FeignConfiguration.class})
@RequestMapping("/reportCustomComponentFooterV1Api")
public interface IReportCustomComponentFooterV1InnerServiceSMO {
    @RequestMapping(value = "/saveReportCustomComponentFooter", method = RequestMethod.POST)
    public int saveReportCustomComponentFooter(@RequestBody  ReportCustomComponentFooterPo reportCustomComponentFooterPo);
    @RequestMapping(value = "/updateReportCustomComponentFooter", method = RequestMethod.POST)
    public int updateReportCustomComponentFooter(@RequestBody  ReportCustomComponentFooterPo reportCustomComponentFooterPo);
    @RequestMapping(value = "/deleteReportCustomComponentFooter", method = RequestMethod.POST)
    public int deleteReportCustomComponentFooter(@RequestBody  ReportCustomComponentFooterPo reportCustomComponentFooterPo);
    /**
     * <p>查询小区楼信息</p>
     *
     *
     * @param reportCustomComponentFooterDto 数据对象分享
     * @return ReportCustomComponentFooterDto 对象数据
     */
    @RequestMapping(value = "/queryReportCustomComponentFooters", method = RequestMethod.POST)
    List<ReportCustomComponentFooterDto> queryReportCustomComponentFooters(@RequestBody ReportCustomComponentFooterDto reportCustomComponentFooterDto);
    /**
     * 查询<p>小区楼</p>总记录数
     *
     * @param reportCustomComponentFooterDto 数据对象分享
     * @return 小区下的小区楼记录数
     */
    @RequestMapping(value = "/queryReportCustomComponentFootersCount", method = RequestMethod.POST)
    int queryReportCustomComponentFootersCount(@RequestBody ReportCustomComponentFooterDto reportCustomComponentFooterDto);
}
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentFooter/DeleteReportCustomComponentFooterCmd.java
New file
@@ -0,0 +1,71 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.report.cmd.reportCustomComponentFooter;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
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.IReportCustomComponentFooterV1InnerServiceSMO;
import com.java110.po.reportCustomComponentFooter.ReportCustomComponentFooterPo;
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;
/**
 * 类表述:删除
 * 服务编码:reportCustomComponentFooter.deleteReportCustomComponentFooter
 * 请求路劲:/app/reportCustomComponentFooter.DeleteReportCustomComponentFooter
 * add by 吴学文 at 2021-11-14 01:21:59 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@Java110Cmd(serviceCode = "reportCustomComponentFooter.deleteReportCustomComponentFooter")
public class DeleteReportCustomComponentFooterCmd extends AbstractServiceCmdListener {
  private static Logger logger = LoggerFactory.getLogger(DeleteReportCustomComponentFooterCmd.class);
    @Autowired
    private IReportCustomComponentFooterV1InnerServiceSMO reportCustomComponentFooterV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "footerId", "footerId不能为空");
Assert.hasKeyAndValue(reqJson, "footerId", "footerId不能为空");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
       ReportCustomComponentFooterPo reportCustomComponentFooterPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentFooterPo.class);
        int flag = reportCustomComponentFooterV1InnerServiceSMOImpl.deleteReportCustomComponentFooter(reportCustomComponentFooterPo);
        if (flag < 1) {
            throw new CmdException("删除数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentFooter/ListReportCustomComponentFooterCmd.java
New file
@@ -0,0 +1,84 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.report.cmd.reportCustomComponentFooter;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
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.IReportCustomComponentFooterV1InnerServiceSMO;
import com.java110.po.reportCustomComponentFooter.ReportCustomComponentFooterPo;
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 com.java110.dto.reportCustomComponentFooter.ReportCustomComponentFooterDto;
import java.util.List;
import java.util.ArrayList;
import org.springframework.http.ResponseEntity;
import org.springframework.http.HttpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 * 类表述:查询
 * 服务编码:reportCustomComponentFooter.listReportCustomComponentFooter
 * 请求路劲:/app/reportCustomComponentFooter.ListReportCustomComponentFooter
 * add by 吴学文 at 2021-11-14 01:21:59 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@Java110Cmd(serviceCode = "reportCustomComponentFooter.listReportCustomComponentFooter")
public class ListReportCustomComponentFooterCmd extends AbstractServiceCmdListener {
  private static Logger logger = LoggerFactory.getLogger(ListReportCustomComponentFooterCmd.class);
    @Autowired
    private IReportCustomComponentFooterV1InnerServiceSMO reportCustomComponentFooterV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        super.validatePageInfo(reqJson);
    }
    @Override
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
           ReportCustomComponentFooterDto reportCustomComponentFooterDto = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentFooterDto.class);
           int count = reportCustomComponentFooterV1InnerServiceSMOImpl.queryReportCustomComponentFootersCount(reportCustomComponentFooterDto);
           List<ReportCustomComponentFooterDto> reportCustomComponentFooterDtos = null;
           if (count > 0) {
               reportCustomComponentFooterDtos = reportCustomComponentFooterV1InnerServiceSMOImpl.queryReportCustomComponentFooters(reportCustomComponentFooterDto);
           } else {
               reportCustomComponentFooterDtos = new ArrayList<>();
           }
           ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, reportCustomComponentFooterDtos);
           ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
           cmdDataFlowContext.setResponseEntity(responseEntity);
    }
}
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentFooter/SaveReportCustomComponentFooterCmd.java
New file
@@ -0,0 +1,77 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.report.cmd.reportCustomComponentFooter;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
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.IReportCustomComponentFooterV1InnerServiceSMO;
import com.java110.po.reportCustomComponentFooter.ReportCustomComponentFooterPo;
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;
/**
 * 类表述:保存
 * 服务编码:reportCustomComponentFooter.saveReportCustomComponentFooter
 * 请求路劲:/app/reportCustomComponentFooter.SaveReportCustomComponentFooter
 * add by 吴学文 at 2021-11-14 01:21:59 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@Java110Cmd(serviceCode = "reportCustomComponentFooter.saveReportCustomComponentFooter")
public class SaveReportCustomComponentFooterCmd extends AbstractServiceCmdListener {
    private static Logger logger = LoggerFactory.getLogger(SaveReportCustomComponentFooterCmd.class);
    public static final String CODE_PREFIX_ID = "10";
    @Autowired
    private IReportCustomComponentFooterV1InnerServiceSMO reportCustomComponentFooterV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "footerId", "请求报文中未包含footerId");
Assert.hasKeyAndValue(reqJson, "componentId", "请求报文中未包含componentId");
Assert.hasKeyAndValue(reqJson, "name", "请求报文中未包含name");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
       ReportCustomComponentFooterPo reportCustomComponentFooterPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentFooterPo.class);
        reportCustomComponentFooterPo.setFooterId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
        int flag = reportCustomComponentFooterV1InnerServiceSMOImpl.saveReportCustomComponentFooter(reportCustomComponentFooterPo);
        if (flag < 1) {
            throw new CmdException("保存数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-report/src/main/java/com/java110/report/cmd/reportCustomComponentFooter/UpdateReportCustomComponentFooterCmd.java
New file
@@ -0,0 +1,75 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.report.cmd.reportCustomComponentFooter;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Cmd;
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.IReportCustomComponentFooterV1InnerServiceSMO;
import com.java110.po.reportCustomComponentFooter.ReportCustomComponentFooterPo;
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;
/**
 * 类表述:更新
 * 服务编码:reportCustomComponentFooter.updateReportCustomComponentFooter
 * 请求路劲:/app/reportCustomComponentFooter.UpdateReportCustomComponentFooter
 * add by 吴学文 at 2021-11-14 01:21:59 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@Java110Cmd(serviceCode = "reportCustomComponentFooter.updateReportCustomComponentFooter")
public class UpdateReportCustomComponentFooterCmd extends AbstractServiceCmdListener {
  private static Logger logger = LoggerFactory.getLogger(UpdateReportCustomComponentFooterCmd.class);
    @Autowired
    private IReportCustomComponentFooterV1InnerServiceSMO reportCustomComponentFooterV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "footerId", "footerId不能为空");
Assert.hasKeyAndValue(reqJson, "footerId", "footerId不能为空");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
       ReportCustomComponentFooterPo reportCustomComponentFooterPo = BeanConvertUtil.covertBean(reqJson, ReportCustomComponentFooterPo.class);
        int flag = reportCustomComponentFooterV1InnerServiceSMOImpl.updateReportCustomComponentFooter(reportCustomComponentFooterPo);
        if (flag < 1) {
            throw new CmdException("更新数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-report/src/main/java/com/java110/report/dao/IReportCustomComponentFooterV1ServiceDao.java
New file
@@ -0,0 +1,77 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.report.dao;
import com.java110.utils.exception.DAOException;
import com.java110.entity.merchant.BoMerchant;
import com.java110.entity.merchant.BoMerchantAttr;
import com.java110.entity.merchant.Merchant;
import com.java110.entity.merchant.MerchantAttr;
import java.util.List;
import java.util.Map;
/**
 * 类表述:
 * add by 吴学文 at 2021-11-14 01:21:59 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
public interface IReportCustomComponentFooterV1ServiceDao {
    /**
     * 保存 底部统计信息
     * @param info
     * @throws DAOException DAO异常
     */
    int saveReportCustomComponentFooterInfo(Map info) throws DAOException;
    /**
     * 查询底部统计信息(instance过程)
     * 根据bId 查询底部统计信息
     * @param info bId 信息
     * @return 底部统计信息
     * @throws DAOException DAO异常
     */
    List<Map> getReportCustomComponentFooterInfo(Map info) throws DAOException;
    /**
     * 修改底部统计信息
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
    int updateReportCustomComponentFooterInfo(Map info) throws DAOException;
    /**
     * 查询底部统计总数
     *
     * @param info 底部统计信息
     * @return 底部统计数量
     */
    int queryReportCustomComponentFootersCount(Map info);
}
service-report/src/main/java/com/java110/report/dao/impl/ReportCustomComponentFooterV1ServiceDaoImpl.java
New file
@@ -0,0 +1,112 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.report.dao.impl;
import com.alibaba.fastjson.JSONObject;
import com.java110.utils.constant.ResponseConstant;
import com.java110.utils.exception.DAOException;
import com.java110.utils.util.DateUtil;
import com.java110.core.base.dao.BaseServiceDao;
import com.java110.report.dao.IReportCustomComponentFooterV1ServiceDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
/**
 * 类表述:
 * add by 吴学文 at 2021-11-14 01:21:59 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@Service("reportCustomComponentFooterV1ServiceDaoImpl")
public class ReportCustomComponentFooterV1ServiceDaoImpl extends BaseServiceDao implements IReportCustomComponentFooterV1ServiceDao {
    private static Logger logger = LoggerFactory.getLogger(ReportCustomComponentFooterV1ServiceDaoImpl.class);
    /**
     * 保存底部统计信息 到 instance
     * @param info   bId 信息
     * @throws DAOException DAO异常
     */
    @Override
    public int saveReportCustomComponentFooterInfo(Map info) throws DAOException {
        logger.debug("保存 saveReportCustomComponentFooterInfo 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("reportCustomComponentFooterV1ServiceDaoImpl.saveReportCustomComponentFooterInfo",info);
        return saveFlag;
    }
    /**
     * 查询底部统计信息(instance)
     * @param info bId 信息
     * @return List<Map>
     * @throws DAOException DAO异常
     */
    @Override
    public List<Map> getReportCustomComponentFooterInfo(Map info) throws DAOException {
        logger.debug("查询 getReportCustomComponentFooterInfo 入参 info : {}",info);
        List<Map> businessReportCustomComponentFooterInfos = sqlSessionTemplate.selectList("reportCustomComponentFooterV1ServiceDaoImpl.getReportCustomComponentFooterInfo",info);
        return businessReportCustomComponentFooterInfos;
    }
    /**
     * 修改底部统计信息
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
    @Override
    public int updateReportCustomComponentFooterInfo(Map info) throws DAOException {
        logger.debug("修改 updateReportCustomComponentFooterInfo 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("reportCustomComponentFooterV1ServiceDaoImpl.updateReportCustomComponentFooterInfo",info);
        return saveFlag;
    }
     /**
     * 查询底部统计数量
     * @param info 底部统计信息
     * @return 底部统计数量
     */
    @Override
    public int queryReportCustomComponentFootersCount(Map info) {
        logger.debug("查询 queryReportCustomComponentFootersCount 入参 info : {}",info);
        List<Map> businessReportCustomComponentFooterInfos = sqlSessionTemplate.selectList("reportCustomComponentFooterV1ServiceDaoImpl.queryReportCustomComponentFootersCount", info);
        if (businessReportCustomComponentFooterInfos.size() < 1) {
            return 0;
        }
        return Integer.parseInt(businessReportCustomComponentFooterInfos.get(0).get("count").toString());
    }
}
service-report/src/main/java/com/java110/report/smo/impl/ReportCustomComponentFooterV1InnerServiceSMOImpl.java
New file
@@ -0,0 +1,89 @@
/*
 * Copyright 2017-2020 吴学文 and java110 team.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.java110.report.smo.impl;
import com.java110.report.dao.IReportCustomComponentFooterV1ServiceDao;
import com.java110.intf.report.IReportCustomComponentFooterV1InnerServiceSMO;
import com.java110.dto.reportCustomComponentFooter.ReportCustomComponentFooterDto;
import com.java110.po.reportCustomComponentFooter.ReportCustomComponentFooterPo;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.dto.user.UserDto;
import com.java110.dto.PageDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
 * add by 吴学文 at 2021-11-14 01:21:59 mail: 928255095@qq.com
 * open source address: https://gitee.com/wuxw7/MicroCommunity
 * 官网:http://www.homecommunity.cn
 * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
 * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
 */
@RestController
public class ReportCustomComponentFooterV1InnerServiceSMOImpl extends BaseServiceSMO implements IReportCustomComponentFooterV1InnerServiceSMO {
    @Autowired
    private IReportCustomComponentFooterV1ServiceDao reportCustomComponentFooterV1ServiceDaoImpl;
    @Override
    public int saveReportCustomComponentFooter(@RequestBody  ReportCustomComponentFooterPo reportCustomComponentFooterPo) {
        int saveFlag = reportCustomComponentFooterV1ServiceDaoImpl.saveReportCustomComponentFooterInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentFooterPo));
        return saveFlag;
    }
     @Override
    public int updateReportCustomComponentFooter(@RequestBody  ReportCustomComponentFooterPo reportCustomComponentFooterPo) {
        int saveFlag = reportCustomComponentFooterV1ServiceDaoImpl.updateReportCustomComponentFooterInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentFooterPo));
        return saveFlag;
    }
     @Override
    public int deleteReportCustomComponentFooter(@RequestBody  ReportCustomComponentFooterPo reportCustomComponentFooterPo) {
       reportCustomComponentFooterPo.setStatusCd("1");
       int saveFlag = reportCustomComponentFooterV1ServiceDaoImpl.updateReportCustomComponentFooterInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentFooterPo));
       return saveFlag;
    }
    @Override
    public List<ReportCustomComponentFooterDto> queryReportCustomComponentFooters(@RequestBody  ReportCustomComponentFooterDto reportCustomComponentFooterDto) {
        //校验是否传了 分页信息
        int page = reportCustomComponentFooterDto.getPage();
        if (page != PageDto.DEFAULT_PAGE) {
            reportCustomComponentFooterDto.setPage((page - 1) * reportCustomComponentFooterDto.getRow());
        }
        List<ReportCustomComponentFooterDto> reportCustomComponentFooters = BeanConvertUtil.covertBeanList(reportCustomComponentFooterV1ServiceDaoImpl.getReportCustomComponentFooterInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentFooterDto)), ReportCustomComponentFooterDto.class);
        return reportCustomComponentFooters;
    }
    @Override
    public int queryReportCustomComponentFootersCount(@RequestBody ReportCustomComponentFooterDto reportCustomComponentFooterDto) {
        return reportCustomComponentFooterV1ServiceDaoImpl.queryReportCustomComponentFootersCount(BeanConvertUtil.beanCovertMap(reportCustomComponentFooterDto));    }
}