diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb.java index fb5b79f..2581d01 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb.java @@ -30,6 +30,9 @@ public class HwWeb extends BaseEntity @Excel(name = "页面") private Long webCode; + /** 逻辑删除标志:'0'未删除,'1'已删除 */ + private String isDelete; + public void setWebId(Long webId) { this.webId = webId; @@ -67,6 +70,14 @@ public class HwWeb extends BaseEntity return webCode; } + public String getIsDelete() { + return isDelete; + } + + public void setIsDelete(String isDelete) { + this.isDelete = isDelete; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -74,6 +85,7 @@ public class HwWeb extends BaseEntity .append("webJson", getWebJson()) .append("webJsonString", getWebJsonString()) .append("webCode", getWebCode()) + .append("isDelete", getIsDelete()) .toString(); } } 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 dfb7674..cff4d50 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 @@ -6,7 +6,7 @@ import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.BaseEntity; /** - * haiwei官网json对象 hw_web + * haiwei官网json对象 hw_web1 * * @author ruoyi * @date 2025-08-18 @@ -34,6 +34,9 @@ public class HwWeb1 extends BaseEntity private Long typeId; + /** 逻辑删除标志:'0'未删除,'1'已删除 */ + private String isDelete; + public void setWebId(Long webId) { this.webId = webId; @@ -87,6 +90,13 @@ public class HwWeb1 extends BaseEntity this.typeId = typeId; } + public String getIsDelete() { + return isDelete; + } + + public void setIsDelete(String isDelete) { + this.isDelete = isDelete; + } @Override public String toString() { @@ -97,6 +107,7 @@ public class HwWeb1 extends BaseEntity .append("webCode", getWebCode()) .append("deviceId", getDeviceId()) .append("typeId", getTypeId()) + .append("isDelete", getIsDelete()) .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebDocument.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebDocument.java index 8326ebc..b78cf04 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebDocument.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebDocument.java @@ -40,6 +40,9 @@ public class HwWebDocument extends BaseEntity /** 文件类型 */ private String type; + /** 逻辑删除标志:'0'未删除,'1'已删除 */ + private String isDelete; + public void setDocumentId(String documentId) { this.documentId = documentId; @@ -102,6 +105,14 @@ public class HwWebDocument extends BaseEntity this.type = type; } + public String getIsDelete() { + return isDelete; + } + + public void setIsDelete(String isDelete) { + this.isDelete = isDelete; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -111,8 +122,9 @@ public class HwWebDocument extends BaseEntity .append("createTime", getCreateTime()) .append("webCode", getWebCode()) .append("secretKey", getSecretKey()) - .append("json", getJson()) - .append("type", getType()) + .append("json", getJson()) + .append("type", getType()) + .append("isDelete", getIsDelete()) .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu.java index 6df3911..8620e66 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu.java @@ -44,6 +44,9 @@ public class HwWebMenu extends TreeEntity @Excel(name = "官网菜单类型") private Long webMenuType; + /** 逻辑删除标志:'0'未删除,'1'已删除 */ + private String isDelete; + public void setWebMenuId(Long webMenuId) { this.webMenuId = webMenuId; @@ -108,6 +111,14 @@ public class HwWebMenu extends TreeEntity return webMenuType; } + public String getIsDelete() { + return isDelete; + } + + public void setIsDelete(String isDelete) { + this.isDelete = isDelete; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -119,6 +130,7 @@ public class HwWebMenu extends TreeEntity .append("tenantId", getTenantId()) .append("webMenuPic", getWebMenuPic()) .append("webMenuType", getWebMenuType()) + .append("isDelete", getIsDelete()) .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu1.java index 7b0b6a2..901ccb2 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu1.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu1.java @@ -8,7 +8,7 @@ import com.ruoyi.common.core.web.domain.TreeEntity; import java.util.List; /** - * haiwei官网菜单对象 hw_web_menu + * haiwei官网菜单对象 hw_web_menu1 * * @author zch * @date 2025-08-18 @@ -46,6 +46,9 @@ public class HwWebMenu1 extends TreeEntity private String valuel; + /** 逻辑删除标志:'0'未删除,'1'已删除 */ + private String isDelete; + public void setWebMenuId(Long webMenuId) { this.webMenuId = webMenuId; @@ -117,6 +120,14 @@ public class HwWebMenu1 extends TreeEntity this.valuel = valuel; } + public String getIsDelete() { + return isDelete; + } + + public void setIsDelete(String isDelete) { + this.isDelete = isDelete; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -129,6 +140,7 @@ public class HwWebMenu1 extends TreeEntity .append("webMenuPic", getWebMenuPic()) .append("webMenuType", getWebMenuType()) .append("valuel", getValuel()) + .append("isDelete", getIsDelete()) .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl.java index b915db7..96b507f 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl.java @@ -71,10 +71,15 @@ public class HwWebServiceImpl implements IHwWebService HwWeb codeWeb = new HwWeb(); //编号唯一 codeWeb.setWebCode(hwWeb.getWebCode()); - if(hwWebMapper.selectHwWebList(codeWeb).isEmpty()){ - return hwWebMapper.insertHwWeb(hwWeb); + List exists = hwWebMapper.selectHwWebList(codeWeb); + if (!exists.isEmpty()) { + Long[] webIds = exists.stream().map(HwWeb::getWebId).toArray(Long[]::new); + hwWebMapper.deleteHwWebByWebIds(webIds); } - return hwWebMapper.updateHwWeb(hwWeb); + // 插入新记录,避免复用旧主键 + // hwWeb.setWebId(null); + hwWeb.setIsDelete("0"); + return hwWebMapper.insertHwWeb(hwWeb); } /** 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 f1dc951..c1f1dd9 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 @@ -76,14 +76,19 @@ public class HwWebServiceImpl1 implements IHwWebService1 public int updateHwWeb(HwWeb1 hwWeb1) { HwWeb1 codeWeb = new HwWeb1(); - //编号唯一 + // 编号、typeid、deviceID保证唯一 codeWeb.setWebCode(hwWeb1.getWebCode()); codeWeb.setTypeId(hwWeb1.getTypeId()); codeWeb.setDeviceId(hwWeb1.getDeviceId()); - if(hwWebMapper1.selectHwWebList(codeWeb).isEmpty()){ - return hwWebMapper1.insertHwWeb(hwWeb1); + List exists = hwWebMapper1.selectHwWebList(codeWeb); + if (!exists.isEmpty()) { + Long[] webIds = exists.stream().map(HwWeb1::getWebId).toArray(Long[]::new); + hwWebMapper1.deleteHwWebByWebIds(webIds); } - return hwWebMapper1.updateHwWeb(hwWeb1); + // 插入新记录,避免复用旧主键 + // hwWeb1.setWebId(null); + hwWeb1.setIsDelete("0"); + return hwWebMapper1.insertHwWeb(hwWeb1); } /** diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebDocumentMapper.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebDocumentMapper.xml index a15ef1b..d51d660 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebDocumentMapper.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebDocumentMapper.xml @@ -13,17 +13,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + select document_id, tenant_id, document_address, create_time, web_code, secretKey , - json,type + json, type, + is_delete from hw_web_document - where document_id = #{documentId} + where is_delete = '0' and document_id = #{documentId} @@ -50,6 +53,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" secretKey, json, type, + is_delete, #{documentId}, @@ -60,6 +64,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{secretKey}, #{json}, #{type}, + + #{isDelete}, + '0', + @@ -78,14 +86,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where document_id = #{documentId} - - delete from hw_web_document where document_id = #{documentId} - + + update hw_web_document set is_delete = '1' where document_id = #{documentId} + - - delete from hw_web_document where document_id in + + update hw_web_document set is_delete = '1' where document_id in #{documentId} - + \ No newline at end of file diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper.xml index d7e794d..fbe5739 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper.xml @@ -9,15 +9,19 @@ + - select web_id, web_json, web_json_string, web_code from hw_web + select web_id, web_json, web_json_string, web_code, + is_delete + from hw_web - where web_code = #{webCode} + where is_delete = '0' and web_code = #{webCode} @@ -36,11 +40,16 @@ web_json, web_json_string, web_code, + is_delete, #{webJson}, #{webJsonString}, #{webCode}, + + #{isDelete}, + '0', + @@ -54,14 +63,14 @@ where web_code = #{webCode} - - delete from hw_web where web_id = #{webId} - + + update hw_web set is_delete = '1' where web_id = #{webId} + - - delete from hw_web where web_id in + + update hw_web set is_delete = '1' where web_id in #{webId} - + \ No newline at end of file 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 ee172b0..6ca428d 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 @@ -11,17 +11,20 @@ + select web_id, web_json, web_json_string, web_code, - device_id,typeId + device_id, typeId, + is_delete from hw_web1 - where web_code = #{webCode} + where is_delete = '0' and web_code = #{webCode} @@ -51,6 +54,7 @@ web_code, device_id, typeId, + is_delete, #{webJson}, @@ -58,6 +62,10 @@ #{webCode}, #{deviceId}, #{typeId}, + + #{isDelete}, + '0', + @@ -75,14 +83,14 @@ and typeId = #{typeId} - - delete from hw_web1 where web_id = #{webId} - + + update hw_web1 set is_delete = '1' where web_id = #{webId} + - - delete from hw_web1 where web_id in + + update hw_web1 set is_delete = '1' where web_id in #{webId} - + \ No newline at end of file diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper.xml index fb75ca1..7e5cc89 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper.xml @@ -13,15 +13,19 @@ + - select web_menu_id, parent, ancestors, status, web_menu_name, tenant_id, web_menu__pic, web_menu_type from hw_web_menu + select web_menu_id, parent, ancestors, status, web_menu_name, tenant_id, web_menu__pic, web_menu_type, + is_delete + from hw_web_menu - where web_menu_id = #{webMenuId} + where is_delete = '0' and web_menu_id = #{webMenuId} @@ -48,6 +52,7 @@ tenant_id, web_menu__pic, web_menu_type, + is_delete, #{webMenuId}, @@ -58,6 +63,10 @@ #{tenantId}, #{webMenuPic}, #{webMenuType}, + + #{isDelete}, + '0', + @@ -75,14 +84,14 @@ where web_menu_id = #{webMenuId} - - delete from hw_web_menu where web_menu_id = #{webMenuId} - + + update hw_web_menu set is_delete = '1' where web_menu_id = #{webMenuId} + - - delete from hw_web_menu where web_menu_id in + + update hw_web_menu set is_delete = '1' where web_menu_id in #{webMenuId} - + \ No newline at end of file diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml index dc8a876..039634d 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml @@ -14,17 +14,21 @@ + select web_menu_id, parent, ancestors, status, web_menu_name, tenant_id, web_menu__pic, value, - web_menu_type from hw_web_menu1 + web_menu_type, + is_delete + from hw_web_menu1 - where web_menu_id = #{webMenuId} + where is_delete = '0' and web_menu_id = #{webMenuId} @@ -53,6 +57,7 @@ web_menu__pic, web_menu_type, value, + is_delete, #{webMenuId}, @@ -64,6 +69,10 @@ #{webMenuPic}, #{webMenuType}, #{value}, + + #{isDelete}, + '0', + @@ -82,14 +91,14 @@ where web_menu_id = #{webMenuId} - - delete from hw_web_menu1 where web_menu_id = #{webMenuId} - + + update hw_web_menu1 set is_delete = '1' where web_menu_id = #{webMenuId} + - - delete from hw_web_menu1 where web_menu_id in + + update hw_web_menu1 set is_delete = '1' where web_menu_id in #{webMenuId} - + \ No newline at end of file