16 changed files with 1344 additions and 0 deletions
			
			
		@ -0,0 +1,87 @@
					 | 
				
			||||
package com.mh.web.controller.device; | 
				
			||||
 | 
				
			||||
import com.mh.common.annotation.Log; | 
				
			||||
import com.mh.common.core.controller.BaseController; | 
				
			||||
import com.mh.common.core.domain.AjaxResult; | 
				
			||||
import com.mh.common.core.domain.entity.CommunicationParams; | 
				
			||||
import com.mh.common.core.page.TableDataInfo; | 
				
			||||
import com.mh.common.enums.BusinessType; | 
				
			||||
import com.mh.system.service.device.ICommunicationParamsService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.validation.annotation.Validated; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 设备采集参数管理 | 
				
			||||
 * @date 2025-01-08 14:36:24 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("/device/cmp") | 
				
			||||
public class CommunicationParamsController extends BaseController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private ICommunicationParamsService iCommunicationParamsService; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 获取列表内容数据 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:cmp:list')") | 
				
			||||
    @GetMapping("/list") | 
				
			||||
    public TableDataInfo list(CommunicationParams communicationParams) | 
				
			||||
    { | 
				
			||||
        startPage(); | 
				
			||||
        List<CommunicationParams> list = iCommunicationParamsService.selectCmPList(communicationParams); | 
				
			||||
        return getDataTable(list); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 根据id获取详细信息 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:cmp:query')") | 
				
			||||
    @GetMapping(value = "/{cmpId}") | 
				
			||||
    public AjaxResult getInfo(@PathVariable String cmpId) | 
				
			||||
    { | 
				
			||||
        return success(iCommunicationParamsService.selectCommunicationParamsById(cmpId)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 新增网关 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:cmp:add')") | 
				
			||||
    @Log(title = "设备采集参数管理", businessType = BusinessType.INSERT) | 
				
			||||
    @PostMapping | 
				
			||||
    public AjaxResult add(@Validated @RequestBody CommunicationParams communicationParams) | 
				
			||||
    { | 
				
			||||
        communicationParams.setCreateBy(getUsername()); | 
				
			||||
        return toAjax(iCommunicationParamsService.insertCommunicationParams(communicationParams)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 修改网关信息 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:cmp:edit')") | 
				
			||||
    @Log(title = "设备采集参数管理", businessType = BusinessType.UPDATE) | 
				
			||||
    @PutMapping | 
				
			||||
    public AjaxResult edit(@Validated @RequestBody CommunicationParams communicationParams) | 
				
			||||
    { | 
				
			||||
        communicationParams.setUpdateBy(getUsername()); | 
				
			||||
        return toAjax(iCommunicationParamsService.updateCommunicationParams(communicationParams)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 删除设备采集参数管理 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:cmp:remove')") | 
				
			||||
    @Log(title = "设备采集参数管理", businessType = BusinessType.DELETE) | 
				
			||||
    @DeleteMapping("/{cmpIds}") | 
				
			||||
    public AjaxResult remove(@PathVariable String[] cmpIds) | 
				
			||||
    { | 
				
			||||
        return toAjax(iCommunicationParamsService.deleteCommunicationByIds(cmpIds)); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,89 @@
					 | 
				
			||||
package com.mh.web.controller.device; | 
				
			||||
 | 
				
			||||
import com.mh.common.annotation.Log; | 
				
			||||
import com.mh.common.core.controller.BaseController; | 
				
			||||
import com.mh.common.core.domain.AjaxResult; | 
				
			||||
import com.mh.common.core.domain.entity.GatewayManage; | 
				
			||||
import com.mh.common.core.page.TableDataInfo; | 
				
			||||
import com.mh.common.enums.BusinessType; | 
				
			||||
import com.mh.system.domain.SysNotice; | 
				
			||||
import com.mh.system.service.ISysNoticeService; | 
				
			||||
import com.mh.system.service.device.IGatewayManageService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.validation.annotation.Validated; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 网关设备管理 | 
				
			||||
 * @date 2025-01-08 14:36:24 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("/device/gateway") | 
				
			||||
public class GatewayManageController extends BaseController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private IGatewayManageService gatewayManageService; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 获取网关列表内容数据 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:gw:list')") | 
				
			||||
    @GetMapping("/list") | 
				
			||||
    public TableDataInfo list(GatewayManage gatewayManage) | 
				
			||||
    { | 
				
			||||
        startPage(); | 
				
			||||
        List<GatewayManage> list = gatewayManageService.selectGwManageList(gatewayManage); | 
				
			||||
        return getDataTable(list); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 根据网关id获取详细信息 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:gw:query')") | 
				
			||||
    @GetMapping(value = "/{gwId}") | 
				
			||||
    public AjaxResult getInfo(@PathVariable String gwId) | 
				
			||||
    { | 
				
			||||
        return success(gatewayManageService.selectGwManageById(gwId)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 新增网关 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:gw:add')") | 
				
			||||
    @Log(title = "网关管理", businessType = BusinessType.INSERT) | 
				
			||||
    @PostMapping | 
				
			||||
    public AjaxResult add(@Validated @RequestBody GatewayManage gatewayManage) | 
				
			||||
    { | 
				
			||||
        gatewayManage.setCreateBy(getUsername()); | 
				
			||||
        return toAjax(gatewayManageService.insertGatewayManage(gatewayManage)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 修改网关信息 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:gw:edit')") | 
				
			||||
    @Log(title = "网关管理", businessType = BusinessType.UPDATE) | 
				
			||||
    @PutMapping | 
				
			||||
    public AjaxResult edit(@Validated @RequestBody GatewayManage gatewayManage) | 
				
			||||
    { | 
				
			||||
        gatewayManage.setUpdateBy(getUsername()); | 
				
			||||
        return toAjax(gatewayManageService.updateGateway(gatewayManage)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 删除网关管理 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:gw:remove')") | 
				
			||||
    @Log(title = "网关管理", businessType = BusinessType.DELETE) | 
				
			||||
    @DeleteMapping("/{gatewayIds}") | 
				
			||||
    public AjaxResult remove(@PathVariable String[] gatewayIds) | 
				
			||||
    { | 
				
			||||
        return toAjax(gatewayManageService.deleteGatewayByIds(gatewayIds)); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,87 @@
					 | 
				
			||||
package com.mh.web.controller.device; | 
				
			||||
 | 
				
			||||
import com.mh.common.annotation.Log; | 
				
			||||
import com.mh.common.core.controller.BaseController; | 
				
			||||
import com.mh.common.core.domain.AjaxResult; | 
				
			||||
import com.mh.common.core.domain.entity.MaintainInfo; | 
				
			||||
import com.mh.common.core.page.TableDataInfo; | 
				
			||||
import com.mh.common.enums.BusinessType; | 
				
			||||
import com.mh.system.service.device.IMaintainInfoService; | 
				
			||||
import org.springframework.beans.factory.annotation.Autowired; | 
				
			||||
import org.springframework.security.access.prepost.PreAuthorize; | 
				
			||||
import org.springframework.validation.annotation.Validated; | 
				
			||||
import org.springframework.web.bind.annotation.*; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 维护设备设备管理 | 
				
			||||
 * @date 2025-01-08 14:36:24 | 
				
			||||
 */ | 
				
			||||
@RestController | 
				
			||||
@RequestMapping("/device/maintain") | 
				
			||||
public class MaintainInfoController extends BaseController { | 
				
			||||
 | 
				
			||||
    @Autowired | 
				
			||||
    private IMaintainInfoService maintainInfoService; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 获取维护设备列表内容数据 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:maintain:list')") | 
				
			||||
    @GetMapping("/list") | 
				
			||||
    public TableDataInfo list(MaintainInfo maintainInfo) | 
				
			||||
    { | 
				
			||||
        startPage(); | 
				
			||||
        List<MaintainInfo> list = maintainInfoService.selectMaintainInfoList(maintainInfo); | 
				
			||||
        return getDataTable(list); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 根据维护设备id获取详细信息 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:maintain:query')") | 
				
			||||
    @GetMapping(value = "/{maintainId}") | 
				
			||||
    public AjaxResult getInfo(@PathVariable String maintainId) | 
				
			||||
    { | 
				
			||||
        return success(maintainInfoService.selectMaintainInfoById(maintainId)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 新增维护设备 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:maintain:add')") | 
				
			||||
    @Log(title = "维护设备管理", businessType = BusinessType.INSERT) | 
				
			||||
    @PostMapping | 
				
			||||
    public AjaxResult add(@Validated @RequestBody MaintainInfo gatewayManage) | 
				
			||||
    { | 
				
			||||
        gatewayManage.setCreateBy(getUsername()); | 
				
			||||
        return toAjax(maintainInfoService.insertMaintainInfo(gatewayManage)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 修改维护设备信息 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:maintain:edit')") | 
				
			||||
    @Log(title = "维护设备管理", businessType = BusinessType.UPDATE) | 
				
			||||
    @PutMapping | 
				
			||||
    public AjaxResult edit(@Validated @RequestBody MaintainInfo gatewayManage) | 
				
			||||
    { | 
				
			||||
        gatewayManage.setUpdateBy(getUsername()); | 
				
			||||
        return toAjax(maintainInfoService.updateMaintainInfo(gatewayManage)); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 删除维护设备管理 | 
				
			||||
     */ | 
				
			||||
    @PreAuthorize("@ss.hasPermi('system:maintain:remove')") | 
				
			||||
    @Log(title = "维护设备管理", businessType = BusinessType.DELETE) | 
				
			||||
    @DeleteMapping("/{maintainIds}") | 
				
			||||
    public AjaxResult remove(@PathVariable String[] maintainIds) | 
				
			||||
    { | 
				
			||||
        return toAjax(maintainInfoService.deleteMaintainInfoByIds(maintainIds)); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,123 @@
					 | 
				
			||||
package com.mh.common.core.domain.entity; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.annotation.IdType; | 
				
			||||
import com.baomidou.mybatisplus.annotation.TableId; | 
				
			||||
import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||
import com.mh.common.core.domain.BaseEntity; | 
				
			||||
import org.apache.commons.lang3.builder.ToStringBuilder; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 设备采集通信参数设置 | 
				
			||||
 * @date 2025-01-08 15:42:26 | 
				
			||||
 */ | 
				
			||||
@TableName("communication_params") | 
				
			||||
public class CommunicationParams extends BaseEntity { | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 主键 | 
				
			||||
     */ | 
				
			||||
    @TableId(value = "id", type = IdType.ASSIGN_UUID) | 
				
			||||
    private String id; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 仪表类型(从字典表中拿) | 
				
			||||
     */ | 
				
			||||
    private Integer mtType; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 波特率 | 
				
			||||
     */ | 
				
			||||
    private int baudRate; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 数据位 | 
				
			||||
     */ | 
				
			||||
    private int dataBit; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 停止位 | 
				
			||||
     */ | 
				
			||||
    private int stopBit; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 校验位 | 
				
			||||
     */ | 
				
			||||
    private String parity; | 
				
			||||
 | 
				
			||||
    /** | 
				
			||||
     * 备注 | 
				
			||||
     */ | 
				
			||||
    private String remark; | 
				
			||||
 | 
				
			||||
    public String getId() { | 
				
			||||
        return id; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setId(String id) { | 
				
			||||
        this.id = id; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Integer getMtType() { | 
				
			||||
        return mtType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMtType(Integer mtType) { | 
				
			||||
        this.mtType = mtType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getBaudRate() { | 
				
			||||
        return baudRate; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setBaudRate(int baudRate) { | 
				
			||||
        this.baudRate = baudRate; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getDataBit() { | 
				
			||||
        return dataBit; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDataBit(int dataBit) { | 
				
			||||
        this.dataBit = dataBit; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getStopBit() { | 
				
			||||
        return stopBit; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setStopBit(int stopBit) { | 
				
			||||
        this.stopBit = stopBit; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getParity() { | 
				
			||||
        return parity; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setParity(String parity) { | 
				
			||||
        this.parity = parity; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getRemark() { | 
				
			||||
        return remark; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setRemark(String remark) { | 
				
			||||
        this.remark = remark; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return new ToStringBuilder(this) | 
				
			||||
                .append("id", id) | 
				
			||||
                .append("mtType", mtType) | 
				
			||||
                .append("baudRate", baudRate) | 
				
			||||
                .append("dataBit", dataBit) | 
				
			||||
                .append("stopBit", stopBit) | 
				
			||||
                .append("parity", parity) | 
				
			||||
                .append("remark", remark) | 
				
			||||
                .toString(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,160 @@
					 | 
				
			||||
package com.mh.common.core.domain.entity; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.annotation.IdType; | 
				
			||||
import com.baomidou.mybatisplus.annotation.TableId; | 
				
			||||
import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||
import com.mh.common.core.domain.BaseEntity; | 
				
			||||
import org.apache.commons.lang3.builder.ToStringBuilder; | 
				
			||||
 | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author ljf | 
				
			||||
 * @title : | 
				
			||||
 * @description :网关管理实体类 | 
				
			||||
 * @updateTime 2020-05-21 | 
				
			||||
 * @throws : | 
				
			||||
 */ | 
				
			||||
@TableName("gateway_manage") | 
				
			||||
public class GatewayManage extends BaseEntity { | 
				
			||||
 | 
				
			||||
    @TableId(value = "id", type = IdType.ASSIGN_UUID) | 
				
			||||
    private String id; | 
				
			||||
    private String gwName;                          // 网关名称
 | 
				
			||||
    private String gwIp;                            // 网关IP地址
 | 
				
			||||
    private String gwAddr;                          // 网关安装地址
 | 
				
			||||
    private int port;                               // 端口号
 | 
				
			||||
    private int collectionLoop;                     // 采集周期
 | 
				
			||||
    private Date connectTime;                       // 最新上线连接时间
 | 
				
			||||
    private String internetCard;                    // 物联网卡号
 | 
				
			||||
    private int operatorType;                       //  0:中国移动 1:中国联通 2:中国电信
 | 
				
			||||
    private int communicationType;                  // 通讯类型
 | 
				
			||||
    private String remark;                          // 备注
 | 
				
			||||
    private int grade;                              // 标志位(连接状态) 0:正常;1:不在线;2:异常
 | 
				
			||||
    private Integer status;                             // (连接状态) 0:正常;1:不在线;2:异常
 | 
				
			||||
 | 
				
			||||
    public Integer getStatus() { | 
				
			||||
        return status; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setStatus(Integer status) { | 
				
			||||
        this.status = status; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getId() { | 
				
			||||
        return id; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setId(String id) { | 
				
			||||
        this.id = id; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getGwName() { | 
				
			||||
        return gwName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setGwName(String gwName) { | 
				
			||||
        this.gwName = gwName; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getGwIp() { | 
				
			||||
        return gwIp; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setGwIp(String gwIp) { | 
				
			||||
        this.gwIp = gwIp; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getGwAddr() { | 
				
			||||
        return gwAddr; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setGwAddr(String gwAddr) { | 
				
			||||
        this.gwAddr = gwAddr; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getPort() { | 
				
			||||
        return port; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setPort(int port) { | 
				
			||||
        this.port = port; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getCollectionLoop() { | 
				
			||||
        return collectionLoop; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setCollectionLoop(int collectionLoop) { | 
				
			||||
        this.collectionLoop = collectionLoop; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Date getConnectTime() { | 
				
			||||
        return connectTime; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setConnectTime(Date connectTime) { | 
				
			||||
        this.connectTime = connectTime; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getInternetCard() { | 
				
			||||
        return internetCard; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setInternetCard(String internetCard) { | 
				
			||||
        this.internetCard = internetCard; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getOperatorType() { | 
				
			||||
        return operatorType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setOperatorType(int operatorType) { | 
				
			||||
        this.operatorType = operatorType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getCommunicationType() { | 
				
			||||
        return communicationType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setCommunicationType(int communicationType) { | 
				
			||||
        this.communicationType = communicationType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String getRemark() { | 
				
			||||
        return remark; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public void setRemark(String remark) { | 
				
			||||
        this.remark = remark; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public int getGrade() { | 
				
			||||
        return grade; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setGrade(int grade) { | 
				
			||||
        this.grade = grade; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return new ToStringBuilder(this) | 
				
			||||
                .append("id", id) | 
				
			||||
                .append("gwName", gwName) | 
				
			||||
                .append("gwIp", gwIp) | 
				
			||||
                .append("gwAddr", gwAddr) | 
				
			||||
                .append("port", port) | 
				
			||||
                .append("collectionLoop", collectionLoop) | 
				
			||||
                .append("connectTime", connectTime) | 
				
			||||
                .append("internetCard", internetCard) | 
				
			||||
                .append("operatorType", operatorType) | 
				
			||||
                .append("communicationType", communicationType) | 
				
			||||
                .append("remark", remark) | 
				
			||||
                .append("grade", grade) | 
				
			||||
                .append("status", status) | 
				
			||||
                .toString(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,123 @@
					 | 
				
			||||
package com.mh.common.core.domain.entity; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.annotation.IdType; | 
				
			||||
import com.baomidou.mybatisplus.annotation.TableId; | 
				
			||||
import com.baomidou.mybatisplus.annotation.TableName; | 
				
			||||
import com.mh.common.core.domain.BaseEntity; | 
				
			||||
import org.apache.commons.lang3.builder.ToStringBuilder; | 
				
			||||
 | 
				
			||||
import java.math.BigDecimal; | 
				
			||||
import java.util.Date; | 
				
			||||
 | 
				
			||||
@TableName("maintain_info") | 
				
			||||
public class MaintainInfo extends BaseEntity { | 
				
			||||
 | 
				
			||||
    @TableId(value = "id", type = IdType.ASSIGN_UUID) | 
				
			||||
    private String id;               // 编号
 | 
				
			||||
    private String deviceId;         // 设备编号
 | 
				
			||||
    private String deviceType;       // 设备类型
 | 
				
			||||
    private String maintainType;     // 维护类型
 | 
				
			||||
    private String maintainPeople;   // 维护人员
 | 
				
			||||
    private BigDecimal cost;         // 费用
 | 
				
			||||
    private String contents;         // 维保内容
 | 
				
			||||
    private String evaluate;         // 评价分数
 | 
				
			||||
    private Date execTime;           // 执行时间
 | 
				
			||||
    private Integer spendTime;       // 花费时间
 | 
				
			||||
 | 
				
			||||
    public String getId() { | 
				
			||||
        return id; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setId(String id) { | 
				
			||||
        this.id = id; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDeviceId() { | 
				
			||||
        return deviceId; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDeviceId(String deviceId) { | 
				
			||||
        this.deviceId = deviceId; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getDeviceType() { | 
				
			||||
        return deviceType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setDeviceType(String deviceType) { | 
				
			||||
        this.deviceType = deviceType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getMaintainType() { | 
				
			||||
        return maintainType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMaintainType(String maintainType) { | 
				
			||||
        this.maintainType = maintainType; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getMaintainPeople() { | 
				
			||||
        return maintainPeople; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setMaintainPeople(String maintainPeople) { | 
				
			||||
        this.maintainPeople = maintainPeople; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public BigDecimal getCost() { | 
				
			||||
        return cost; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setCost(BigDecimal cost) { | 
				
			||||
        this.cost = cost; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getContents() { | 
				
			||||
        return contents; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setContents(String contents) { | 
				
			||||
        this.contents = contents; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public String getEvaluate() { | 
				
			||||
        return evaluate; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setEvaluate(String evaluate) { | 
				
			||||
        this.evaluate = evaluate; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Date getExecTime() { | 
				
			||||
        return execTime; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setExecTime(Date execTime) { | 
				
			||||
        this.execTime = execTime; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public Integer getSpendTime() { | 
				
			||||
        return spendTime; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    public void setSpendTime(Integer spendTime) { | 
				
			||||
        this.spendTime = spendTime; | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public String toString() { | 
				
			||||
        return new ToStringBuilder(this) | 
				
			||||
                .append("id", id) | 
				
			||||
                .append("deviceId", deviceId) | 
				
			||||
                .append("deviceType", deviceType) | 
				
			||||
                .append("maintainType", maintainType) | 
				
			||||
                .append("maintainPeople", maintainPeople) | 
				
			||||
                .append("cost", cost) | 
				
			||||
                .append("contents", contents) | 
				
			||||
                .append("evaluate", evaluate) | 
				
			||||
                .append("execTime", execTime) | 
				
			||||
                .append("spendTime", spendTime) | 
				
			||||
                .toString(); | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,16 @@
					 | 
				
			||||
package com.mh.system.mapper.device; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
				
			||||
import com.mh.common.core.domain.entity.CommunicationParams; | 
				
			||||
import org.apache.ibatis.annotations.Mapper; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 网关管理数据库操作mapper | 
				
			||||
 * @date 2025-01-08 15:13:16 | 
				
			||||
 */ | 
				
			||||
@Mapper | 
				
			||||
public interface CommunicationParamsMapper extends BaseMapper<CommunicationParams> { | 
				
			||||
} | 
				
			||||
@ -0,0 +1,16 @@
					 | 
				
			||||
package com.mh.system.mapper.device; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
				
			||||
import com.mh.common.core.domain.entity.GatewayManage; | 
				
			||||
import org.apache.ibatis.annotations.Mapper; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 网关管理数据库操作mapper | 
				
			||||
 * @date 2025-01-08 15:13:16 | 
				
			||||
 */ | 
				
			||||
@Mapper | 
				
			||||
public interface GatewayManageMapper extends BaseMapper<GatewayManage> { | 
				
			||||
} | 
				
			||||
@ -0,0 +1,16 @@
					 | 
				
			||||
package com.mh.system.mapper.device; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | 
				
			||||
import com.mh.common.core.domain.entity.MaintainInfo; | 
				
			||||
import org.apache.ibatis.annotations.Mapper; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 维保管理mapper | 
				
			||||
 * @date 2025-01-08 17:31:03 | 
				
			||||
 */ | 
				
			||||
@Mapper | 
				
			||||
public interface MaintainInfoMapper extends BaseMapper<MaintainInfo> { | 
				
			||||
} | 
				
			||||
@ -0,0 +1,24 @@
					 | 
				
			||||
package com.mh.system.service.device; | 
				
			||||
 | 
				
			||||
import com.mh.common.core.domain.entity.CommunicationParams; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 设备采集通信参数配置 | 
				
			||||
 * @date 2025-01-08 16:28:53 | 
				
			||||
 */ | 
				
			||||
public interface ICommunicationParamsService { | 
				
			||||
    List<CommunicationParams> selectCmPList(CommunicationParams communicationParams); | 
				
			||||
 | 
				
			||||
    CommunicationParams selectCommunicationParamsById(String cmpId); | 
				
			||||
 | 
				
			||||
    int insertCommunicationParams(CommunicationParams communicationParams); | 
				
			||||
 | 
				
			||||
    int updateCommunicationParams(CommunicationParams communicationParams); | 
				
			||||
 | 
				
			||||
    int deleteCommunicationByIds(String[] cmpIds); | 
				
			||||
} | 
				
			||||
@ -0,0 +1,25 @@
					 | 
				
			||||
package com.mh.system.service.device; | 
				
			||||
 | 
				
			||||
import com.mh.common.core.domain.entity.GatewayManage; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 网管管理接口 | 
				
			||||
 * @date 2025-01-08 14:47:32 | 
				
			||||
 */ | 
				
			||||
public interface IGatewayManageService { | 
				
			||||
 | 
				
			||||
    List<GatewayManage> selectGwManageList(GatewayManage gatewayManage); | 
				
			||||
 | 
				
			||||
    GatewayManage selectGwManageById(String gwId); | 
				
			||||
 | 
				
			||||
    int insertGatewayManage(GatewayManage gatewayManage); | 
				
			||||
 | 
				
			||||
    int updateGateway(GatewayManage gatewayManage); | 
				
			||||
 | 
				
			||||
    int deleteGatewayByIds(String[] gatewayIds); | 
				
			||||
} | 
				
			||||
@ -0,0 +1,24 @@
					 | 
				
			||||
package com.mh.system.service.device; | 
				
			||||
 | 
				
			||||
import com.mh.common.core.domain.entity.MaintainInfo; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 设备维护管理服务类 | 
				
			||||
 * @date 2025-01-08 17:37:26 | 
				
			||||
 */ | 
				
			||||
public interface IMaintainInfoService { | 
				
			||||
    List<MaintainInfo> selectMaintainInfoList(MaintainInfo maintainInfo); | 
				
			||||
 | 
				
			||||
    MaintainInfo selectMaintainInfoById(String maintainId); | 
				
			||||
 | 
				
			||||
    int insertMaintainInfo(MaintainInfo maintainInfo); | 
				
			||||
 | 
				
			||||
    int updateMaintainInfo(MaintainInfo maintainInfo); | 
				
			||||
 | 
				
			||||
    int deleteMaintainInfoByIds(String[] maintainIds); | 
				
			||||
} | 
				
			||||
@ -0,0 +1,63 @@
					 | 
				
			||||
package com.mh.system.service.device.impl; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			||||
import com.mh.common.core.domain.entity.CommunicationParams; | 
				
			||||
import com.mh.system.mapper.device.CommunicationParamsMapper; | 
				
			||||
import com.mh.system.service.device.ICommunicationParamsService; | 
				
			||||
import jakarta.annotation.Resource; | 
				
			||||
import org.springframework.stereotype.Service; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 设备采集通信参数配置实现类 | 
				
			||||
 * @date 2025-01-08 16:33:54 | 
				
			||||
 */ | 
				
			||||
@Service | 
				
			||||
public class CommunicationParamsServiceImpl implements ICommunicationParamsService { | 
				
			||||
 | 
				
			||||
    @Resource | 
				
			||||
    private CommunicationParamsMapper communicationParamsMapper; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public List<CommunicationParams> selectCmPList(CommunicationParams communicationParams) { | 
				
			||||
        if (communicationParams == null) { | 
				
			||||
            return List.of(); | 
				
			||||
        } | 
				
			||||
        QueryWrapper<CommunicationParams> queryWrapper = new QueryWrapper<>(); | 
				
			||||
        if (communicationParams.getMtType() != null) { | 
				
			||||
            queryWrapper.eq("mt_type", communicationParams.getMtType()); | 
				
			||||
        } | 
				
			||||
        queryWrapper.orderByAsc("mt_type"); | 
				
			||||
        return communicationParamsMapper.selectList(queryWrapper); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public CommunicationParams selectCommunicationParamsById(String cmpId) { | 
				
			||||
        return communicationParamsMapper.selectById(cmpId); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int insertCommunicationParams(CommunicationParams communicationParams) { | 
				
			||||
        return communicationParamsMapper.insert(communicationParams); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int updateCommunicationParams(CommunicationParams communicationParams) { | 
				
			||||
        return communicationParamsMapper.updateById(communicationParams); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int deleteCommunicationByIds(String[] cmpIds) { | 
				
			||||
        if (cmpIds != null && cmpIds.length > 0) { | 
				
			||||
            for (String cmpId : cmpIds) { | 
				
			||||
                communicationParamsMapper.deleteById(cmpId); | 
				
			||||
            } | 
				
			||||
            return cmpIds.length; | 
				
			||||
        } | 
				
			||||
        return 0; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,67 @@
					 | 
				
			||||
package com.mh.system.service.device.impl; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			||||
import com.mh.common.core.domain.entity.GatewayManage; | 
				
			||||
import com.mh.common.utils.StringUtils; | 
				
			||||
import com.mh.system.mapper.device.GatewayManageMapper; | 
				
			||||
import com.mh.system.service.device.IGatewayManageService; | 
				
			||||
import jakarta.annotation.Resource; | 
				
			||||
import org.springframework.stereotype.Service; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 网关管理接口实现类 | 
				
			||||
 * @date 2025-01-08 14:48:17 | 
				
			||||
 */ | 
				
			||||
@Service | 
				
			||||
public class GatewayManageServiceImpl implements IGatewayManageService { | 
				
			||||
 | 
				
			||||
    @Resource | 
				
			||||
    private GatewayManageMapper gatewayManageMapper; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public List<GatewayManage> selectGwManageList(GatewayManage gatewayManage) { | 
				
			||||
        QueryWrapper<GatewayManage> queryWrapper = new QueryWrapper<>(); | 
				
			||||
        if (!StringUtils.isEmpty(gatewayManage.getGwName())) { | 
				
			||||
            queryWrapper.like("gw_name", gatewayManage.getGwName()); | 
				
			||||
        } | 
				
			||||
        if (gatewayManage.getStatus() != null) { | 
				
			||||
            queryWrapper.eq("status", gatewayManage.getStatus()); | 
				
			||||
        } | 
				
			||||
        if (!StringUtils.isEmpty(gatewayManage.getCreateBy())) { | 
				
			||||
            queryWrapper.like("create_by", gatewayManage.getCreateBy()); | 
				
			||||
        } | 
				
			||||
        queryWrapper.orderByDesc("create_time"); | 
				
			||||
        return gatewayManageMapper.selectList(queryWrapper); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public GatewayManage selectGwManageById(String gwId) { | 
				
			||||
        return gatewayManageMapper.selectById(gwId); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int insertGatewayManage(GatewayManage gatewayManage) { | 
				
			||||
        return gatewayManageMapper.insert(gatewayManage); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int updateGateway(GatewayManage gatewayManage) { | 
				
			||||
        return gatewayManageMapper.updateById(gatewayManage); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int deleteGatewayByIds(String[] gatewayIds) { | 
				
			||||
        if (gatewayIds != null && gatewayIds.length > 0) { | 
				
			||||
            for (String gatewayId : gatewayIds) { | 
				
			||||
                gatewayManageMapper.deleteById(gatewayId); | 
				
			||||
            } | 
				
			||||
            return gatewayIds.length; | 
				
			||||
        } | 
				
			||||
        return 0; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,67 @@
					 | 
				
			||||
package com.mh.system.service.device.impl; | 
				
			||||
 | 
				
			||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
				
			||||
import com.mh.common.core.domain.entity.MaintainInfo; | 
				
			||||
import com.mh.common.utils.StringUtils; | 
				
			||||
import com.mh.system.mapper.device.MaintainInfoMapper; | 
				
			||||
import com.mh.system.service.device.IMaintainInfoService; | 
				
			||||
import jakarta.annotation.Resource; | 
				
			||||
import org.springframework.stereotype.Service; | 
				
			||||
 | 
				
			||||
import java.util.List; | 
				
			||||
 | 
				
			||||
/** | 
				
			||||
 * @author LJF | 
				
			||||
 * @version 1.0 | 
				
			||||
 * @project EEMCS | 
				
			||||
 * @description 设备维护管理服务类 | 
				
			||||
 * @date 2025-01-08 17:37:53 | 
				
			||||
 */ | 
				
			||||
@Service | 
				
			||||
public class MaintainInfoServiceImpl implements IMaintainInfoService { | 
				
			||||
 | 
				
			||||
    @Resource | 
				
			||||
    private MaintainInfoMapper maintainInfoMapper; | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public List<MaintainInfo> selectMaintainInfoList(MaintainInfo maintainInfo) { | 
				
			||||
        if (maintainInfo == null) { | 
				
			||||
            return List.of(); | 
				
			||||
        } | 
				
			||||
        QueryWrapper<MaintainInfo> queryWrapper = new QueryWrapper<>(); | 
				
			||||
        if (maintainInfo.getMaintainType() != null) { | 
				
			||||
            queryWrapper.eq("maintain_type", maintainInfo.getMaintainType()); | 
				
			||||
        } | 
				
			||||
        if (!StringUtils.isEmpty(maintainInfo.getMaintainPeople())) { | 
				
			||||
            queryWrapper.like("maintain_people", maintainInfo.getMaintainPeople()); | 
				
			||||
        } | 
				
			||||
        queryWrapper.orderByDesc("create_time"); | 
				
			||||
        return maintainInfoMapper.selectList(queryWrapper); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public MaintainInfo selectMaintainInfoById(String maintainId) { | 
				
			||||
        return maintainInfoMapper.selectById(maintainId); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int insertMaintainInfo(MaintainInfo maintainInfo) { | 
				
			||||
        return maintainInfoMapper.insert(maintainInfo); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int updateMaintainInfo(MaintainInfo maintainInfo) { | 
				
			||||
        return maintainInfoMapper.updateById(maintainInfo); | 
				
			||||
    } | 
				
			||||
 | 
				
			||||
    @Override | 
				
			||||
    public int deleteMaintainInfoByIds(String[] maintainIds) { | 
				
			||||
        if (maintainIds != null) { | 
				
			||||
            for (String maintainId : maintainIds) { | 
				
			||||
                maintainInfoMapper.deleteById(maintainId); | 
				
			||||
            } | 
				
			||||
            return maintainIds.length; | 
				
			||||
        } | 
				
			||||
        return 0; | 
				
			||||
    } | 
				
			||||
} | 
				
			||||
@ -0,0 +1,357 @@
					 | 
				
			||||
--1、创建设备台账管理 device_ledger 表 | 
				
			||||
CREATE TABLE device_ledger ( | 
				
			||||
  id VARCHAR(36) NOT NULL,            -- 设备id | 
				
			||||
  device_name VARCHAR(50) NULL,       -- 设备名称 | 
				
			||||
  model_specs VARCHAR(100) NULL,      -- 规格型号 | 
				
			||||
  asset_num VARCHAR(50) NULL,         -- 资产编号 | 
				
			||||
  qr_code_id VARCHAR(36) NULL,        -- 二维码id | 
				
			||||
  service_life VARCHAR(10) NULL,      -- 使用寿命 | 
				
			||||
  device_type VARCHAR(50) NULL,       -- 设备类型(字典) | 
				
			||||
  tech_params VARCHAR(200) NULL,      -- 技术参数 | 
				
			||||
  tech_doc VARCHAR(100) NULL,         -- 技术文档 | 
				
			||||
  install_time TIMESTAMP NULL,        -- 安装时间 | 
				
			||||
  create_time TIMESTAMP NULL,         -- 创建时间 | 
				
			||||
  update_time TIMESTAMP NULL,         -- 更新时间 | 
				
			||||
  create_by VARCHAR(100) NULL,        -- 创建者 | 
				
			||||
  status int null,                    -- 状态(0:在线或者使用中,1:不在线或者停用) | 
				
			||||
  is_collection int null,             -- 是否是需要采集(0:是,1:不采集) | 
				
			||||
  is_calc_energy int null,            -- 是否计算能效(0:计算,1不计算) | 
				
			||||
  PRIMARY KEY (id) | 
				
			||||
); | 
				
			||||
-- 为表添加备注 | 
				
			||||
COMMENT ON TABLE device_ledger IS '设备台账表,用于记录所有设备的基本信息、安装及维护情况'; | 
				
			||||
 | 
				
			||||
-- 为各列添加备注 | 
				
			||||
COMMENT ON COLUMN device_ledger.id IS '设备唯一标识符'; | 
				
			||||
COMMENT ON COLUMN device_ledger.device_name IS '设备的名称'; | 
				
			||||
COMMENT ON COLUMN device_ledger.model_specs IS '设备的规格和型号'; | 
				
			||||
COMMENT ON COLUMN device_ledger.asset_num IS '设备的资产编号'; | 
				
			||||
COMMENT ON COLUMN device_ledger.qr_code_id IS '与设备关联的二维码ID'; | 
				
			||||
COMMENT ON COLUMN device_ledger.service_life IS '设备的预计使用寿命'; | 
				
			||||
COMMENT ON COLUMN device_ledger.device_type IS '设备所属类型(字典值获取)'; | 
				
			||||
COMMENT ON COLUMN device_ledger.tech_params IS '设备的技术参数描述'; | 
				
			||||
COMMENT ON COLUMN device_ledger.tech_doc IS '设备相关的技术文档链接或文件名'; | 
				
			||||
COMMENT ON COLUMN device_ledger.install_time IS '设备的安装日期和时间'; | 
				
			||||
COMMENT ON COLUMN device_ledger.create_time IS '记录创建的时间戳'; | 
				
			||||
COMMENT ON COLUMN device_ledger.update_time IS '记录最后一次更新的时间戳'; | 
				
			||||
COMMENT ON COLUMN device_ledger.create_by IS '创建该记录的用户'; | 
				
			||||
COMMENT ON COLUMN device_ledger.status IS '状态(0:在线或者使用中,1:不在线或者停用)'; | 
				
			||||
COMMENT ON COLUMN device_ledger.is_collection IS '是否是需要采集(0:是,1:不采集)'; | 
				
			||||
COMMENT ON COLUMN device_ledger.is_calc_energy IS '是否计算能效(0:计算,1不计算)'; | 
				
			||||
 | 
				
			||||
-- 为 device_ledger 表的 device_type_id 字段添加索引 | 
				
			||||
CREATE INDEX idx_device_ledger_device_ledger_id ON device_ledger (device_type); | 
				
			||||
 | 
				
			||||
-- 为 device_ledger 表的 create_time 字段添加索引(倒序) | 
				
			||||
CREATE INDEX idx_device_ledger_create_time_desc ON device_ledger (create_time DESC); | 
				
			||||
 | 
				
			||||
--2、创建二维码管理 device_qr_manage 表 | 
				
			||||
CREATE TABLE device_qr_manage ( | 
				
			||||
  id VARCHAR(36) NOT NULL,            -- 设备二维码管理记录ID | 
				
			||||
  serial_num VARCHAR(50) NULL,        -- 设备序列号编号 | 
				
			||||
  pic_content VARCHAR(100) NULL,      -- 二维码图片内容或链接 | 
				
			||||
  device_ledger_id VARCHAR(36),       -- 关联的设备台账ID | 
				
			||||
  device_name VARCHAR(50),            -- 设备名称(冗余字段,方便查询) | 
				
			||||
  bind_time TIMESTAMP NULL,           -- 二维码与设备绑定的时间 | 
				
			||||
  create_time TIMESTAMP NULL,         -- 记录创建的时间戳 | 
				
			||||
  update_time TIMESTAMP NULL,         -- 记录最后一次更新的时间戳 | 
				
			||||
  create_by VARCHAR(100) NULL,        -- 创建该记录的用户 | 
				
			||||
  PRIMARY KEY (id) | 
				
			||||
); | 
				
			||||
 | 
				
			||||
-- 为表添加备注 | 
				
			||||
COMMENT ON TABLE device_qr_manage IS '设备二维码管理表,用于记录设备与二维码之间的绑定关系及二维码相关信息'; | 
				
			||||
 | 
				
			||||
-- 为各列添加备注 | 
				
			||||
COMMENT ON COLUMN device_qr_manage.id IS '设备二维码管理记录的唯一标识符'; | 
				
			||||
COMMENT ON COLUMN device_qr_manage.serial_num IS '设备的序列号,用于唯一识别每个设备'; | 
				
			||||
COMMENT ON COLUMN device_qr_manage.pic_content IS '二维码图片的内容或存储路径'; | 
				
			||||
COMMENT ON COLUMN device_qr_manage.device_ledger_id IS '关联到设备台账表的设备ID,建立外键关系'; | 
				
			||||
COMMENT ON COLUMN device_qr_manage.device_name IS '设备名称,作为冗余字段便于快速查询'; | 
				
			||||
COMMENT ON COLUMN device_qr_manage.bind_time IS '二维码与设备绑定的具体时间'; | 
				
			||||
COMMENT ON COLUMN device_qr_manage.create_time IS '记录创建的时间戳'; | 
				
			||||
COMMENT ON COLUMN device_qr_manage.update_time IS '记录最后一次更新的时间戳'; | 
				
			||||
COMMENT ON COLUMN device_qr_manage.create_by IS '创建该记录的用户'; | 
				
			||||
 | 
				
			||||
-- 为 device_qr_manage 表的 device_ledger_id 字段添加索引 | 
				
			||||
CREATE INDEX idx_device_qr_manage_device_ledger_id ON device_qr_manage (device_ledger_id); | 
				
			||||
 | 
				
			||||
-- 为 device_qr_manage 表的 create_time 字段添加索引(倒序) | 
				
			||||
CREATE INDEX idx_device_qr_manage_create_time_desc ON device_qr_manage (create_time DESC); | 
				
			||||
 | 
				
			||||
--3、采集参数管理表 collection_params_manage 表 | 
				
			||||
CREATE TABLE collection_params_manage ( | 
				
			||||
    id varchar(36) NOT NULL,                -- 主键 | 
				
			||||
    device_ledger_id varchar(36) NULL,      -- 设备台账id | 
				
			||||
    mt_type varchar(10),                     -- 设备类型(字典) | 
				
			||||
    mt_num VARCHAR(20) NULL,                -- 设备地址 | 
				
			||||
    mt_code VARCHAR(20) NULL,               -- 设备采集地址 | 
				
			||||
    register_addr VARCHAR(20) NULL,         -- 寄存器地址 | 
				
			||||
    func_code VARCHAR(20) NULL,             -- 功能码 | 
				
			||||
    identify_code VARCHAR(20) NULL,         -- 数据标识码 | 
				
			||||
    mt_caliber_pulse VARCHAR(20) NULL,      -- 口径 | 
				
			||||
    mt_range NUMERIC(24, 3) NULL,           -- 取值范围 | 
				
			||||
    mt_ratio INT NULL,                      -- 倍率 | 
				
			||||
    mt_init_value NUMERIC(24, 3) NULL,      -- 初始值 | 
				
			||||
    digits INT NULL,                        -- 保留小数位 | 
				
			||||
    data_type INT NULL,                     -- 数据类型(字典) | 
				
			||||
    cur_value NUMERIC(24, 3) NULL,          -- 当前值 | 
				
			||||
    cur_time TIMESTAMP NULL,                -- 采集时间 | 
				
			||||
    mt_is_sum BOOLEAN NULL,                 -- 是否是总表 | 
				
			||||
    unit VARCHAR(20) NULL,                  -- 单位 | 
				
			||||
    sort BIGINT NULL,                       -- 排序 | 
				
			||||
    gateway_id varchar(36) NULL,            -- 网关id | 
				
			||||
    param_id varchar(36) NULL,              -- 串口采集通讯配置id | 
				
			||||
    protocol_type varchar(5) NULL,          -- 协议类型 | 
				
			||||
    communication_type varchar(5) NULL,     -- 通讯类型(字典) | 
				
			||||
    remark varchar(200) NULL,               -- 备注 | 
				
			||||
    register_size INT NULL,                 -- 读取寄存器大小 | 
				
			||||
    is_use INT NULL,                        -- 是否启用采集(0:正常,1:不采集) | 
				
			||||
    create_time TIMESTAMP NULL,             -- 创建时间 | 
				
			||||
    update_time TIMESTAMP NULL,             -- 更新时间 | 
				
			||||
 | 
				
			||||
    PRIMARY KEY (id) | 
				
			||||
); | 
				
			||||
 | 
				
			||||
-- 为表添加备注 | 
				
			||||
COMMENT ON TABLE collection_params_manage IS '仪表管理表,用于记录各种仪表的基本信息、配置及状态'; | 
				
			||||
 | 
				
			||||
-- 为各列添加备注 | 
				
			||||
COMMENT ON COLUMN collection_params_manage.id IS '自增主键'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_type IS '仪表类型ID'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_name IS '仪表名称'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.other_name IS '其他名称'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_brand IS '仪表品牌'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_num IS '仪表编号'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_code IS '仪表代码'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.register_addr IS '注册地址'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.func_code IS '功能代码'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.identify_code IS '识别代码'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_caliber_pulse IS '口径脉冲'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_range IS '量程'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_ratio IS '比例'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_init_value IS '初始值'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.digits IS '位数'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.data_type IS '数据类型'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.cur_value IS '当前值'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.cur_time IS '当前时间'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.mt_is_sum IS '是否累计(0: 否, 1: 是)'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.create_time IS '记录创建的时间戳'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.update_time IS '记录最后一次更新的时间戳'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.unit IS '单位'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.sort IS '排序'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.data_com IS '数据通信配置'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.device_id IS '设备ID'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.gateway_id IS '网关ID'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.param_id IS '参数ID'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.protocol_type IS '协议类型ID'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.communication_type IS '通信类型'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.remark IS '备注'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.register_size IS '注册大小'; | 
				
			||||
COMMENT ON COLUMN collection_params_manage.is_use IS '是否使用(0: 使用, 1: 不使用)'; | 
				
			||||
 | 
				
			||||
-- 为 device_qr_manage 表的 device_ledger_id 字段添加索引 | 
				
			||||
CREATE INDEX idx_meter_manage_mt_type ON collection_params_manage (mt_type); | 
				
			||||
 | 
				
			||||
-- 为 device_qr_manage 表的 create_time 字段添加索引(倒序) | 
				
			||||
CREATE INDEX idx_meter_manage_create_time_desc ON collection_params_manage (create_time DESC); | 
				
			||||
 | 
				
			||||
--4、创建备件/备品管理 spare_parts_manage 表 | 
				
			||||
CREATE TABLE spare_parts_manage ( | 
				
			||||
  id VARCHAR(36) NOT NULL,            -- 备件ID | 
				
			||||
  serial_num VARCHAR(50) NULL,        -- 序列号编号 | 
				
			||||
  spare_name VARCHAR(100) NULL,       -- 备件名称 | 
				
			||||
  model_specs VARCHAR(100) NULL,      -- 规格型号 | 
				
			||||
  device_type_id VARCHAR(50) NULL,    -- 设备类型ID | 
				
			||||
  inventory_levels INT NULL,          -- 当前库存量 | 
				
			||||
  min_inventory_levels INT NULL,      -- 最低库存量阈值 | 
				
			||||
  service_life INT NULL,              -- 使用年限(单位:年) | 
				
			||||
  unit_price NUMERIC(24, 3),          -- 单价(保留三位小数) | 
				
			||||
  create_time TIMESTAMP NULL,         -- 记录创建的时间戳 | 
				
			||||
  update_time TIMESTAMP NULL,         -- 记录最后一次更新的时间戳 | 
				
			||||
  create_by VARCHAR(100) NULL,        -- 创建该记录的用户 | 
				
			||||
  PRIMARY KEY (id) | 
				
			||||
); | 
				
			||||
 | 
				
			||||
-- 为表添加备注 | 
				
			||||
COMMENT ON TABLE spare_parts_manage IS '备品/备件管理表,用于记录所有备件的基本信息、库存情况及价格'; | 
				
			||||
 | 
				
			||||
-- 为各列添加备注 | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.id IS '备件的唯一标识符'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.serial_num IS '备件的序列号,用于唯一识别每个备件'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.spare_name IS '备件的名称'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.model_specs IS '备件的规格和型号'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.device_type_id IS '关联到设备类型的ID,标识备件适用于哪种设备类型'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.inventory_levels IS '当前备件的库存数量'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.min_inventory_levels IS '最低库存量阈值,当库存低于此值时需要补货'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.service_life IS '备件的预计使用年限,单位为年'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.unit_price IS '备件的单价,保留三位小数'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.create_time IS '记录创建的时间戳'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.update_time IS '记录最后一次更新的时间戳'; | 
				
			||||
COMMENT ON COLUMN spare_parts_manage.create_by IS '创建该记录的用户'; | 
				
			||||
 | 
				
			||||
CREATE INDEX idx_spare_parts_device_type_id ON spare_parts_manage (device_type_id); | 
				
			||||
CREATE INDEX idx_spare_parts_create_time_desc ON spare_parts_manage (create_time DESC); | 
				
			||||
 | 
				
			||||
--5、创建出入库管理device_in_out_manage | 
				
			||||
CREATE TABLE device_in_out_manage ( | 
				
			||||
  id VARCHAR(36) NOT NULL,            -- 出入库管理ID | 
				
			||||
  spare_parts_id VARCHAR(36) NULL,    -- 备件ID | 
				
			||||
  spare_name VARCHAR(100) NULL,       -- 备件名称 | 
				
			||||
  opera_type VARCHAR(10) NULL,        -- 出入库操作类型(0:入库,1:出库) | 
				
			||||
  int_out_num INT NULL,               -- 出入库数量 | 
				
			||||
  inventory_levels INT NULL,          -- 当前库存量 | 
				
			||||
  create_time TIMESTAMP NULL,         -- 记录创建的时间戳 | 
				
			||||
  update_time TIMESTAMP NULL,         -- 记录最后一次更新的时间戳 | 
				
			||||
  create_by VARCHAR(100) NULL,        -- 创建该记录的用户 | 
				
			||||
  PRIMARY KEY (id) | 
				
			||||
); | 
				
			||||
 | 
				
			||||
-- 为表添加备注 | 
				
			||||
COMMENT ON TABLE device_in_out_manage IS '备品/备件出入库管理表,用于记录备件的出入库操作及当前库存情况'; | 
				
			||||
 | 
				
			||||
-- 为各列添加备注 | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.id IS '出入库管理记录的唯一标识符'; | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.spare_parts_id IS '关联到备件的唯一标识符,用于标识具体的备件'; | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.spare_name IS '备件的名称,便于快速识别'; | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.opera_type IS '出入库操作类型,0表示入库,1表示出库'; | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.int_out_num IS '本次出入库操作的数量,正值表示入库,负值表示出库'; | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.inventory_levels IS '当前备件的库存数量,在每次出入库操作后更新'; | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.create_time IS '记录创建的时间戳,表示此次出入库操作的时间'; | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.update_time IS '记录最后一次更新的时间戳,通常与 create_time 相同,除非后续有修改'; | 
				
			||||
COMMENT ON COLUMN device_in_out_manage.create_by IS '创建该记录的用户,记录是谁执行了此次出入库操作'; | 
				
			||||
 | 
				
			||||
CREATE INDEX idx_device_in_out_manage_opera_type ON device_in_out_manage (opera_type); | 
				
			||||
CREATE INDEX idx_device_in_out_manage_spare_parts_id ON device_in_out_manage (spare_parts_id); | 
				
			||||
CREATE INDEX idx_device_in_out_manage_create_time_desc ON device_in_out_manage (create_time DESC); | 
				
			||||
 | 
				
			||||
-- 6、创建网关管理 gateway_manage 表 | 
				
			||||
CREATE TABLE gateway_manage ( | 
				
			||||
    id varchar(36) NOT NULL, -- 自增主键 | 
				
			||||
    gw_name VARCHAR(100) NULL, -- 网关名称 | 
				
			||||
    gw_ip VARCHAR(20) NULL, -- 网关IP地址 | 
				
			||||
    gw_addr VARCHAR(100) NULL, -- 网关对应的编号地址 | 
				
			||||
    port INT NULL, -- 网关端口 | 
				
			||||
    collection_loop INT NULL, -- 采集周期 | 
				
			||||
    create_time TIMESTAMP NULL, -- 创建时间 | 
				
			||||
    update_time TIMESTAMP NULL, -- 更新时间 | 
				
			||||
    connect_time TIMESTAMP NULL, -- 连接时间 | 
				
			||||
    internet_card VARCHAR(50) NULL, -- 卡号 | 
				
			||||
    operator_type INT NULL, -- 运营商类型(0: 中国移动, 1: 中国联通, 2: 中国电信) | 
				
			||||
    remark VARCHAR(100) NULL, -- 备注 | 
				
			||||
    communication_type INT NULL, -- 通信类型(字典表) | 
				
			||||
    grade INT NULL, -- 预留字段 | 
				
			||||
    PRIMARY KEY (id) | 
				
			||||
); | 
				
			||||
 | 
				
			||||
-- 为表添加备注 | 
				
			||||
COMMENT ON TABLE gateway_manage IS '网关管理表,用于记录网关的基本信息、配置及状态'; | 
				
			||||
 | 
				
			||||
-- 为各列添加备注 | 
				
			||||
COMMENT ON COLUMN gateway_manage.id IS '编号'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.gw_name IS '网关名称'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.gw_ip IS '网关IP地址'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.gw_addr IS '网关对应的编号地址'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.port IS '网关端口'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.collection_loop IS '采集周期'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.create_time IS '创建时间'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.update_time IS '更新时间'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.connect_time IS '连接时间'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.internet_card IS '卡号'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.operator_type IS '运营商类型(0: 中国移动, 1: 中国联通, 2: 中国电信)'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.remark IS '备注'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.communication_type IS '通信类型(字典表)'; | 
				
			||||
COMMENT ON COLUMN gateway_manage.grade IS '预留字段'; | 
				
			||||
 | 
				
			||||
CREATE INDEX idx_gateway_manage_gw_name ON gateway_manage (gw_name); | 
				
			||||
CREATE INDEX idx_gateway_manage_status ON gateway_manage (status); | 
				
			||||
CREATE INDEX idx_gateway_manage_create_time_desc ON gateway_manage (create_time DESC); | 
				
			||||
ALTER TABLE public.gateway_manage ADD create_by varchar(100) NULL; | 
				
			||||
COMMENT ON COLUMN public.gateway_manage.create_by IS '创建者'; | 
				
			||||
ALTER TABLE public.gateway_manage ADD update_by varchar(100) NULL; | 
				
			||||
COMMENT ON COLUMN public.gateway_manage.update_by IS '更新者'; | 
				
			||||
ALTER TABLE public.gateway_manage ADD status int NULL; | 
				
			||||
COMMENT ON COLUMN public.gateway_manage.status IS '状态(0:在线,1:离线)'; | 
				
			||||
 | 
				
			||||
 | 
				
			||||
 | 
				
			||||
-- 7、通讯采集参数创建 device_params 表 | 
				
			||||
CREATE TABLE communication_params ( | 
				
			||||
    id varchar(36) NOT NULL, -- 自增主键 | 
				
			||||
    mt_type INT NOT NULL, -- 仪表类型(从字典中获取) | 
				
			||||
    baud_rate INT NOT NULL, -- 波特率 | 
				
			||||
    data_bit INT NOT NULL, -- 数据位 | 
				
			||||
    stop_bit INT NOT NULL, -- 停止位 | 
				
			||||
    parity VARCHAR(10) NOT NULL, -- 校验位 | 
				
			||||
    remark VARCHAR(100) NULL, -- 备注 | 
				
			||||
    PRIMARY KEY (id) | 
				
			||||
); | 
				
			||||
 | 
				
			||||
-- 为表添加备注 | 
				
			||||
COMMENT ON TABLE communication_params IS '设备采集参数表,用于记录设备的通信参数'; | 
				
			||||
 | 
				
			||||
-- 为各列添加备注 | 
				
			||||
COMMENT ON COLUMN communication_params.id IS '编号'; | 
				
			||||
COMMENT ON COLUMN communication_params.mt_type IS '仪表类型(从字典中获取)'; | 
				
			||||
COMMENT ON COLUMN communication_params.baud_rate IS '波特率'; | 
				
			||||
COMMENT ON COLUMN communication_params.data_bit IS '数据位'; | 
				
			||||
COMMENT ON COLUMN communication_params.stop_bit IS '停止位'; | 
				
			||||
COMMENT ON COLUMN communication_params.parity IS '校验位'; | 
				
			||||
COMMENT ON COLUMN communication_params.remark IS '备注'; | 
				
			||||
 | 
				
			||||
ALTER TABLE public.communication_params ADD create_by varchar(100) NULL; | 
				
			||||
COMMENT ON COLUMN public.communication_params.create_by IS '创建者'; | 
				
			||||
ALTER TABLE public.communication_params ADD update_by varchar(100) NULL; | 
				
			||||
COMMENT ON COLUMN public.communication_params.update_by IS '更新者'; | 
				
			||||
 | 
				
			||||
-- 8、维保管理 | 
				
			||||
CREATE TABLE maintain_info | 
				
			||||
( | 
				
			||||
    id              varchar(36) NOT NULL, | 
				
			||||
    device_id	    varchar(36) ,	-- 设备表id | 
				
			||||
    device_type     VARCHAR(32) NULL, | 
				
			||||
    maintain_type   VARCHAR(50) NULL, | 
				
			||||
    maintain_people VARCHAR(50) NULL, | 
				
			||||
    cost            NUMERIC(24, 2) NULL, | 
				
			||||
    contents        VARCHAR(100) NULL, | 
				
			||||
    evaluate        VARCHAR(10) NULL, | 
				
			||||
    exec_time        timestamp NULL,	-- 维修时间 | 
				
			||||
    spend_times        int NULL,		-- 花费时间 | 
				
			||||
    create_time TIMESTAMP NULL, -- 创建时间 | 
				
			||||
    update_time TIMESTAMP NULL, -- 更新时间 | 
				
			||||
    create_by varchar(100) NULL, | 
				
			||||
    update_by varchar(100) NULL, | 
				
			||||
    PRIMARY KEY (id) | 
				
			||||
); | 
				
			||||
CREATE INDEX idx_maintain_info_create_time_desc ON maintain_info (create_time DESC); | 
				
			||||
CREATE INDEX idx_maintain_info_maintain_people_desc ON maintain_info (maintain_people); | 
				
			||||
COMMENT ON TABLE maintain_info IS '维保管理:登记维护信息'; | 
				
			||||
-- Extended properties | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.id IS '序号'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.device_id IS '设备id'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.device_type IS '设备类型'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.maintain_type IS '维护类型'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.maintain_people IS '维护人员'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.cost IS '材料费用'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.contents IS '维保内容'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.evaluate IS '评价内容'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.create_time IS '创建时间'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.update_time IS '更新时间'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.create_by IS '创建者'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.update_by IS '更新者'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.exec_time IS '执行维修时间'; | 
				
			||||
COMMENT | 
				
			||||
ON COLUMN maintain_info.spend_times IS '维修花费时间'; | 
				
			||||
					Loading…
					
					
				
		Reference in new issue