1098226878
2021-10-15 22a4aed4abbdccf9835fc3027b1a1b4eb8febbea
添加设备类型
4个文件已修改
11个文件已添加
1052 ■■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/machineType/MachineTypeDto.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/po/machineType/MachineTypePo.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/common/MachineTypeV1ServiceDaoImplMapper.xml 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-generator/src/main/java/com/java110/code/TableToJson.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-generator/src/main/java/com/java110/code/TableToJsonWeb.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-generator/src/main/resources/newBack/template_1.json 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-generator/src/main/resources/web/template_1.json 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-interface/src/main/java/com/java110/intf/common/IMachineTypeV1InnerServiceSMO.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/machineType/DeleteMachineTypeCmd.java 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/machineType/ListMachineTypeCmd.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/machineType/SaveMachineTypeCmd.java 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/cmd/machineType/UpdateMachineTypeCmd.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/dao/IMachineTypeV1ServiceDao.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/dao/impl/MachineTypeV1ServiceDaoImpl.java 112 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-common/src/main/java/com/java110/common/smo/impl/MachineTypeV1InnerServiceSMOImpl.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/machineType/MachineTypeDto.java
New file
@@ -0,0 +1,71 @@
package com.java110.dto.machineType;
import com.java110.dto.PageDto;
import java.io.Serializable;
import java.util.Date;
/**
 * @ClassName FloorDto
 * @Description 设备类型数据层封装
 * @Author wuxw
 * @Date 2019/4/24 8:52
 * @Version 1.0
 * add by wuxw 2019/4/24
 **/
public class MachineTypeDto extends PageDto implements Serializable {
    private String machineTypeName;
private String typeId;
private String machineTypeCd;
private String communityId;
    private Date createTime;
    private String statusCd = "0";
    public String getMachineTypeName() {
        return machineTypeName;
    }
public void setMachineTypeName(String machineTypeName) {
        this.machineTypeName = machineTypeName;
    }
public String getTypeId() {
        return typeId;
    }
public void setTypeId(String typeId) {
        this.typeId = typeId;
    }
public String getMachineTypeCd() {
        return machineTypeCd;
    }
public void setMachineTypeCd(String machineTypeCd) {
        this.machineTypeCd = machineTypeCd;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getStatusCd() {
        return statusCd;
    }
    public void setStatusCd(String statusCd) {
        this.statusCd = statusCd;
    }
    public String getCommunityId() {
        return communityId;
    }
    public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }
}
java110-bean/src/main/java/com/java110/po/machineType/MachineTypePo.java
New file
@@ -0,0 +1,67 @@
/*
 * 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.po.machineType;
import java.io.Serializable;
import java.util.Date;
/**
 * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
 * add by 吴学文 at 2021-10-15 12:38:42 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 class MachineTypePo implements Serializable {
    private String machineTypeName;
private String typeId;
private String statusCd = "0";
private String machineTypeCd;
private String communityId;
public String getMachineTypeName() {
        return machineTypeName;
    }
public void setMachineTypeName(String machineTypeName) {
        this.machineTypeName = machineTypeName;
    }
public String getTypeId() {
        return typeId;
    }
public void setTypeId(String typeId) {
        this.typeId = typeId;
    }
public String getStatusCd() {
        return statusCd;
    }
public void setStatusCd(String statusCd) {
        this.statusCd = statusCd;
    }
public String getMachineTypeCd() {
        return machineTypeCd;
    }
public void setMachineTypeCd(String machineTypeCd) {
        this.machineTypeCd = machineTypeCd;
    }
    public String getCommunityId() {
        return communityId;
    }
    public void setCommunityId(String communityId) {
        this.communityId = communityId;
    }
}
java110-db/src/main/resources/mapper/common/MachineTypeV1ServiceDaoImplMapper.xml
New file
@@ -0,0 +1,93 @@
<?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="machineTypeV1ServiceDaoImpl">
    <!-- 保存设备类型信息 add by wuxw 2018-07-03 -->
    <insert id="saveMachineTypeInfo" parameterType="Map">
        insert into machine_type(
        machine_type_name,type_id,machine_type_cd,community_id
        ) values (
        #{machineTypeName},#{typeId},#{machineTypeCd},#{communityId}
        )
    </insert>
    <!-- 查询设备类型信息 add by wuxw 2018-07-03 -->
    <select id="getMachineTypeInfo" parameterType="Map" resultType="Map">
        select t.machine_type_name,t.machine_type_name machineTypeName,t.type_id,t.type_id
        typeId,t.status_cd,t.status_cd statusCd,t.machine_type_cd,t.machine_type_cd machineTypeCd,t.community_id communityId
        from machine_type t
        where 1 =1
        <if test="machineTypeName !=null and machineTypeName != ''">
            and t.machine_type_name= #{machineTypeName}
        </if>
        <if test="typeId !=null and typeId != ''">
            and t.type_id= #{typeId}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="machineTypeCd !=null and machineTypeCd != ''">
            and t.machine_type_cd= #{machineTypeCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </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="updateMachineTypeInfo" parameterType="Map">
        update machine_type t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="machineTypeName !=null and machineTypeName != ''">
            , t.machine_type_name= #{machineTypeName}
        </if>
        <if test="machineTypeCd !=null and machineTypeCd != ''">
            , t.machine_type_cd= #{machineTypeCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        where 1=1
        <if test="typeId !=null and typeId != ''">
            and t.type_id= #{typeId}
        </if>
    </update>
    <!-- 查询设备类型数量 add by wuxw 2018-07-03 -->
    <select id="queryMachineTypesCount" parameterType="Map" resultType="Map">
        select count(1) count
        from machine_type t
        where 1 =1
        <if test="machineTypeName !=null and machineTypeName != ''">
            and t.machine_type_name= #{machineTypeName}
        </if>
        <if test="typeId !=null and typeId != ''">
            and t.type_id= #{typeId}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="machineTypeCd !=null and machineTypeCd != ''">
            and t.machine_type_cd= #{machineTypeCd}
        </if>
    </select>
</mapper>
java110-generator/src/main/java/com/java110/code/TableToJson.java
@@ -7,17 +7,22 @@
public class TableToJson {
    //show create table c_orders  用这个语句获取
    public static final String createTableSql = "create table community_setting_key(\n" +
            "  key_id varchar(30) not null PRIMARY key comment '编号',\n" +
            "  `setting_type` varchar(30) NOT NULL COMMENT '设置类型',\n" +
            "  `setting_name` varchar(64) NOT NULL COMMENT '名称',\n" +
            "  `setting_key` varchar(30) NOT NULL COMMENT '设置key',\n" +
            "  `remark` varchar(512) DEFAULT NULL COMMENT '备注信息',\n" +
    public static final String createTableSql = "CREATE TABLE `machine_type` (\n" +
            "  `type_id` varchar(30) NOT NULL COMMENT '设备类型ID',\n" +
            "  `machine_type_cd` varchar(30) NOT NULL COMMENT '设备大类 详情看t_dict',\n" +
            "  `machine_type_name` varchar(30) NOT NULL COMMENT '设备类型名称',\n" +
            "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态0正常1失效'\n" +
            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',\n" +
            "  KEY `idx_bm_machine_id` (`type_id`) USING BTREE\n" +
            ")";
    public static void main(String[] args) {
        String desc = "老人类型";
        String id = "typeId";
        String name = "govOldPersonType";
        String shareName = "cust"; //生成到那个服务下
        String shareColumn = "ca_id";
        String shareParam = "caId";
        //业务名称 desc 业务编码名称生成后类名 name 主键 id  需要放到那个服务 shareName
        String newSql = createTableSql.substring(createTableSql.indexOf("(") + 1, createTableSql.lastIndexOf(")"));
@@ -27,12 +32,12 @@
        String[] rowSqls = newSql.split("',");
        JSONObject param = new JSONObject();
        param.put("autoMove", true);
        param.put("desc", "小区配置");
        param.put("id", "keyId");
        param.put("name", "communitySettingKey");
        param.put("shareColumn", "key_id");
        param.put("shareName", "community");
        param.put("shareParam", "keyId");
        param.put("desc", desc);
        param.put("id", id);
        param.put("name", name);
        param.put("shareColumn", shareColumn);
        param.put("shareName", shareName);
        param.put("shareParam", shareParam);
        param.put("tableName", tableName);
        JSONObject paramColumn = new JSONObject();
        JSONArray requireds = new JSONArray();
java110-generator/src/main/java/com/java110/code/TableToJsonWeb.java
@@ -7,16 +7,23 @@
public class TableToJsonWeb {
    //show create table c_orders  用这个语句获取
    public static final String createTableSql = "CREATE TABLE `meter_type` (\n" +
            "  `type_id` varchar(30) NOT NULL COMMENT '类型ID',\n" +
            "  `type_name` varchar(12) NOT NULL COMMENT '名称',\n" +
            "  `community_id` varchar(30) NOT NULL COMMENT '小区ID',\n" +
            "  `remark` varchar(200) DEFAULT NULL COMMENT '说明',\n" +
    public static final String createTableSql = "CREATE TABLE `machine_type` (\n" +
            "  `type_id` varchar(30) NOT NULL COMMENT '设备类型ID',\n" +
            "  `machine_type_cd` varchar(30) NOT NULL COMMENT '设备大类 详情看t_dict',\n" +
            "  `machine_type_name` varchar(30) NOT NULL COMMENT '设备类型名称',\n" +
            "  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',\n" +
            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,0, 在用 1失效'\n" +
            "  `status_cd` varchar(2) NOT NULL DEFAULT '0' COMMENT '数据状态,详细参考c_status表,S 保存,0, 在用 1失效',\n" +
            "  KEY `idx_bm_machine_id` (`type_id`) USING BTREE\n" +
            ")";
    public static void main(String[] args) {
        String templateName = "设备类型"; //业务名称
        String templateCode = "machineType"; //表名大写
        String templateKey = "typeId"; //表主键
        String templateKeyName = "设备类型ID";//主键说明
        String searchCode = "typeId"; //分片字段
        String searchName = "设备类型ID"; //分片字段说明
        String directories = "property"; //前端生成到那个目录下
        // templateName 业务名称 业务编码名称生成后文件名 templateCode 主键 templateKey
        // 业务主键名称 templateKeyName=templateName+ID 主机驼峰 searchCode 主键名称 searchName
@@ -27,13 +34,13 @@
        newSql = newSql.replaceAll("\n", "");
        String[] rowSqls = newSql.split("',");
        JSONObject param = new JSONObject();
        param.put("templateName", "");
        param.put("templateCode", "");
        param.put("templateKey", "");
        param.put("templateKeyName", "");
        param.put("searchCode", "");
        param.put("searchName", "");
        param.put("directories", "");
        param.put("templateName", templateName);
        param.put("templateCode", templateCode);
        param.put("templateKey", templateKey);
        param.put("templateKeyName", templateKeyName);
        param.put("searchCode", searchCode);
        param.put("searchName", searchName);
        param.put("directories", directories);
        JSONObject paramColumn = null;
        JSONArray conditions = new JSONArray();
        JSONArray paramColumns = new JSONArray();
java110-generator/src/main/resources/newBack/template_1.json
@@ -1,32 +1,26 @@
{
  "param": {
    "keyId": "key_id",
    "remark": "remark",
    "machineTypeName": "machine_type_name",
    "typeId": "type_id",
    "statusCd": "status_cd",
    "settingKey": "setting_key",
    "settingType": "setting_type",
    "settingName": "setting_name"
    "machineTypeCd": "machine_type_cd"
  },
  "name": "communitySettingKey",
  "shareColumn": "key_id",
  "id": "keyId",
  "shareName": "community",
  "name": "machineType",
  "shareColumn": "type_id",
  "id": "typeId",
  "shareName": "common",
  "autoMove": true,
  "required": [
    {
      "msg": "设置类型不能为空",
      "code": "settingType"
      "msg": "设备大类不能为空",
      "code": "machineTypeCd"
    },
    {
      "msg": "名称不能为空",
      "code": "settingName"
    },
    {
      "msg": "设置key不能为空",
      "code": "settingKey"
      "msg": "设备类型名称不能为空",
      "code": "machineTypeName"
    }
  ],
  "desc": "小区配置",
  "shareParam": "keyId",
  "tableName": "community_setting_key"
  "desc": "设备类型",
  "shareParam": "typeId",
  "tableName": "machine_type"
}
java110-generator/src/main/resources/web/template_1.json
@@ -1,49 +1,74 @@
{
  "templateKeyName": "抄表类型",
  "templateName": "抄表类型",
  "searchName": "抄表类型",
  "directories": "property",
  "searchCode": "typeId",
  "templateCode": "meterType",
  "templateKey": "typeId",
  "templateKeyName": "设备类型ID",
  "templateName": "设备类型",
  "columns": [
    {
      "hasDefaultValue": false,
      "limitParam": "12",
      "code": "typeName",
      "limitErrInfo": "名称不能超过12",
      "cnCode": "名称",
      "limitParam": "30",
      "code": "typeId",
      "limitErrInfo": "设备类型ID不能超过30",
      "cnCode": "设备类型ID",
      "limit": "maxLength",
      "show": true,
      "inputType": "input",
      "required": true,
      "desc": "必填,名称"
      "desc": "必填,设备类型ID"
    },
    {
      "hasDefaultValue": false,
      "limitParam": "200",
      "code": "remark",
      "limitErrInfo": "说明不能超过200",
      "cnCode": "说明",
      "limitParam": "30",
      "code": "machineTypeCd",
      "limitErrInfo": "设备大类不能超过30",
      "cnCode": "设备大类",
      "limit": "maxLength",
      "show": true,
      "inputType": "input",
      "required": true,
      "desc": "说明"
      "desc": "必填,设备大类"
    },
    {
      "hasDefaultValue": false,
      "limitParam": "30",
      "code": "machineTypeName",
      "limitErrInfo": "设备类型名称不能超过30",
      "cnCode": "设备类型名称",
      "limit": "maxLength",
      "show": true,
      "inputType": "input",
      "required": true,
      "desc": "必填,设备类型名称"
    },
    {
      "hasDefaultValue": false,
      "limitParam": "2",
      "code": "statusCd",
      "limitErrInfo": "数据状态不能超过2",
      "cnCode": "数据状态",
      "limit": "maxLength",
      "show": true,
      "inputType": "input",
      "required": true,
      "desc": "必填,数据状态"
    }
  ],
  "searchName": "设备类型ID",
  "directories": "property",
  "searchCode": "typeId",
  "templateCode": "machineType",
  "conditions": [
    {
      "whereCondition": "equal",
      "code": "typeId",
      "name": "类型ID",
      "code": "machineTypeCd",
      "name": "设备大类",
      "inputType": "input"
    },
    {
      "whereCondition": "equal",
      "code": "typeName",
      "name": "名称",
      "code": "machineTypeName",
      "name": "设备类型名称",
      "inputType": "input"
    }
  ]
}
  ],
  "templateKey": "typeId"
}
java110-interface/src/main/java/com/java110/intf/common/IMachineTypeV1InnerServiceSMO.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.common;
import com.java110.config.feign.FeignConfiguration;
import com.java110.dto.machineType.MachineTypeDto;
import com.java110.po.machineType.MachineTypePo;
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-10-15 12:38:42 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 = "common-service", configuration = {FeignConfiguration.class})
@RequestMapping("/machineTypeV1Api")
public interface IMachineTypeV1InnerServiceSMO {
    @RequestMapping(value = "/saveMachineType", method = RequestMethod.POST)
    public int saveMachineType(@RequestBody  MachineTypePo machineTypePo);
    @RequestMapping(value = "/updateMachineType", method = RequestMethod.POST)
    public int updateMachineType(@RequestBody  MachineTypePo machineTypePo);
    @RequestMapping(value = "/deleteMachineType", method = RequestMethod.POST)
    public int deleteMachineType(@RequestBody  MachineTypePo machineTypePo);
    /**
     * <p>查询小区楼信息</p>
     *
     *
     * @param machineTypeDto 数据对象分享
     * @return MachineTypeDto 对象数据
     */
    @RequestMapping(value = "/queryMachineTypes", method = RequestMethod.POST)
    List<MachineTypeDto> queryMachineTypes(@RequestBody MachineTypeDto machineTypeDto);
    /**
     * 查询<p>小区楼</p>总记录数
     *
     * @param machineTypeDto 数据对象分享
     * @return 小区下的小区楼记录数
     */
    @RequestMapping(value = "/queryMachineTypesCount", method = RequestMethod.POST)
    int queryMachineTypesCount(@RequestBody MachineTypeDto machineTypeDto);
}
service-common/src/main/java/com/java110/common/cmd/machineType/DeleteMachineTypeCmd.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.common.cmd.machineType;
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.common.IMachineTypeV1InnerServiceSMO;
import com.java110.po.machineType.MachineTypePo;
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;
/**
 * 类表述:删除
 * 服务编码:machineType.deleteMachineType
 * 请求路劲:/app/machineType.DeleteMachineType
 * add by 吴学文 at 2021-10-15 12:38:43 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 = "machineType.deleteMachineType")
public class DeleteMachineTypeCmd extends AbstractServiceCmdListener {
  private static Logger logger = LoggerFactory.getLogger(DeleteMachineTypeCmd.class);
    @Autowired
    private IMachineTypeV1InnerServiceSMO machineTypeV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "typeId", "typeId不能为空");
Assert.hasKeyAndValue(reqJson, "typeId", "typeId不能为空");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
       MachineTypePo machineTypePo = BeanConvertUtil.covertBean(reqJson, MachineTypePo.class);
        int flag = machineTypeV1InnerServiceSMOImpl.deleteMachineType(machineTypePo);
        if (flag < 1) {
            throw new CmdException("删除数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-common/src/main/java/com/java110/common/cmd/machineType/ListMachineTypeCmd.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.common.cmd.machineType;
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.common.IMachineTypeV1InnerServiceSMO;
import com.java110.po.machineType.MachineTypePo;
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.machineType.MachineTypeDto;
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;
/**
 * 类表述:查询
 * 服务编码:machineType.listMachineType
 * 请求路劲:/app/machineType.ListMachineType
 * add by 吴学文 at 2021-10-15 12:38:43 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 = "machineType.listMachineType")
public class ListMachineTypeCmd extends AbstractServiceCmdListener {
  private static Logger logger = LoggerFactory.getLogger(ListMachineTypeCmd.class);
    @Autowired
    private IMachineTypeV1InnerServiceSMO machineTypeV1InnerServiceSMOImpl;
    @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 {
           MachineTypeDto machineTypeDto = BeanConvertUtil.covertBean(reqJson, MachineTypeDto.class);
           int count = machineTypeV1InnerServiceSMOImpl.queryMachineTypesCount(machineTypeDto);
           List<MachineTypeDto> machineTypeDtos = null;
           if (count > 0) {
               machineTypeDtos = machineTypeV1InnerServiceSMOImpl.queryMachineTypes(machineTypeDto);
           } else {
               machineTypeDtos = new ArrayList<>();
           }
           ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, machineTypeDtos);
           ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
           cmdDataFlowContext.setResponseEntity(responseEntity);
    }
}
service-common/src/main/java/com/java110/common/cmd/machineType/SaveMachineTypeCmd.java
New file
@@ -0,0 +1,76 @@
/*
 * 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.common.cmd.machineType;
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.common.IMachineTypeV1InnerServiceSMO;
import com.java110.po.machineType.MachineTypePo;
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;
/**
 * 类表述:保存
 * 服务编码:machineType.saveMachineType
 * 请求路劲:/app/machineType.SaveMachineType
 * add by 吴学文 at 2021-10-15 12:38:43 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 = "machineType.saveMachineType")
public class SaveMachineTypeCmd extends AbstractServiceCmdListener {
    private static Logger logger = LoggerFactory.getLogger(SaveMachineTypeCmd.class);
    public static final String CODE_PREFIX_ID = "10";
    @Autowired
    private IMachineTypeV1InnerServiceSMO machineTypeV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "machineTypeCd", "请求报文中未包含machineTypeCd");
Assert.hasKeyAndValue(reqJson, "machineTypeName", "请求报文中未包含machineTypeName");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
       MachineTypePo machineTypePo = BeanConvertUtil.covertBean(reqJson, MachineTypePo.class);
        machineTypePo.setTypeId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
        int flag = machineTypeV1InnerServiceSMOImpl.saveMachineType(machineTypePo);
        if (flag < 1) {
            throw new CmdException("保存数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-common/src/main/java/com/java110/common/cmd/machineType/UpdateMachineTypeCmd.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.common.cmd.machineType;
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.common.IMachineTypeV1InnerServiceSMO;
import com.java110.po.machineType.MachineTypePo;
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;
/**
 * 类表述:更新
 * 服务编码:machineType.updateMachineType
 * 请求路劲:/app/machineType.UpdateMachineType
 * add by 吴学文 at 2021-10-15 12:38:43 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 = "machineType.updateMachineType")
public class UpdateMachineTypeCmd extends AbstractServiceCmdListener {
  private static Logger logger = LoggerFactory.getLogger(UpdateMachineTypeCmd.class);
    @Autowired
    private IMachineTypeV1InnerServiceSMO machineTypeV1InnerServiceSMOImpl;
    @Override
    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
        Assert.hasKeyAndValue(reqJson, "typeId", "typeId不能为空");
Assert.hasKeyAndValue(reqJson, "typeId", "typeId不能为空");
    }
    @Override
    @Java110Transactional
    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
       MachineTypePo machineTypePo = BeanConvertUtil.covertBean(reqJson, MachineTypePo.class);
        int flag = machineTypeV1InnerServiceSMOImpl.updateMachineType(machineTypePo);
        if (flag < 1) {
            throw new CmdException("更新数据失败");
        }
        cmdDataFlowContext.setResponseEntity(ResultVo.success());
    }
}
service-common/src/main/java/com/java110/common/dao/IMachineTypeV1ServiceDao.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.common.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-10-15 12:38:42 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 IMachineTypeV1ServiceDao {
    /**
     * 保存 设备类型信息
     * @param info
     * @throws DAOException DAO异常
     */
    int saveMachineTypeInfo(Map info) throws DAOException;
    /**
     * 查询设备类型信息(instance过程)
     * 根据bId 查询设备类型信息
     * @param info bId 信息
     * @return 设备类型信息
     * @throws DAOException DAO异常
     */
    List<Map> getMachineTypeInfo(Map info) throws DAOException;
    /**
     * 修改设备类型信息
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
    int updateMachineTypeInfo(Map info) throws DAOException;
    /**
     * 查询设备类型总数
     *
     * @param info 设备类型信息
     * @return 设备类型数量
     */
    int queryMachineTypesCount(Map info);
}
service-common/src/main/java/com/java110/common/dao/impl/MachineTypeV1ServiceDaoImpl.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.common.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.common.dao.IMachineTypeV1ServiceDao;
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-10-15 12:38:42 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("machineTypeV1ServiceDaoImpl")
public class MachineTypeV1ServiceDaoImpl extends BaseServiceDao implements IMachineTypeV1ServiceDao {
    private static Logger logger = LoggerFactory.getLogger(MachineTypeV1ServiceDaoImpl.class);
    /**
     * 保存设备类型信息 到 instance
     * @param info   bId 信息
     * @throws DAOException DAO异常
     */
    @Override
    public int saveMachineTypeInfo(Map info) throws DAOException {
        logger.debug("保存 saveMachineTypeInfo 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.insert("machineTypeV1ServiceDaoImpl.saveMachineTypeInfo",info);
        return saveFlag;
    }
    /**
     * 查询设备类型信息(instance)
     * @param info bId 信息
     * @return List<Map>
     * @throws DAOException DAO异常
     */
    @Override
    public List<Map> getMachineTypeInfo(Map info) throws DAOException {
        logger.debug("查询 getMachineTypeInfo 入参 info : {}",info);
        List<Map> businessMachineTypeInfos = sqlSessionTemplate.selectList("machineTypeV1ServiceDaoImpl.getMachineTypeInfo",info);
        return businessMachineTypeInfos;
    }
    /**
     * 修改设备类型信息
     * @param info 修改信息
     * @throws DAOException DAO异常
     */
    @Override
    public int updateMachineTypeInfo(Map info) throws DAOException {
        logger.debug("修改 updateMachineTypeInfo 入参 info : {}",info);
        int saveFlag = sqlSessionTemplate.update("machineTypeV1ServiceDaoImpl.updateMachineTypeInfo",info);
        return saveFlag;
    }
     /**
     * 查询设备类型数量
     * @param info 设备类型信息
     * @return 设备类型数量
     */
    @Override
    public int queryMachineTypesCount(Map info) {
        logger.debug("查询 queryMachineTypesCount 入参 info : {}",info);
        List<Map> businessMachineTypeInfos = sqlSessionTemplate.selectList("machineTypeV1ServiceDaoImpl.queryMachineTypesCount", info);
        if (businessMachineTypeInfos.size() < 1) {
            return 0;
        }
        return Integer.parseInt(businessMachineTypeInfos.get(0).get("count").toString());
    }
}
service-common/src/main/java/com/java110/common/smo/impl/MachineTypeV1InnerServiceSMOImpl.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.common.smo.impl;
import com.java110.common.dao.IMachineTypeV1ServiceDao;
import com.java110.intf.common.IMachineTypeV1InnerServiceSMO;
import com.java110.dto.machineType.MachineTypeDto;
import com.java110.po.machineType.MachineTypePo;
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-10-15 12:38:42 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 MachineTypeV1InnerServiceSMOImpl extends BaseServiceSMO implements IMachineTypeV1InnerServiceSMO {
    @Autowired
    private IMachineTypeV1ServiceDao machineTypeV1ServiceDaoImpl;
    @Override
    public int saveMachineType(@RequestBody  MachineTypePo machineTypePo) {
        int saveFlag = machineTypeV1ServiceDaoImpl.saveMachineTypeInfo(BeanConvertUtil.beanCovertMap(machineTypePo));
        return saveFlag;
    }
     @Override
    public int updateMachineType(@RequestBody  MachineTypePo machineTypePo) {
        int saveFlag = machineTypeV1ServiceDaoImpl.updateMachineTypeInfo(BeanConvertUtil.beanCovertMap(machineTypePo));
        return saveFlag;
    }
     @Override
    public int deleteMachineType(@RequestBody  MachineTypePo machineTypePo) {
       machineTypePo.setStatusCd("1");
       int saveFlag = machineTypeV1ServiceDaoImpl.updateMachineTypeInfo(BeanConvertUtil.beanCovertMap(machineTypePo));
       return saveFlag;
    }
    @Override
    public List<MachineTypeDto> queryMachineTypes(@RequestBody  MachineTypeDto machineTypeDto) {
        //校验是否传了 分页信息
        int page = machineTypeDto.getPage();
        if (page != PageDto.DEFAULT_PAGE) {
            machineTypeDto.setPage((page - 1) * machineTypeDto.getRow());
        }
        List<MachineTypeDto> machineTypes = BeanConvertUtil.covertBeanList(machineTypeV1ServiceDaoImpl.getMachineTypeInfo(BeanConvertUtil.beanCovertMap(machineTypeDto)), MachineTypeDto.class);
        return machineTypes;
    }
    @Override
    public int queryMachineTypesCount(@RequestBody MachineTypeDto machineTypeDto) {
        return machineTypeV1ServiceDaoImpl.queryMachineTypesCount(BeanConvertUtil.beanCovertMap(machineTypeDto));    }
}