From 1de194e247b9427a65814bee0220125155227d45 Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Fri, 17 Oct 2025 10:28:01 +0800 Subject: [PATCH] =?UTF-8?q?feat(portal):=20=E6=B7=BB=E5=8A=A0=20typeId=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修改 SQL 查询语句,插入语句和更新语句以支持 typeId 条件 - 在服务实现中设置 typeId 和 deviceId用于唯一性校验 - 在 HwWeb1 实体类中新增 typeId 属性及其 getter/setter 方法 - 更新 toString 方法以包含 typeId 字段 - 在 HwWebMapper1.xml 中添加 typeId 的映射配置 --- .../main/java/com/ruoyi/portal/domain/HwWeb1.java | 12 ++++++++++++ .../ruoyi/portal/service/impl/HwWebServiceImpl1.java | 2 ++ .../main/resources/mapper/portal/HwWebMapper1.xml | 11 +++++++++-- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb1.java index ff6e245..dfb7674 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb1.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb1.java @@ -32,6 +32,8 @@ public class HwWeb1 extends BaseEntity private Long deviceId; + private Long typeId; + public void setWebId(Long webId) { this.webId = webId; @@ -77,6 +79,15 @@ public class HwWeb1 extends BaseEntity this.deviceId = deviceId; } + public Long getTypeId() { + return typeId; + } + + public void setTypeId(Long typeId) { + this.typeId = typeId; + } + + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -85,6 +96,7 @@ public class HwWeb1 extends BaseEntity .append("webJsonString", getWebJsonString()) .append("webCode", getWebCode()) .append("deviceId", getDeviceId()) + .append("typeId", getTypeId()) .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl1.java index cf7b997..61143d6 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl1.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl1.java @@ -72,6 +72,8 @@ public class HwWebServiceImpl1 implements IHwWebService1 HwWeb1 codeWeb = new HwWeb1(); //编号唯一 codeWeb.setWebCode(hwWeb1.getWebCode()); + codeWeb.setTypeId(hwWeb1.getTypeId()); + codeWeb.setDeviceId(hwWeb1.getDeviceId()); if(hwWebMapper1.selectHwWebList(codeWeb).isEmpty()){ return hwWebMapper1.insertHwWeb(hwWeb1); } diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper1.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper1.xml index 2f56147..f4c5020 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper1.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper1.xml @@ -10,11 +10,12 @@ + select web_id, web_json, web_json_string, web_code, - device_id + device_id,typeId from hw_web1 @@ -26,6 +27,7 @@ and web_json_string = #{webJsonString} and web_code = #{webCode} and device_id = #{deviceId} + and typeId = #{typeId} @@ -41,12 +43,14 @@ web_json_string, web_code, device_id, + typeId, #{webJson}, #{webJsonString}, #{webCode}, #{deviceId}, + #{typeId}, @@ -56,9 +60,12 @@ web_json = #{webJson}, web_json_string = #{webJsonString}, - device_id = #{deviceId}, + + where web_code = #{webCode} + and device_id = #{deviceId} + and typeId = #{typeId}