From 0ff03d21955ea8d3f8d25391f160c91ec3fb5fec Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 Aug 2025 10:15:10 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat(portal):=20=E6=B7=BB=E5=8A=A0=20haiwei?= =?UTF-8?q?=E5=AE=98=E7=BD=91=20JSON=20=E6=95=B0=E6=8D=AE=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 HwWeb 实体类,用于存储官网 JSON 数据 - 实现 HwWeb 相关的 CRUD 接口和方法,包括列表查询、导出、详情、新增、修改和删除 - 添加对应的 Mapper 接口和 XML 文件,实现与数据库的交互 - 实现 HwWeb 服务层接口和具体实现类,提供业务逻辑处理 --- .../portal/controller/HwWebController.java | 105 ++++++++++++++++++ .../java/com/ruoyi/portal/domain/HwWeb.java | 51 +++++++++ .../com/ruoyi/portal/mapper/HwWebMapper.java | 61 ++++++++++ .../ruoyi/portal/service/IHwWebService.java | 61 ++++++++++ .../portal/service/impl/HwWebServiceImpl.java | 93 ++++++++++++++++ .../resources/mapper/portal/HwWebMapper.xml | 56 ++++++++++ 6 files changed, 427 insertions(+) create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb.java create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper.java create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService.java create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl.java create mode 100644 ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper.xml diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java new file mode 100644 index 0000000..d5be4ee --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java @@ -0,0 +1,105 @@ +package com.ruoyi.portal.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.portal.domain.HwWeb; +import com.ruoyi.portal.service.IHwWebService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * haiwei官网jsonController + * + * @author ruoyi + * @date 2025-08-18 + */ +@RestController +@RequestMapping("/hwWeb") +public class HwWebController extends BaseController +{ + @Autowired + private IHwWebService hwWebService; + + /** + * 查询haiwei官网json列表 + */ + @RequiresPermissions("portal:hwWeb:list") + @GetMapping("/list") + public TableDataInfo list(HwWeb hwWeb) + { + startPage(); + List list = hwWebService.selectHwWebList(hwWeb); + return getDataTable(list); + } + + /** + * 导出haiwei官网json列表 + */ + @RequiresPermissions("portal:hwWeb:export") + @Log(title = "haiwei官网json", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwWeb hwWeb) + { + List list = hwWebService.selectHwWebList(hwWeb); + ExcelUtil util = new ExcelUtil(HwWeb.class); + util.exportExcel(response, list, "haiwei官网json数据"); + } + + /** + * 获取haiwei官网json详细信息 + */ + @RequiresPermissions("portal:hwWeb:query") + @GetMapping(value = "/{webId}") + public AjaxResult getInfo(@PathVariable("webId") Long webId) + { + return success(hwWebService.selectHwWebByWebId(webId)); + } + + /** + * 新增haiwei官网json + */ + @RequiresPermissions("portal:hwWeb:add") + @Log(title = "haiwei官网json", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwWeb hwWeb) + { + return toAjax(hwWebService.insertHwWeb(hwWeb)); + } + + /** + * 修改haiwei官网json + */ + @RequiresPermissions("portal:hwWeb:edit") + @Log(title = "haiwei官网json", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwWeb hwWeb) + { + return toAjax(hwWebService.updateHwWeb(hwWeb)); + } + + /** + * 删除haiwei官网json + */ + @RequiresPermissions("portal:hwWeb:remove") + @Log(title = "haiwei官网json", businessType = BusinessType.DELETE) + @DeleteMapping("/{webIds}") + public AjaxResult remove(@PathVariable Long[] webIds) + { + return toAjax(hwWebService.deleteHwWebByWebIds(webIds)); + } +} 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 new file mode 100644 index 0000000..3650335 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb.java @@ -0,0 +1,51 @@ +package com.ruoyi.portal.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * haiwei官网json对象 hw_web + * + * @author ruoyi + * @date 2025-08-18 + */ +public class HwWeb extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long webId; + + /** json */ + @Excel(name = "json") + private String webJson; + + public void setWebId(Long webId) + { + this.webId = webId; + } + + public Long getWebId() + { + return webId; + } + public void setWebJson(String webJson) + { + this.webJson = webJson; + } + + public String getWebJson() + { + return webJson; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("webId", getWebId()) + .append("webJson", getWebJson()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper.java new file mode 100644 index 0000000..5d49829 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.portal.mapper; + +import java.util.List; +import com.ruoyi.portal.domain.HwWeb; + +/** + * haiwei官网jsonMapper接口 + * + * @author ruoyi + * @date 2025-08-18 + */ +public interface HwWebMapper +{ + /** + * 查询haiwei官网json + * + * @param webId haiwei官网json主键 + * @return haiwei官网json + */ + public HwWeb selectHwWebByWebId(Long webId); + + /** + * 查询haiwei官网json列表 + * + * @param hwWeb haiwei官网json + * @return haiwei官网json集合 + */ + public List selectHwWebList(HwWeb hwWeb); + + /** + * 新增haiwei官网json + * + * @param hwWeb haiwei官网json + * @return 结果 + */ + public int insertHwWeb(HwWeb hwWeb); + + /** + * 修改haiwei官网json + * + * @param hwWeb haiwei官网json + * @return 结果 + */ + public int updateHwWeb(HwWeb hwWeb); + + /** + * 删除haiwei官网json + * + * @param webId haiwei官网json主键 + * @return 结果 + */ + public int deleteHwWebByWebId(Long webId); + + /** + * 批量删除haiwei官网json + * + * @param webIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwWebByWebIds(Long[] webIds); +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService.java new file mode 100644 index 0000000..105ba1c --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService.java @@ -0,0 +1,61 @@ +package com.ruoyi.portal.service; + +import java.util.List; +import com.ruoyi.portal.domain.HwWeb; + +/** + * haiwei官网jsonService接口 + * + * @author ruoyi + * @date 2025-08-18 + */ +public interface IHwWebService +{ + /** + * 查询haiwei官网json + * + * @param webId haiwei官网json主键 + * @return haiwei官网json + */ + public HwWeb selectHwWebByWebId(Long webId); + + /** + * 查询haiwei官网json列表 + * + * @param hwWeb haiwei官网json + * @return haiwei官网json集合 + */ + public List selectHwWebList(HwWeb hwWeb); + + /** + * 新增haiwei官网json + * + * @param hwWeb haiwei官网json + * @return 结果 + */ + public int insertHwWeb(HwWeb hwWeb); + + /** + * 修改haiwei官网json + * + * @param hwWeb haiwei官网json + * @return 结果 + */ + public int updateHwWeb(HwWeb hwWeb); + + /** + * 批量删除haiwei官网json + * + * @param webIds 需要删除的haiwei官网json主键集合 + * @return 结果 + */ + public int deleteHwWebByWebIds(Long[] webIds); + + /** + * 删除haiwei官网json信息 + * + * @param webId haiwei官网json主键 + * @return 结果 + */ + public int deleteHwWebByWebId(Long webId); +} 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 new file mode 100644 index 0000000..98250fc --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.portal.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.portal.mapper.HwWebMapper; +import com.ruoyi.portal.domain.HwWeb; +import com.ruoyi.portal.service.IHwWebService; + +/** + * haiwei官网jsonService业务层处理 + * + * @author ruoyi + * @date 2025-08-18 + */ +@Service +public class HwWebServiceImpl implements IHwWebService +{ + @Autowired + private HwWebMapper hwWebMapper; + + /** + * 查询haiwei官网json + * + * @param webId haiwei官网json主键 + * @return haiwei官网json + */ + @Override + public HwWeb selectHwWebByWebId(Long webId) + { + return hwWebMapper.selectHwWebByWebId(webId); + } + + /** + * 查询haiwei官网json列表 + * + * @param hwWeb haiwei官网json + * @return haiwei官网json + */ + @Override + public List selectHwWebList(HwWeb hwWeb) + { + return hwWebMapper.selectHwWebList(hwWeb); + } + + /** + * 新增haiwei官网json + * + * @param hwWeb haiwei官网json + * @return 结果 + */ + @Override + public int insertHwWeb(HwWeb hwWeb) + { + return hwWebMapper.insertHwWeb(hwWeb); + } + + /** + * 修改haiwei官网json + * + * @param hwWeb haiwei官网json + * @return 结果 + */ + @Override + public int updateHwWeb(HwWeb hwWeb) + { + return hwWebMapper.updateHwWeb(hwWeb); + } + + /** + * 批量删除haiwei官网json + * + * @param webIds 需要删除的haiwei官网json主键 + * @return 结果 + */ + @Override + public int deleteHwWebByWebIds(Long[] webIds) + { + return hwWebMapper.deleteHwWebByWebIds(webIds); + } + + /** + * 删除haiwei官网json信息 + * + * @param webId haiwei官网json主键 + * @return 结果 + */ + @Override + public int deleteHwWebByWebId(Long webId) + { + return hwWebMapper.deleteHwWebByWebId(webId); + } +} 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 new file mode 100644 index 0000000..aa09e41 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + select web_id, web_json from hw_web + + + + + + + + insert into hw_web + + web_json, + + + #{webJson}, + + + + + update hw_web + + web_json = #{webJson}, + + where web_id = #{webId} + + + + delete from hw_web where web_id = #{webId} + + + + delete from hw_web where web_id in + + #{webId} + + + \ No newline at end of file From dcf432f9cc0d19021ac6777756a0fbe81145f3d9 Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 Aug 2025 10:25:38 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat(portal):=20=E9=97=A8=E6=88=B7=E7=BD=91?= =?UTF-8?q?=E7=AB=99=E9=85=8D=E7=BD=AE=E5=92=8C=E4=BA=A7=E5=93=81=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 HwPortalConfig 模型中添加新字段,用于展示在首页配置类型的相关信息 - 新增 HwPortalConfigMapper 中的 selectHwPortalConfigList2 方法,用于查询门户网站配置列表 - 更新 HwPortalConfigServiceImpl 中的 selectHwPortalConfigList 方法,增加对新配置类型的支持 - 在 HwProductInfoDetail 模型中添加 configModel 字段,用于定义配置模式 - 更新 HwProductInfoMapper.xml 中的查询语句,增加 config_model 列的返回 - 修改 HwProductInfoServiceImpl 中的查询方法,对特定配置模式进行树形结构转换 --- .../ruoyi/portal/domain/HwPortalConfig.java | 64 +++++++++++++++++++ .../portal/domain/HwProductInfoDetail.java | 11 ++++ .../portal/mapper/HwPortalConfigMapper.java | 9 +++ .../impl/HwPortalConfigServiceImpl.java | 4 ++ .../impl/HwProductInfoServiceImpl.java | 11 ++++ .../mapper/portal/HwPortalConfigMapper.xml | 58 ++++++++++++++++- .../mapper/portal/HwProductInfoMapper.xml | 6 +- 7 files changed, 161 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfig.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfig.java index 6340da4..8ec7db5 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfig.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwPortalConfig.java @@ -51,6 +51,14 @@ public class HwPortalConfig extends BaseEntity private String configTypeName; + + private String homeConfigTypePic; + private String homeConfigTypeIcon; + private String homeConfigTypeName; + private String homeConfigTypeClassfication; + private Long parentId; + private String ancestors; + public void setPortalConfigId(Long portalConfigId) { this.portalConfigId = portalConfigId; @@ -141,6 +149,55 @@ public class HwPortalConfig extends BaseEntity this.configTypeName = configTypeName; } + + public String getHomeConfigTypePic() { + return homeConfigTypePic; + } + + public void setHomeConfigTypePic(String homeConfigTypePic) { + this.homeConfigTypePic = homeConfigTypePic; + } + + public String getHomeConfigTypeIcon() { + return homeConfigTypeIcon; + } + + public void setHomeConfigTypeIcon(String homeConfigTypeIcon) { + this.homeConfigTypeIcon = homeConfigTypeIcon; + } + + public String getHomeConfigTypeName() { + return homeConfigTypeName; + } + + public void setHomeConfigTypeName(String homeConfigTypeName) { + this.homeConfigTypeName = homeConfigTypeName; + } + + public String getHomeConfigTypeClassfication() { + return homeConfigTypeClassfication; + } + + public void setHomeConfigTypeClassfication(String homeConfigTypeClassfication) { + this.homeConfigTypeClassfication = homeConfigTypeClassfication; + } + + public Long getParentId() { + return parentId; + } + + public void setParentId(Long parentId) { + this.parentId = parentId; + } + + public String getAncestors() { + return ancestors; + } + + public void setAncestors(String ancestors) { + this.ancestors = ancestors; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -156,6 +213,13 @@ public class HwPortalConfig extends BaseEntity .append("createBy", getCreateBy()) .append("updateTime", getUpdateTime()) .append("updateBy", getUpdateBy()) + .append("configTypeName", getConfigTypeName()) + .append("homeConfigTypePic", getHomeConfigTypePic()) + .append("homeConfigTypeIcon", getHomeConfigTypeIcon()) + .append("homeConfigTypeName", getHomeConfigTypeName()) + .append("homeConfigTypeClassfication", getHomeConfigTypeClassfication()) + .append("parentId", getParentId()) + .append("ancestors", getAncestors()) .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfoDetail.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfoDetail.java index 52411d3..dc5dc4b 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfoDetail.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwProductInfoDetail.java @@ -29,6 +29,10 @@ public class HwProductInfoDetail extends TreeEntity @Excel(name = "配置模式(1图标 +文字+内容横铺4个2左标题+内容,右图片;3左图标,右标题+内容,一行2个;4左大图右标题+内容,一行2个;5上标题+下图片,6上标题+内容,下图片;7图标标题内容,一行3个,8一张图9上图下内容,一行4个);针对右children时配置的") private String configModal; + /** 配置模式(1图标 +文字+内容横铺4个2左标题+内容,右图片;3左图标,右标题+内容,一行2个;4左大图右标题+内容,一行2个;5上标题+下图片,6上标题+内容,下图片;7图标标题内容,一行3个,8一张图9上图下内容,一行4个);针对右children时配置的 */ + @Excel(name = "配置模式(1图标 +文字+内容横铺4个2左标题+内容,右图片;3左图标,右标题+内容,一行2个;4左大图右标题+内容,一行2个;5上标题+下图片,6上标题+内容,下图片;7图标标题内容,一行3个,8一张图9上图下内容,一行4个);针对右children时配置的") + private String configModel; + /** 标题 */ @Excel(name = "标题") private String productInfoDetailTitle; @@ -120,6 +124,13 @@ public class HwProductInfoDetail extends TreeEntity this.hwProductInfoDetailList = hwProductInfoDetailList; } + public String getConfigModel() { + return configModel; + } + + public void setConfigModel(String configModel) { + this.configModel = configModel; + } @Override public String toString() { diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigMapper.java index 6cb3d47..7175f7d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwPortalConfigMapper.java @@ -69,4 +69,13 @@ public interface HwPortalConfigMapper public List selectHwPortalConfigJoinList(HwPortalConfig hwPortalConfig); + /** + * 查询门户网站配置列表 + * + * @param hwPortalConfig 门户网站配置 + * @return 门户网站配置集合 + */ + public List selectHwPortalConfigList2(HwPortalConfig hwPortalConfig); + + } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigServiceImpl.java index c5c63b2..fb882cc 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwPortalConfigServiceImpl.java @@ -42,6 +42,10 @@ public class HwPortalConfigServiceImpl implements IHwPortalConfigService @Override public List selectHwPortalConfigList(HwPortalConfig hwPortalConfig) { + if("2".equals(hwPortalConfig.getPortalConfigType())){ + List hwPortalConfigs = hwPortalConfigMapper.selectHwPortalConfigList2(hwPortalConfig); + return hwPortalConfigs; + } return hwPortalConfigMapper.selectHwPortalConfigList(hwPortalConfig); } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoServiceImpl.java index 4e4188b..7d00b7a 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwProductInfoServiceImpl.java @@ -123,6 +123,17 @@ public class HwProductInfoServiceImpl implements IHwProductInfoService } } } + + for (HwProductInfo productInfo : hwProductInfoJoinDetailList) { + List hwProductInfoDetailList = productInfo.getHwProductInfoDetailList(); + for (HwProductInfoDetail hwProductInfoDetail : hwProductInfoDetailList) { + if ("13".equals(hwProductInfoDetail.getConfigModel())){ + // 将每个产品信息的明细列表转换为树形结构 + List treeStructureList = buildProductInfoDetailTree(productInfo.getHwProductInfoDetailList()); + productInfo.setHwProductInfoDetailList(treeStructureList); + } + } + } return hwProductInfoJoinDetailList; } diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwPortalConfigMapper.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwPortalConfigMapper.xml index 4e39e7d..b0f9fd3 100644 --- a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwPortalConfigMapper.xml +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwPortalConfigMapper.xml @@ -21,8 +21,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + + + + + + + + + + + + + + + + + + + + + - select portal_config_id, portal_config_type,portal_config_type_id, portal_config_title, portal_config_order, portal_config_desc, button_name, router_address, portal_config_pic, create_time, create_by, update_time, update_by from hw_portal_config + select portal_config_id, portal_config_type,portal_config_type_id, portal_config_title, portal_config_order, + portal_config_desc, button_name, router_address, portal_config_pic, create_time, create_by, update_time, + update_by + from hw_portal_config + + + + select hpc.portal_config_id, hpc.portal_config_type,hpc.portal_config_type_id, hpc.portal_config_title, hpc.portal_config_order, + hpc.portal_config_desc, hpc.button_name, hpc.router_address, hpc.portal_config_pic, hpc.create_time, hpc.create_by, hpc.update_time, + hpc.update_by, + hpct.config_type_name, + hpct.home_config_type_pic, + hpct.config_type_icon, + hpct.home_config_type_name, + hpct.config_type_classfication, + hpct.parent_id, + hpct.ancestors + from hw_portal_config hpc + left join hw_portal_config_type hpct on hpc.portal_config_type_id = hpct.config_type_id + + select a.product_info_id, a.config_type_id, a.tab_flag, a.config_modal, a.product_info_etitle, a.product_info_ctitle, a.product_info_order, a.create_time, a.create_by, a.update_time, a.update_by, - b.product_info_detail_id as sub_product_info_detail_id, b.parent_id as sub_parent_id, b.product_info_id as sub_product_info_id, b.product_info_detail_title as sub_product_info_detail_title, b.product_info_detail_desc as sub_product_info_detail_desc, b.product_info_detail_order as sub_product_info_detail_order, b.product_info_detail_pic as sub_product_info_detail_pic, b.ancestors as sub_ancestors, b.create_time as sub_create_time, b.create_by as sub_create_by, b.update_time as sub_update_time, b.update_by as sub_update_by + b.product_info_detail_id as sub_product_info_detail_id, b.parent_id as sub_parent_id, b.product_info_id as sub_product_info_id, b.product_info_detail_title as sub_product_info_detail_title, b.product_info_detail_desc as sub_product_info_detail_desc, b.product_info_detail_order as sub_product_info_detail_order, b.product_info_detail_pic as sub_product_info_detail_pic, b.ancestors as sub_ancestors, b.create_time as sub_create_time, b.create_by as sub_create_by, b.update_time as sub_update_time, b.update_by as sub_update_by, + b.config_modal AS config_model from hw_product_info a left join hw_product_info_detail b on b.product_info_id = a.product_info_id From d9b72f83af7b1e582fefc51ffd81c591947935e6 Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 Aug 2025 10:54:20 +0800 Subject: [PATCH 3/9] =?UTF-8?q?feat(hw-portal):=20=E6=B7=BB=E5=8A=A0=20jso?= =?UTF-8?q?nStrin=E5=AD=97=E6=AE=B5=E5=B9=B6=E6=9B=B4=E6=96=B0=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 HwWeb 类中添加 webJsonString 字段,用于存储 json 字符串 - 更新 HwWebMapper.xml,添加 webJsonString 的映射和相关 SQL 语句 --- .../main/java/com/ruoyi/portal/domain/HwWeb.java | 14 ++++++++++++++ .../main/resources/mapper/portal/HwWebMapper.xml | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) 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 3650335..e2276ba 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 @@ -22,6 +22,10 @@ public class HwWeb extends BaseEntity @Excel(name = "json") private String webJson; + /** json字符串 */ + @Excel(name = "json字符串") + private String webJsonString; + public void setWebId(Long webId) { this.webId = webId; @@ -40,12 +44,22 @@ public class HwWeb extends BaseEntity { return webJson; } + public void setWebJsonString(String webJsonString) + { + this.webJsonString = webJsonString; + } + + public String getWebJsonString() + { + return webJsonString; + } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("webId", getWebId()) .append("webJson", getWebJson()) + .append("webJsonString", getWebJsonString()) .toString(); } } 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 aa09e41..30e8661 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 @@ -7,16 +7,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select web_id, web_json from hw_web + select web_id, web_json, web_json_string from hw_web @@ -29,9 +31,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" insert into hw_web web_json, + web_json_string, #{webJson}, + #{webJsonString}, @@ -39,6 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update hw_web web_json = #{webJson}, + web_json_string = #{webJsonString}, where web_id = #{webId} From 96320bd1f4b7be26a58752585cf3b268ceb6a8fb Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 Aug 2025 13:49:06 +0800 Subject: [PATCH 4/9] =?UTF-8?q?feat(portal):=20=E6=B7=BB=E5=8A=A0haiwei?= =?UTF-8?q?=E5=AE=98=E7=BD=91=E8=8F=9C=E5=8D=95=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 HwWebMenu 实体类 - 创建 HwWebMenuController 控制器 - 实现 HwWebMenuMapper 接口 - 编写 HwWebMenuMapper.xml配置文件 - 开发 HwWebMenuServiceImpl 服务实现类 - 定义 IHwWebMenuService 服务接口 --- .../controller/HwWebMenuController.java | 105 +++++++++++++++ .../com/ruoyi/portal/domain/HwWebMenu.java | 121 ++++++++++++++++++ .../ruoyi/portal/mapper/HwWebMenuMapper.java | 61 +++++++++ .../portal/service/IHwWebMenuService.java | 61 +++++++++ .../service/impl/HwWebMenuServiceImpl.java | 93 ++++++++++++++ .../mapper/portal/HwWebMenuMapper.xml | 83 ++++++++++++ 6 files changed, 524 insertions(+) create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu.java create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMenuMapper.java create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService.java create mode 100644 ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java create mode 100644 ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper.xml diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java new file mode 100644 index 0000000..5c01657 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java @@ -0,0 +1,105 @@ +package com.ruoyi.portal.controller; + +import java.util.List; +import java.io.IOException; +import javax.servlet.http.HttpServletResponse; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.common.security.annotation.RequiresPermissions; +import com.ruoyi.portal.domain.HwWebMenu; +import com.ruoyi.portal.service.IHwWebMenuService; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.page.TableDataInfo; + +/** + * haiwei官网菜单Controller + * + * @author zch + * @date 2025-08-18 + */ +@RestController +@RequestMapping("/hwWebMenu") +public class HwWebMenuController extends BaseController +{ + @Autowired + private IHwWebMenuService hwWebMenuService; + + /** + * 查询haiwei官网菜单列表 + */ + @RequiresPermissions("portal:hwWebMenu:list") + @GetMapping("/list") + public TableDataInfo list(HwWebMenu hwWebMenu) + { + startPage(); + List list = hwWebMenuService.selectHwWebMenuList(hwWebMenu); + return getDataTable(list); + } + + /** + * 导出haiwei官网菜单列表 + */ + @RequiresPermissions("portal:hwWebMenu:export") + @Log(title = "haiwei官网菜单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwWebMenu hwWebMenu) + { + List list = hwWebMenuService.selectHwWebMenuList(hwWebMenu); + ExcelUtil util = new ExcelUtil(HwWebMenu.class); + util.exportExcel(response, list, "haiwei官网菜单数据"); + } + + /** + * 获取haiwei官网菜单详细信息 + */ + @RequiresPermissions("portal:hwWebMenu:query") + @GetMapping(value = "/{webMenuId}") + public AjaxResult getInfo(@PathVariable("webMenuId") Long webMenuId) + { + return success(hwWebMenuService.selectHwWebMenuByWebMenuId(webMenuId)); + } + + /** + * 新增haiwei官网菜单 + */ + @RequiresPermissions("portal:hwWebMenu:add") + @Log(title = "haiwei官网菜单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwWebMenu hwWebMenu) + { + return toAjax(hwWebMenuService.insertHwWebMenu(hwWebMenu)); + } + + /** + * 修改haiwei官网菜单 + */ + @RequiresPermissions("portal:hwWebMenu:edit") + @Log(title = "haiwei官网菜单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwWebMenu hwWebMenu) + { + return toAjax(hwWebMenuService.updateHwWebMenu(hwWebMenu)); + } + + /** + * 删除haiwei官网菜单 + */ + @RequiresPermissions("portal:hwWebMenu:remove") + @Log(title = "haiwei官网菜单", businessType = BusinessType.DELETE) + @DeleteMapping("/{webMenuIds}") + public AjaxResult remove(@PathVariable Long[] webMenuIds) + { + return toAjax(hwWebMenuService.deleteHwWebMenuByWebMenuIds(webMenuIds)); + } +} 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 new file mode 100644 index 0000000..7c7dec7 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu.java @@ -0,0 +1,121 @@ +package com.ruoyi.portal.domain; + +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.core.annotation.Excel; +import com.ruoyi.common.core.web.domain.BaseEntity; + +/** + * haiwei官网菜单对象 hw_web_menu + * + * @author zch + * @date 2025-08-18 + */ +public class HwWebMenu extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 菜单主键id */ + private Long webMenuId; + + /** 父节点 */ + @Excel(name = "父节点") + private Long parent; + + /** 祖先 */ + @Excel(name = "祖先") + private String ancestors; + + /** 状态 */ + @Excel(name = "状态") + private String status; + + /** 菜单名称 */ + @Excel(name = "菜单名称") + private String webMenuName; + + /** 租户 */ + @Excel(name = "租户") + private Long tenantId; + + /** 图片地址 */ + @Excel(name = "图片地址") + private String webMenuPic; + + public void setWebMenuId(Long webMenuId) + { + this.webMenuId = webMenuId; + } + + public Long getWebMenuId() + { + return webMenuId; + } + public void setParent(Long parent) + { + this.parent = parent; + } + + public Long getParent() + { + return parent; + } + public void setAncestors(String ancestors) + { + this.ancestors = ancestors; + } + + public String getAncestors() + { + return ancestors; + } + public void setStatus(String status) + { + this.status = status; + } + + public String getStatus() + { + return status; + } + public void setWebMenuName(String webMenuName) + { + this.webMenuName = webMenuName; + } + + public String getWebMenuName() + { + return webMenuName; + } + public void setTenantId(Long tenantId) + { + this.tenantId = tenantId; + } + + public Long getTenantId() + { + return tenantId; + } + public void setWebMenuPic(String webMenuPic) + { + this.webMenuPic = webMenuPic; + } + + public String getWebMenuPic() + { + return webMenuPic; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("webMenuId", getWebMenuId()) + .append("parent", getParent()) + .append("ancestors", getAncestors()) + .append("status", getStatus()) + .append("webMenuName", getWebMenuName()) + .append("tenantId", getTenantId()) + .append("webMenuPic", getWebMenuPic()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMenuMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMenuMapper.java new file mode 100644 index 0000000..e0d7272 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMenuMapper.java @@ -0,0 +1,61 @@ +package com.ruoyi.portal.mapper; + +import java.util.List; +import com.ruoyi.portal.domain.HwWebMenu; + +/** + * haiwei官网菜单Mapper接口 + * + * @author zch + * @date 2025-08-18 + */ +public interface HwWebMenuMapper +{ + /** + * 查询haiwei官网菜单 + * + * @param webMenuId haiwei官网菜单主键 + * @return haiwei官网菜单 + */ + public HwWebMenu selectHwWebMenuByWebMenuId(Long webMenuId); + + /** + * 查询haiwei官网菜单列表 + * + * @param hwWebMenu haiwei官网菜单 + * @return haiwei官网菜单集合 + */ + public List selectHwWebMenuList(HwWebMenu hwWebMenu); + + /** + * 新增haiwei官网菜单 + * + * @param hwWebMenu haiwei官网菜单 + * @return 结果 + */ + public int insertHwWebMenu(HwWebMenu hwWebMenu); + + /** + * 修改haiwei官网菜单 + * + * @param hwWebMenu haiwei官网菜单 + * @return 结果 + */ + public int updateHwWebMenu(HwWebMenu hwWebMenu); + + /** + * 删除haiwei官网菜单 + * + * @param webMenuId haiwei官网菜单主键 + * @return 结果 + */ + public int deleteHwWebMenuByWebMenuId(Long webMenuId); + + /** + * 批量删除haiwei官网菜单 + * + * @param webMenuIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwWebMenuByWebMenuIds(Long[] webMenuIds); +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService.java new file mode 100644 index 0000000..4fc2d51 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService.java @@ -0,0 +1,61 @@ +package com.ruoyi.portal.service; + +import java.util.List; +import com.ruoyi.portal.domain.HwWebMenu; + +/** + * haiwei官网菜单Service接口 + * + * @author zch + * @date 2025-08-18 + */ +public interface IHwWebMenuService +{ + /** + * 查询haiwei官网菜单 + * + * @param webMenuId haiwei官网菜单主键 + * @return haiwei官网菜单 + */ + public HwWebMenu selectHwWebMenuByWebMenuId(Long webMenuId); + + /** + * 查询haiwei官网菜单列表 + * + * @param hwWebMenu haiwei官网菜单 + * @return haiwei官网菜单集合 + */ + public List selectHwWebMenuList(HwWebMenu hwWebMenu); + + /** + * 新增haiwei官网菜单 + * + * @param hwWebMenu haiwei官网菜单 + * @return 结果 + */ + public int insertHwWebMenu(HwWebMenu hwWebMenu); + + /** + * 修改haiwei官网菜单 + * + * @param hwWebMenu haiwei官网菜单 + * @return 结果 + */ + public int updateHwWebMenu(HwWebMenu hwWebMenu); + + /** + * 批量删除haiwei官网菜单 + * + * @param webMenuIds 需要删除的haiwei官网菜单主键集合 + * @return 结果 + */ + public int deleteHwWebMenuByWebMenuIds(Long[] webMenuIds); + + /** + * 删除haiwei官网菜单信息 + * + * @param webMenuId haiwei官网菜单主键 + * @return 结果 + */ + public int deleteHwWebMenuByWebMenuId(Long webMenuId); +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java new file mode 100644 index 0000000..ac393a7 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java @@ -0,0 +1,93 @@ +package com.ruoyi.portal.service.impl; + +import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.ruoyi.portal.mapper.HwWebMenuMapper; +import com.ruoyi.portal.domain.HwWebMenu; +import com.ruoyi.portal.service.IHwWebMenuService; + +/** + * haiwei官网菜单Service业务层处理 + * + * @author zch + * @date 2025-08-18 + */ +@Service +public class HwWebMenuServiceImpl implements IHwWebMenuService +{ + @Autowired + private HwWebMenuMapper hwWebMenuMapper; + + /** + * 查询haiwei官网菜单 + * + * @param webMenuId haiwei官网菜单主键 + * @return haiwei官网菜单 + */ + @Override + public HwWebMenu selectHwWebMenuByWebMenuId(Long webMenuId) + { + return hwWebMenuMapper.selectHwWebMenuByWebMenuId(webMenuId); + } + + /** + * 查询haiwei官网菜单列表 + * + * @param hwWebMenu haiwei官网菜单 + * @return haiwei官网菜单 + */ + @Override + public List selectHwWebMenuList(HwWebMenu hwWebMenu) + { + return hwWebMenuMapper.selectHwWebMenuList(hwWebMenu); + } + + /** + * 新增haiwei官网菜单 + * + * @param hwWebMenu haiwei官网菜单 + * @return 结果 + */ + @Override + public int insertHwWebMenu(HwWebMenu hwWebMenu) + { + return hwWebMenuMapper.insertHwWebMenu(hwWebMenu); + } + + /** + * 修改haiwei官网菜单 + * + * @param hwWebMenu haiwei官网菜单 + * @return 结果 + */ + @Override + public int updateHwWebMenu(HwWebMenu hwWebMenu) + { + return hwWebMenuMapper.updateHwWebMenu(hwWebMenu); + } + + /** + * 批量删除haiwei官网菜单 + * + * @param webMenuIds 需要删除的haiwei官网菜单主键 + * @return 结果 + */ + @Override + public int deleteHwWebMenuByWebMenuIds(Long[] webMenuIds) + { + return hwWebMenuMapper.deleteHwWebMenuByWebMenuIds(webMenuIds); + } + + /** + * 删除haiwei官网菜单信息 + * + * @param webMenuId haiwei官网菜单主键 + * @return 结果 + */ + @Override + public int deleteHwWebMenuByWebMenuId(Long webMenuId) + { + return hwWebMenuMapper.deleteHwWebMenuByWebMenuId(webMenuId); + } +} 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 new file mode 100644 index 0000000..d0c9290 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + select web_menu_id, parent, ancestors, status, web_menu_name, tenant_id, web_menu__pic from hw_web_menu + + + + + + + + insert into hw_web_menu + + web_menu_id, + parent, + ancestors, + status, + web_menu_name, + tenant_id, + web_menu__pic, + + + #{webMenuId}, + #{parent}, + #{ancestors}, + #{status}, + #{webMenuName}, + #{tenantId}, + #{webMenuPic}, + + + + + update hw_web_menu + + parent = #{parent}, + ancestors = #{ancestors}, + status = #{status}, + web_menu_name = #{webMenuName}, + tenant_id = #{tenantId}, + web_menu__pic = #{webMenuPic}, + + where web_menu_id = #{webMenuId} + + + + delete from hw_web_menu where web_menu_id = #{webMenuId} + + + + delete from hw_web_menu where web_menu_id in + + #{webMenuId} + + + \ No newline at end of file From d433d0660d8be2eba59cc9a8d7147949e53369ee Mon Sep 17 00:00:00 2001 From: "zangch@mesnac.com" Date: Mon, 18 Aug 2025 14:30:42 +0800 Subject: [PATCH 5/9] =?UTF-8?q?feat(portal):=20=E6=9E=84=E5=BB=BA=E5=AE=98?= =?UTF-8?q?=E7=BD=91=E8=8F=9C=E5=8D=95=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 HwWebMenu 模型中添加 children 属性,用于存储子菜单 - 实现 HwWebMenuServiceImpl 中的 buildWebMenuTree 方法,用于构建菜单树 - 添加 recursionFn、getChildList 和 hasChild 等辅助方法,用于递归构建菜单树 --- .../com/ruoyi/portal/domain/HwWebMenu.java | 12 ++++ .../service/impl/HwWebMenuServiceImpl.java | 62 +++++++++++++++++++ 2 files changed, 74 insertions(+) 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 7c7dec7..b89425e 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 @@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; import com.ruoyi.common.core.web.domain.BaseEntity; +import java.util.List; + /** * haiwei官网菜单对象 hw_web_menu * @@ -42,6 +44,8 @@ public class HwWebMenu extends BaseEntity @Excel(name = "图片地址") private String webMenuPic; + private List children; + public void setWebMenuId(Long webMenuId) { this.webMenuId = webMenuId; @@ -106,6 +110,14 @@ public class HwWebMenu extends BaseEntity return webMenuPic; } + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java index ac393a7..c0fbdeb 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java @@ -1,11 +1,15 @@ package com.ruoyi.portal.service.impl; import java.util.List; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.portal.mapper.HwWebMenuMapper; import com.ruoyi.portal.domain.HwWebMenu; import com.ruoyi.portal.service.IHwWebMenuService; +import com.ruoyi.common.core.utils.StringUtils; /** * haiwei官网菜单Service业务层处理 @@ -90,4 +94,62 @@ public class HwWebMenuServiceImpl implements IHwWebMenuService { return hwWebMenuMapper.deleteHwWebMenuByWebMenuId(webMenuId); } + + /** + * 构建前端所需要树结构(根据传入的平铺菜单列表构造树) + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + public List buildWebMenuTree(List menus) { + List returnList = new ArrayList<>(); + List tempList = menus.stream().map(HwWebMenu::getWebMenuId).collect(Collectors.toList()); + for (HwWebMenu menu : menus) { + // 如果是顶级节点(parent为null、0或者不在当前列表中), 遍历该父节点的所有子节点 + if (menu.getParent() == null || menu.getParent() == 0L || !tempList.contains(menu.getParent())) { + recursionFn(menus, menu); + returnList.add(menu); + } + } + if (returnList.isEmpty()) { + returnList = menus; + } + return returnList; + } + + /** + * 递归设置子节点 + */ + private void recursionFn(List list, HwWebMenu t) { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (HwWebMenu tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, HwWebMenu t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + HwWebMenu n = it.next(); + if (StringUtils.isNotNull(n.getParent()) && n.getParent().longValue() == t.getWebMenuId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, HwWebMenu t) { + return !getChildList(list, t).isEmpty(); + } } From 93781bca144870b55179ce9ea3bf55c854e24688 Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 Aug 2025 15:29:50 +0800 Subject: [PATCH 6/9] =?UTF-8?q?feat(portal):=20=E6=B7=BB=E5=8A=A0=E5=AE=98?= =?UTF-8?q?=E7=BD=91=E8=8F=9C=E5=8D=95=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD?= =?UTF-8?q?,=E6=B3=A8=E9=87=8A=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 HwWebMenu 模型类,增加 webMenuType 字段 - 添加 HwWebMenu 相关的 API 接口和实现类 - 实现 HwWebMenu 的列表查询、详情获取、新增、修改和删除功能 -优化 HwWebMenu 列表查询,支持树形结构展示 --- .../controller/HwAboutUsInfoController.java | 12 ++--- .../HwAboutUsInfoDetailController.java | 12 ++--- .../controller/HwContactUsInfoController.java | 12 ++--- .../controller/HwPortalConfigController.java | 14 +++--- .../HwPortalConfigTypeController.java | 12 ++--- .../HwProductCaseInfoController.java | 14 +++--- .../controller/HwProductInfoController.java | 14 +++--- .../HwProductInfoDetailController.java | 12 ++--- .../portal/controller/HwWebController.java | 12 ++--- .../controller/HwWebMenuController.java | 22 +++++----- .../com/ruoyi/portal/domain/HwWebMenu.java | 11 +++++ .../service/impl/HwWebMenuServiceImpl.java | 27 +++++++----- .../mapper/portal/HwWebMenuMapper.xml | 11 ++++- ruoyi-ui/src/api/portal/hwWeb.js | 44 +++++++++++++++++++ ruoyi-ui/src/api/portal/hwWebMenu.js | 44 +++++++++++++++++++ 15 files changed, 191 insertions(+), 82 deletions(-) create mode 100644 ruoyi-ui/src/api/portal/hwWeb.js create mode 100644 ruoyi-ui/src/api/portal/hwWebMenu.js diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoController.java index 3e3f3a6..acd7186 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoController.java @@ -31,7 +31,7 @@ public class HwAboutUsInfoController extends BaseController /** * 查询关于我们信息列表 */ - @RequiresPermissions("portal:aboutUsInfo:list") + //@RequiresPermissions("portalaboutUsInfo:list") @GetMapping("/list") public TableDataInfo list(HwAboutUsInfo hwAboutUsInfo) { @@ -43,7 +43,7 @@ public class HwAboutUsInfoController extends BaseController /** * 导出关于我们信息列表 */ - @RequiresPermissions("portal:aboutUsInfo:export") + //@RequiresPermissions("portalaboutUsInfo:export") @Log(title = "关于我们信息", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwAboutUsInfo hwAboutUsInfo) @@ -56,7 +56,7 @@ public class HwAboutUsInfoController extends BaseController /** * 获取关于我们信息详细信息 */ - @RequiresPermissions("portal:aboutUsInfo:query") + //@RequiresPermissions("portalaboutUsInfo:query") @GetMapping(value = "/{aboutUsInfoId}") public AjaxResult getInfo(@PathVariable("aboutUsInfoId") Long aboutUsInfoId) { @@ -66,7 +66,7 @@ public class HwAboutUsInfoController extends BaseController /** * 新增关于我们信息 */ - @RequiresPermissions("portal:aboutUsInfo:add") + //@RequiresPermissions("portalaboutUsInfo:add") @Log(title = "关于我们信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwAboutUsInfo hwAboutUsInfo) @@ -77,7 +77,7 @@ public class HwAboutUsInfoController extends BaseController /** * 修改关于我们信息 */ - @RequiresPermissions("portal:aboutUsInfo:edit") + //@RequiresPermissions("portalaboutUsInfo:edit") @Log(title = "关于我们信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwAboutUsInfo hwAboutUsInfo) @@ -88,7 +88,7 @@ public class HwAboutUsInfoController extends BaseController /** * 删除关于我们信息 */ - @RequiresPermissions("portal:aboutUsInfo:remove") + //@RequiresPermissions("portalaboutUsInfo:remove") @Log(title = "关于我们信息", businessType = BusinessType.DELETE) @DeleteMapping("/{aboutUsInfoIds}") public AjaxResult remove(@PathVariable Long[] aboutUsInfoIds) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoDetailController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoDetailController.java index a59c987..df72f5c 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoDetailController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwAboutUsInfoDetailController.java @@ -31,7 +31,7 @@ public class HwAboutUsInfoDetailController extends BaseController /** * 查询关于我们信息明细列表 */ - @RequiresPermissions("portal:aboutUsInfoDetail:list") + //@RequiresPermissions("portalaboutUsInfoDetail:list") @GetMapping("/list") public TableDataInfo list(HwAboutUsInfoDetail hwAboutUsInfoDetail) { @@ -43,7 +43,7 @@ public class HwAboutUsInfoDetailController extends BaseController /** * 导出关于我们信息明细列表 */ - @RequiresPermissions("portal:aboutUsInfoDetail:export") + //@RequiresPermissions("portalaboutUsInfoDetail:export") @Log(title = "关于我们信息明细", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwAboutUsInfoDetail hwAboutUsInfoDetail) @@ -56,7 +56,7 @@ public class HwAboutUsInfoDetailController extends BaseController /** * 获取关于我们信息明细详细信息 */ - @RequiresPermissions("portal:aboutUsInfoDetail:query") + //@RequiresPermissions("portalaboutUsInfoDetail:query") @GetMapping(value = "/{usInfoDetailId}") public AjaxResult getInfo(@PathVariable("usInfoDetailId") Long usInfoDetailId) { @@ -66,7 +66,7 @@ public class HwAboutUsInfoDetailController extends BaseController /** * 新增关于我们信息明细 */ - @RequiresPermissions("portal:aboutUsInfoDetail:add") + //@RequiresPermissions("portalaboutUsInfoDetail:add") @Log(title = "关于我们信息明细", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwAboutUsInfoDetail hwAboutUsInfoDetail) @@ -77,7 +77,7 @@ public class HwAboutUsInfoDetailController extends BaseController /** * 修改关于我们信息明细 */ - @RequiresPermissions("portal:aboutUsInfoDetail:edit") + //@RequiresPermissions("portalaboutUsInfoDetail:edit") @Log(title = "关于我们信息明细", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwAboutUsInfoDetail hwAboutUsInfoDetail) @@ -88,7 +88,7 @@ public class HwAboutUsInfoDetailController extends BaseController /** * 删除关于我们信息明细 */ - @RequiresPermissions("portal:aboutUsInfoDetail:remove") + //@RequiresPermissions("portalaboutUsInfoDetail:remove") @Log(title = "关于我们信息明细", businessType = BusinessType.DELETE) @DeleteMapping("/{usInfoDetailIds}") public AjaxResult remove(@PathVariable Long[] usInfoDetailIds) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwContactUsInfoController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwContactUsInfoController.java index 10c39d1..9dd6faf 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwContactUsInfoController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwContactUsInfoController.java @@ -31,7 +31,7 @@ public class HwContactUsInfoController extends BaseController /** * 查询联系我们信息列表 */ - @RequiresPermissions("portal:contactUsInfo:list") + //@RequiresPermissions("portalcontactUsInfo:list") @GetMapping("/list") public TableDataInfo list(HwContactUsInfo hwContactUsInfo) { @@ -43,7 +43,7 @@ public class HwContactUsInfoController extends BaseController /** * 导出联系我们信息列表 */ - @RequiresPermissions("portal:contactUsInfo:export") + //@RequiresPermissions("portalcontactUsInfo:export") @Log(title = "联系我们信息", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwContactUsInfo hwContactUsInfo) @@ -56,7 +56,7 @@ public class HwContactUsInfoController extends BaseController /** * 获取联系我们信息详细信息 */ - @RequiresPermissions("portal:contactUsInfo:query") + //@RequiresPermissions("portalcontactUsInfo:query") @GetMapping(value = "/{contactUsInfoId}") public AjaxResult getInfo(@PathVariable("contactUsInfoId") Long contactUsInfoId) { @@ -66,7 +66,7 @@ public class HwContactUsInfoController extends BaseController /** * 新增联系我们信息 */ - @RequiresPermissions("portal:contactUsInfo:add") + //@RequiresPermissions("portalcontactUsInfo:add") @Log(title = "联系我们信息", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwContactUsInfo hwContactUsInfo) @@ -77,7 +77,7 @@ public class HwContactUsInfoController extends BaseController /** * 修改联系我们信息 */ - @RequiresPermissions("portal:contactUsInfo:edit") + //@RequiresPermissions("portalcontactUsInfo:edit") @Log(title = "联系我们信息", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwContactUsInfo hwContactUsInfo) @@ -88,7 +88,7 @@ public class HwContactUsInfoController extends BaseController /** * 删除联系我们信息 */ - @RequiresPermissions("portal:contactUsInfo:remove") + //@RequiresPermissions("portalcontactUsInfo:remove") @Log(title = "联系我们信息", businessType = BusinessType.DELETE) @DeleteMapping("/{contactUsInfoIds}") public AjaxResult remove(@PathVariable Long[] contactUsInfoIds) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigController.java index c6961b2..9922a23 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigController.java @@ -36,7 +36,7 @@ public class HwPortalConfigController extends BaseController /** * 查询门户网站配置列表 */ - @RequiresPermissions("portal:portalConfig:list") + //@RequiresPermissions("portalportalConfig:list") @GetMapping("/list") public TableDataInfo list(HwPortalConfig hwPortalConfig) { @@ -48,7 +48,7 @@ public class HwPortalConfigController extends BaseController /** * 导出门户网站配置列表 */ - @RequiresPermissions("portal:portalConfig:export") + //@RequiresPermissions("portalportalConfig:export") @Log(title = "门户网站配置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwPortalConfig hwPortalConfig) @@ -61,7 +61,7 @@ public class HwPortalConfigController extends BaseController /** * 获取门户网站配置详细信息 */ - @RequiresPermissions("portal:portalConfig:query") + //@RequiresPermissions("portalportalConfig:query") @GetMapping(value = "/{portalConfigId}") public AjaxResult getInfo(@PathVariable("portalConfigId") Long portalConfigId) { @@ -71,7 +71,7 @@ public class HwPortalConfigController extends BaseController /** * 新增门户网站配置 */ - @RequiresPermissions("portal:portalConfig:add") + //@RequiresPermissions("portalportalConfig:add") @Log(title = "门户网站配置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwPortalConfig hwPortalConfig) @@ -82,7 +82,7 @@ public class HwPortalConfigController extends BaseController /** * 修改门户网站配置 */ - @RequiresPermissions("portal:portalConfig:edit") + //@RequiresPermissions("portalportalConfig:edit") @Log(title = "门户网站配置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwPortalConfig hwPortalConfig) @@ -93,7 +93,7 @@ public class HwPortalConfigController extends BaseController /** * 删除门户网站配置 */ - @RequiresPermissions("portal:portalConfig:remove") + //@RequiresPermissions("portalportalConfig:remove") @Log(title = "门户网站配置", businessType = BusinessType.DELETE) @DeleteMapping("/{portalConfigIds}") public AjaxResult remove(@PathVariable Long[] portalConfigIds) @@ -105,7 +105,7 @@ public class HwPortalConfigController extends BaseController /** * 获取门户网站配置树列表 */ - @RequiresPermissions("portal:portalConfig:list") + //@RequiresPermissions("portalportalConfig:list") @GetMapping("/portalConfigTypeTree") public AjaxResult portalConfigTypeTree(HwPortalConfigType hwPortalConfigType) { diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigTypeController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigTypeController.java index d181403..ea67452 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigTypeController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwPortalConfigTypeController.java @@ -30,7 +30,7 @@ public class HwPortalConfigTypeController extends BaseController /** * 查询门户网站配置类型列表 */ - @RequiresPermissions("portal:portalConfigType:list") + //@RequiresPermissions("portalportalConfigType:list") @GetMapping("/list") public AjaxResult list(HwPortalConfigType hwPortalConfigType) { @@ -41,7 +41,7 @@ public class HwPortalConfigTypeController extends BaseController /** * 导出门户网站配置类型列表 */ - @RequiresPermissions("portal:portalConfigType:export") + //@RequiresPermissions("portalportalConfigType:export") @Log(title = "门户网站配置类型", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwPortalConfigType hwPortalConfigType) @@ -54,7 +54,7 @@ public class HwPortalConfigTypeController extends BaseController /** * 获取门户网站配置类型详细信息 */ - @RequiresPermissions("portal:portalConfigType:query") + //@RequiresPermissions("portalportalConfigType:query") @GetMapping(value = "/{configTypeId}") public AjaxResult getInfo(@PathVariable("configTypeId") Long configTypeId) { @@ -64,7 +64,7 @@ public class HwPortalConfigTypeController extends BaseController /** * 新增门户网站配置类型 */ - @RequiresPermissions("portal:portalConfigType:add") + //@RequiresPermissions("portalportalConfigType:add") @Log(title = "门户网站配置类型", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwPortalConfigType hwPortalConfigType) @@ -75,7 +75,7 @@ public class HwPortalConfigTypeController extends BaseController /** * 修改门户网站配置类型 */ - @RequiresPermissions("portal:portalConfigType:edit") + //@RequiresPermissions("portalportalConfigType:edit") @Log(title = "门户网站配置类型", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwPortalConfigType hwPortalConfigType) @@ -86,7 +86,7 @@ public class HwPortalConfigTypeController extends BaseController /** * 删除门户网站配置类型 */ - @RequiresPermissions("portal:portalConfigType:remove") + //@RequiresPermissions("portalportalConfigType:remove") @Log(title = "门户网站配置类型", businessType = BusinessType.DELETE) @DeleteMapping("/{configTypeIds}") public AjaxResult remove(@PathVariable Long[] configTypeIds) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductCaseInfoController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductCaseInfoController.java index f544f2c..1279839 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductCaseInfoController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductCaseInfoController.java @@ -36,7 +36,7 @@ public class HwProductCaseInfoController extends BaseController /** * 查询案例内容列表 */ - @RequiresPermissions("portal:productCaseInfo:list") + //@RequiresPermissions("portalproductCaseInfo:list") @GetMapping("/list") public TableDataInfo list(HwProductCaseInfo hwProductCaseInfo) { @@ -48,7 +48,7 @@ public class HwProductCaseInfoController extends BaseController /** * 导出案例内容列表 */ - @RequiresPermissions("portal:productCaseInfo:export") + //@RequiresPermissions("portalproductCaseInfo:export") @Log(title = "案例内容", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwProductCaseInfo hwProductCaseInfo) @@ -61,7 +61,7 @@ public class HwProductCaseInfoController extends BaseController /** * 获取案例内容详细信息 */ - @RequiresPermissions("portal:productCaseInfo:query") + //@RequiresPermissions("portalproductCaseInfo:query") @GetMapping(value = "/{caseInfoId}") public AjaxResult getInfo(@PathVariable("caseInfoId") Long caseInfoId) { @@ -71,7 +71,7 @@ public class HwProductCaseInfoController extends BaseController /** * 新增案例内容 */ - @RequiresPermissions("portal:productCaseInfo:add") + //@RequiresPermissions("portalproductCaseInfo:add") @Log(title = "案例内容", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwProductCaseInfo hwProductCaseInfo) @@ -82,7 +82,7 @@ public class HwProductCaseInfoController extends BaseController /** * 修改案例内容 */ - @RequiresPermissions("portal:productCaseInfo:edit") + //@RequiresPermissions("portalproductCaseInfo:edit") @Log(title = "案例内容", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwProductCaseInfo hwProductCaseInfo) @@ -93,7 +93,7 @@ public class HwProductCaseInfoController extends BaseController /** * 删除案例内容 */ - @RequiresPermissions("portal:productCaseInfo:remove") + //@RequiresPermissions("portalproductCaseInfo:remove") @Log(title = "案例内容", businessType = BusinessType.DELETE) @DeleteMapping("/{caseInfoIds}") public AjaxResult remove(@PathVariable Long[] caseInfoIds) @@ -108,7 +108,7 @@ public class HwProductCaseInfoController extends BaseController /** * 获取门户网站配置树列表 */ - @RequiresPermissions("portal:productCaseInfo:list") + //@RequiresPermissions("portalproductCaseInfo:list") @GetMapping("/portalConfigTypeTree") public AjaxResult portalConfigTypeTree(HwPortalConfigType hwPortalConfigType) { diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoController.java index f39f20c..37f40f5 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoController.java @@ -37,7 +37,7 @@ public class HwProductInfoController extends BaseController /** * 查询产品信息配置列表 */ - @RequiresPermissions("portal:productInfo:list") + //@RequiresPermissions("portalproductInfo:list") @GetMapping("/list") public TableDataInfo list(HwProductInfo hwProductInfo) { @@ -49,7 +49,7 @@ public class HwProductInfoController extends BaseController /** * 导出产品信息配置列表 */ - @RequiresPermissions("portal:productInfo:export") + //@RequiresPermissions("portalproductInfo:export") @Log(title = "产品信息配置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwProductInfo hwProductInfo) @@ -62,7 +62,7 @@ public class HwProductInfoController extends BaseController /** * 获取产品信息配置详细信息 */ - @RequiresPermissions("portal:productInfo:query") + //@RequiresPermissions("portalproductInfo:query") @GetMapping(value = "/{productInfoId}") public AjaxResult getInfo(@PathVariable("productInfoId") Long productInfoId) { @@ -72,7 +72,7 @@ public class HwProductInfoController extends BaseController /** * 新增产品信息配置 */ - @RequiresPermissions("portal:productInfo:add") + //@RequiresPermissions("portalproductInfo:add") @Log(title = "产品信息配置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwProductInfo hwProductInfo) @@ -83,7 +83,7 @@ public class HwProductInfoController extends BaseController /** * 修改产品信息配置 */ - @RequiresPermissions("portal:productInfo:edit") + //@RequiresPermissions("portalproductInfo:edit") @Log(title = "产品信息配置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwProductInfo hwProductInfo) @@ -94,7 +94,7 @@ public class HwProductInfoController extends BaseController /** * 删除产品信息配置 */ - @RequiresPermissions("portal:productInfo:remove") + //@RequiresPermissions("portalproductInfo:remove") @Log(title = "产品信息配置", businessType = BusinessType.DELETE) @DeleteMapping("/{productInfoIds}") public AjaxResult remove(@PathVariable Long[] productInfoIds) @@ -109,7 +109,7 @@ public class HwProductInfoController extends BaseController /** * 获取门户网站配置树列表 */ - @RequiresPermissions("portal:productInfo:list") + //@RequiresPermissions("portalproductInfo:list") @GetMapping("/portalConfigTypeTree") public AjaxResult portalConfigTypeTree(HwPortalConfigType hwPortalConfigType) { diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoDetailController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoDetailController.java index 772d3c0..bff150f 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoDetailController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwProductInfoDetailController.java @@ -30,7 +30,7 @@ public class HwProductInfoDetailController extends BaseController /** * 查询产品信息明细配置列表 */ - @RequiresPermissions("portal:productInfoDetail:list") + //@RequiresPermissions("portalproductInfoDetail:list") @GetMapping("/list") public AjaxResult list(HwProductInfoDetail hwProductInfoDetail) { @@ -41,7 +41,7 @@ public class HwProductInfoDetailController extends BaseController /** * 导出产品信息明细配置列表 */ - @RequiresPermissions("portal:productInfoDetail:export") + //@RequiresPermissions("portalproductInfoDetail:export") @Log(title = "产品信息明细配置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwProductInfoDetail hwProductInfoDetail) @@ -54,7 +54,7 @@ public class HwProductInfoDetailController extends BaseController /** * 获取产品信息明细配置详细信息 */ - @RequiresPermissions("portal:productInfoDetail:query") + //@RequiresPermissions("portalproductInfoDetail:query") @GetMapping(value = "/{productInfoDetailId}") public AjaxResult getInfo(@PathVariable("productInfoDetailId") Long productInfoDetailId) { @@ -64,7 +64,7 @@ public class HwProductInfoDetailController extends BaseController /** * 新增产品信息明细配置 */ - @RequiresPermissions("portal:productInfoDetail:add") + //@RequiresPermissions("portalproductInfoDetail:add") @Log(title = "产品信息明细配置", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwProductInfoDetail hwProductInfoDetail) @@ -75,7 +75,7 @@ public class HwProductInfoDetailController extends BaseController /** * 修改产品信息明细配置 */ - @RequiresPermissions("portal:productInfoDetail:edit") + //@RequiresPermissions("portalproductInfoDetail:edit") @Log(title = "产品信息明细配置", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwProductInfoDetail hwProductInfoDetail) @@ -86,7 +86,7 @@ public class HwProductInfoDetailController extends BaseController /** * 删除产品信息明细配置 */ - @RequiresPermissions("portal:productInfoDetail:remove") + //@RequiresPermissions("portalproductInfoDetail:remove") @Log(title = "产品信息明细配置", businessType = BusinessType.DELETE) @DeleteMapping("/{productInfoDetailIds}") public AjaxResult remove(@PathVariable Long[] productInfoDetailIds) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java index d5be4ee..45b8519 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java @@ -38,7 +38,7 @@ public class HwWebController extends BaseController /** * 查询haiwei官网json列表 */ - @RequiresPermissions("portal:hwWeb:list") + //@RequiresPermissions("portalhwWeb:list") @GetMapping("/list") public TableDataInfo list(HwWeb hwWeb) { @@ -50,7 +50,7 @@ public class HwWebController extends BaseController /** * 导出haiwei官网json列表 */ - @RequiresPermissions("portal:hwWeb:export") + //@RequiresPermissions("portalhwWeb:export") @Log(title = "haiwei官网json", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwWeb hwWeb) @@ -63,7 +63,7 @@ public class HwWebController extends BaseController /** * 获取haiwei官网json详细信息 */ - @RequiresPermissions("portal:hwWeb:query") + //@RequiresPermissions("portalhwWeb:query") @GetMapping(value = "/{webId}") public AjaxResult getInfo(@PathVariable("webId") Long webId) { @@ -73,7 +73,7 @@ public class HwWebController extends BaseController /** * 新增haiwei官网json */ - @RequiresPermissions("portal:hwWeb:add") + //@RequiresPermissions("portalhwWeb:add") @Log(title = "haiwei官网json", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwWeb hwWeb) @@ -84,7 +84,7 @@ public class HwWebController extends BaseController /** * 修改haiwei官网json */ - @RequiresPermissions("portal:hwWeb:edit") + //@RequiresPermissions("portalhwWeb:edit") @Log(title = "haiwei官网json", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwWeb hwWeb) @@ -95,7 +95,7 @@ public class HwWebController extends BaseController /** * 删除haiwei官网json */ - @RequiresPermissions("portal:hwWeb:remove") + //@RequiresPermissions("portalhwWeb:remove") @Log(title = "haiwei官网json", businessType = BusinessType.DELETE) @DeleteMapping("/{webIds}") public AjaxResult remove(@PathVariable Long[] webIds) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java index 5c01657..cb57b5d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java @@ -20,11 +20,10 @@ import com.ruoyi.portal.service.IHwWebMenuService; import com.ruoyi.common.core.web.controller.BaseController; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.utils.poi.ExcelUtil; -import com.ruoyi.common.core.web.page.TableDataInfo; /** * haiwei官网菜单Controller - * + * * @author zch * @date 2025-08-18 */ @@ -38,19 +37,18 @@ public class HwWebMenuController extends BaseController /** * 查询haiwei官网菜单列表 */ - @RequiresPermissions("portal:hwWebMenu:list") + //@RequiresPermissions("portalhwWebMenu:list") @GetMapping("/list") - public TableDataInfo list(HwWebMenu hwWebMenu) + public AjaxResult list(HwWebMenu hwWebMenu) { - startPage(); List list = hwWebMenuService.selectHwWebMenuList(hwWebMenu); - return getDataTable(list); + return success(list); } /** * 导出haiwei官网菜单列表 */ - @RequiresPermissions("portal:hwWebMenu:export") + //@RequiresPermissions("portalhwWebMenu:export") @Log(title = "haiwei官网菜单", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HwWebMenu hwWebMenu) @@ -63,7 +61,7 @@ public class HwWebMenuController extends BaseController /** * 获取haiwei官网菜单详细信息 */ - @RequiresPermissions("portal:hwWebMenu:query") + //@RequiresPermissions("portalhwWebMenu:query") @GetMapping(value = "/{webMenuId}") public AjaxResult getInfo(@PathVariable("webMenuId") Long webMenuId) { @@ -73,7 +71,7 @@ public class HwWebMenuController extends BaseController /** * 新增haiwei官网菜单 */ - @RequiresPermissions("portal:hwWebMenu:add") + //@RequiresPermissions("portalhwWebMenu:add") @Log(title = "haiwei官网菜单", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HwWebMenu hwWebMenu) @@ -84,7 +82,7 @@ public class HwWebMenuController extends BaseController /** * 修改haiwei官网菜单 */ - @RequiresPermissions("portal:hwWebMenu:edit") + //@RequiresPermissions("portalhwWebMenu:edit") @Log(title = "haiwei官网菜单", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HwWebMenu hwWebMenu) @@ -95,9 +93,9 @@ public class HwWebMenuController extends BaseController /** * 删除haiwei官网菜单 */ - @RequiresPermissions("portal:hwWebMenu:remove") + //@RequiresPermissions("portalhwWebMenu:remove") @Log(title = "haiwei官网菜单", businessType = BusinessType.DELETE) - @DeleteMapping("/{webMenuIds}") + @DeleteMapping("/{webMenuIds}") public AjaxResult remove(@PathVariable Long[] webMenuIds) { return toAjax(hwWebMenuService.deleteHwWebMenuByWebMenuIds(webMenuIds)); 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 b89425e..4cfa4d2 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 @@ -32,6 +32,8 @@ public class HwWebMenu extends BaseEntity @Excel(name = "状态") private String status; + private int webMenuType; + /** 菜单名称 */ @Excel(name = "菜单名称") private String webMenuName; @@ -118,6 +120,14 @@ public class HwWebMenu extends BaseEntity this.children = children; } + public int getWebMenuType() { + return webMenuType; + } + + public void setWebMenuType(int webMenuType) { + this.webMenuType = webMenuType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) @@ -128,6 +138,7 @@ public class HwWebMenu extends BaseEntity .append("webMenuName", getWebMenuName()) .append("tenantId", getTenantId()) .append("webMenuPic", getWebMenuPic()) + .append("webMenuType", getWebMenuType()) .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java index c0fbdeb..23521a9 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java @@ -1,31 +1,33 @@ package com.ruoyi.portal.service.impl; -import java.util.List; import java.util.ArrayList; import java.util.Iterator; +import java.util.List; import java.util.stream.Collectors; + +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.portal.domain.HwProductInfoDetail; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.portal.mapper.HwWebMenuMapper; import com.ruoyi.portal.domain.HwWebMenu; import com.ruoyi.portal.service.IHwWebMenuService; -import com.ruoyi.common.core.utils.StringUtils; /** * haiwei官网菜单Service业务层处理 - * + * * @author zch * @date 2025-08-18 */ @Service -public class HwWebMenuServiceImpl implements IHwWebMenuService +public class HwWebMenuServiceImpl implements IHwWebMenuService { @Autowired private HwWebMenuMapper hwWebMenuMapper; /** * 查询haiwei官网菜单 - * + * * @param webMenuId haiwei官网菜单主键 * @return haiwei官网菜单 */ @@ -37,19 +39,20 @@ public class HwWebMenuServiceImpl implements IHwWebMenuService /** * 查询haiwei官网菜单列表 - * + * * @param hwWebMenu haiwei官网菜单 * @return haiwei官网菜单 */ @Override public List selectHwWebMenuList(HwWebMenu hwWebMenu) { - return hwWebMenuMapper.selectHwWebMenuList(hwWebMenu); + List hwWebMenus = hwWebMenuMapper.selectHwWebMenuList(hwWebMenu); + return buildWebMenuTree(hwWebMenus); } /** * 新增haiwei官网菜单 - * + * * @param hwWebMenu haiwei官网菜单 * @return 结果 */ @@ -61,7 +64,7 @@ public class HwWebMenuServiceImpl implements IHwWebMenuService /** * 修改haiwei官网菜单 - * + * * @param hwWebMenu haiwei官网菜单 * @return 结果 */ @@ -73,7 +76,7 @@ public class HwWebMenuServiceImpl implements IHwWebMenuService /** * 批量删除haiwei官网菜单 - * + * * @param webMenuIds 需要删除的haiwei官网菜单主键 * @return 结果 */ @@ -85,7 +88,7 @@ public class HwWebMenuServiceImpl implements IHwWebMenuService /** * 删除haiwei官网菜单信息 - * + * * @param webMenuId haiwei官网菜单主键 * @return 结果 */ @@ -95,7 +98,7 @@ public class HwWebMenuServiceImpl implements IHwWebMenuService return hwWebMenuMapper.deleteHwWebMenuByWebMenuId(webMenuId); } - /** +/** * 构建前端所需要树结构(根据传入的平铺菜单列表构造树) * * @param menus 菜单列表 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 d0c9290..3d198f4 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 @@ -12,10 +12,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + - select web_menu_id, parent, ancestors, status, web_menu_name, tenant_id, web_menu__pic from hw_web_menu + select web_menu_id, parent, + ancestors, status, web_menu_name, + tenant_id, web_menu__pic , + web_menu_type + from hw_web_menu @@ -45,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" web_menu_name, tenant_id, web_menu__pic, + web_menu_type, #{webMenuId}, @@ -54,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{webMenuName}, #{tenantId}, #{webMenuPic}, + #{webMenuType}, @@ -66,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" web_menu_name = #{webMenuName}, tenant_id = #{tenantId}, web_menu__pic = #{webMenuPic}, + web_menu_type = #{webMenuType}, where web_menu_id = #{webMenuId} diff --git a/ruoyi-ui/src/api/portal/hwWeb.js b/ruoyi-ui/src/api/portal/hwWeb.js new file mode 100644 index 0000000..86c9ada --- /dev/null +++ b/ruoyi-ui/src/api/portal/hwWeb.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询haiwei官网json列表 +export function listHwWeb(query) { + return request({ + url: '/portal/hwWeb/list', + method: 'get', + params: query + }) +} + +// 查询haiwei官网json详细 +export function getHwWeb(webId) { + return request({ + url: '/portal/hwWeb/' + webId, + method: 'get' + }) +} + +// 新增haiwei官网json +export function addHwWeb(data) { + return request({ + url: '/portal/hwWeb', + method: 'post', + data: data + }) +} + +// 修改haiwei官网json +export function updateHwWeb(data) { + return request({ + url: '/portal/hwWeb', + method: 'put', + data: data + }) +} + +// 删除haiwei官网json +export function delHwWeb(webId) { + return request({ + url: '/portal/hwWeb/' + webId, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/portal/hwWebMenu.js b/ruoyi-ui/src/api/portal/hwWebMenu.js new file mode 100644 index 0000000..a1e1dde --- /dev/null +++ b/ruoyi-ui/src/api/portal/hwWebMenu.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询haiwei官网菜单列表 +export function listHwWebMenu(query) { + return request({ + url: '/portal/hwWebMenu/list', + method: 'get', + params: query + }) +} + +// 查询haiwei官网菜单详细 +export function getHwWebMenu(webMenuId) { + return request({ + url: '/portal/hwWebMenu/' + webMenuId, + method: 'get' + }) +} + +// 新增haiwei官网菜单 +export function addHwWebMenu(data) { + return request({ + url: '/portal/hwWebMenu', + method: 'post', + data: data + }) +} + +// 修改haiwei官网菜单 +export function updateHwWebMenu(data) { + return request({ + url: '/portal/hwWebMenu', + method: 'put', + data: data + }) +} + +// 删除haiwei官网菜单 +export function delHwWebMenu(webMenuId) { + return request({ + url: '/portal/hwWebMenu/' + webMenuId, + method: 'delete' + }) +} From 61a340b47be7786d2fd9c71448decb7046cb05f8 Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 Aug 2025 15:45:09 +0800 Subject: [PATCH 7/9] =?UTF-8?q?feat(portal):=20=E6=A0=91=E5=BD=A2=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 HwWebMenu 类的父类从 BaseEntity 改为 TreeEntity- 移除 HwWebMenu 类中的 children 属性 - 修改 HwWebMenu 类中的 webMenuType 属性类型 - 在 API 中添加 selectMenuTree 方法 - 在控制器中添加 selectMenuTree 方法 - 在服务接口和实现类中添加 selectMenuTree 方法 - 更新 Mapper XML 中的 SQL 语句 --- .../controller/HwWebMenuController.java | 8 ++ .../com/ruoyi/portal/domain/HwWebMenu.java | 88 +++++++------------ .../portal/service/IHwWebMenuService.java | 7 ++ .../service/impl/HwWebMenuServiceImpl.java | 10 +++ .../mapper/portal/HwWebMenuMapper.xml | 26 +++--- ruoyi-ui/src/api/portal/hwWebMenu.js | 8 ++ 6 files changed, 78 insertions(+), 69 deletions(-) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java index cb57b5d..f2eec13 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController.java @@ -100,4 +100,12 @@ public class HwWebMenuController extends BaseController { return toAjax(hwWebMenuService.deleteHwWebMenuByWebMenuIds(webMenuIds)); } + + /** + * 获取菜单树列表 + */ + @GetMapping("/selectMenuTree") + public AjaxResult selectMenuTree(HwWebMenu hwWebMenu){ + return success(hwWebMenuService.selectMenuTree(hwWebMenu)); + } } 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 4cfa4d2..6df3911 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 @@ -3,17 +3,17 @@ package com.ruoyi.portal.domain; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.core.annotation.Excel; -import com.ruoyi.common.core.web.domain.BaseEntity; +import com.ruoyi.common.core.web.domain.TreeEntity; import java.util.List; /** * haiwei官网菜单对象 hw_web_menu - * + * * @author zch * @date 2025-08-18 */ -public class HwWebMenu extends BaseEntity +public class HwWebMenu extends TreeEntity { private static final long serialVersionUID = 1L; @@ -24,16 +24,10 @@ public class HwWebMenu extends BaseEntity @Excel(name = "父节点") private Long parent; - /** 祖先 */ - @Excel(name = "祖先") - private String ancestors; - /** 状态 */ @Excel(name = "状态") private String status; - private int webMenuType; - /** 菜单名称 */ @Excel(name = "菜单名称") private String webMenuName; @@ -46,99 +40,85 @@ public class HwWebMenu extends BaseEntity @Excel(name = "图片地址") private String webMenuPic; - private List children; + /** 官网菜单类型 */ + @Excel(name = "官网菜单类型") + private Long webMenuType; - public void setWebMenuId(Long webMenuId) + public void setWebMenuId(Long webMenuId) { this.webMenuId = webMenuId; } - public Long getWebMenuId() + public Long getWebMenuId() { return webMenuId; } - public void setParent(Long parent) + public void setParent(Long parent) { this.parent = parent; } - public Long getParent() + public Long getParent() { return parent; } - public void setAncestors(String ancestors) - { - this.ancestors = ancestors; - } - - public String getAncestors() - { - return ancestors; - } - public void setStatus(String status) + public void setStatus(String status) { this.status = status; } - public String getStatus() + public String getStatus() { return status; } - public void setWebMenuName(String webMenuName) + public void setWebMenuName(String webMenuName) { this.webMenuName = webMenuName; } - public String getWebMenuName() + public String getWebMenuName() { return webMenuName; } - public void setTenantId(Long tenantId) + public void setTenantId(Long tenantId) { this.tenantId = tenantId; } - public Long getTenantId() + public Long getTenantId() { return tenantId; } - public void setWebMenuPic(String webMenuPic) + public void setWebMenuPic(String webMenuPic) { this.webMenuPic = webMenuPic; } - public String getWebMenuPic() + public String getWebMenuPic() { return webMenuPic; } - - public List getChildren() { - return children; - } - - public void setChildren(List children) { - this.children = children; - } - - public int getWebMenuType() { - return webMenuType; - } - - public void setWebMenuType(int webMenuType) { + public void setWebMenuType(Long webMenuType) + { this.webMenuType = webMenuType; } + public Long getWebMenuType() + { + return webMenuType; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("webMenuId", getWebMenuId()) - .append("parent", getParent()) - .append("ancestors", getAncestors()) - .append("status", getStatus()) - .append("webMenuName", getWebMenuName()) - .append("tenantId", getTenantId()) - .append("webMenuPic", getWebMenuPic()) - .append("webMenuType", getWebMenuType()) - .toString(); + .append("webMenuId", getWebMenuId()) + .append("parent", getParent()) + .append("ancestors", getAncestors()) + .append("status", getStatus()) + .append("webMenuName", getWebMenuName()) + .append("tenantId", getTenantId()) + .append("webMenuPic", getWebMenuPic()) + .append("webMenuType", getWebMenuType()) + .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService.java index 4fc2d51..ca02c1a 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService.java @@ -58,4 +58,11 @@ public interface IHwWebMenuService * @return 结果 */ public int deleteHwWebMenuByWebMenuId(Long webMenuId); + + + /** + * 获取菜单树列表 + */ + public List selectMenuTree(HwWebMenu hwWebMenu); + } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java index 23521a9..b95dca6 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl.java @@ -45,6 +45,16 @@ public class HwWebMenuServiceImpl implements IHwWebMenuService */ @Override public List selectHwWebMenuList(HwWebMenu hwWebMenu) + { + List hwWebMenus = hwWebMenuMapper.selectHwWebMenuList(hwWebMenu); + return hwWebMenus; + } + + /** + * 获取菜单树列表 + */ + @Override + public List selectMenuTree(HwWebMenu hwWebMenu) { List hwWebMenus = hwWebMenuMapper.selectHwWebMenuList(hwWebMenu); return buildWebMenuTree(hwWebMenus); 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 3d198f4..fb75ca1 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 @@ -1,9 +1,9 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + @@ -16,31 +16,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - 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 from hw_web_menu - + - + insert into hw_web_menu @@ -52,7 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" tenant_id, web_menu__pic, web_menu_type, - + #{webMenuId}, #{parent}, @@ -62,7 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{tenantId}, #{webMenuPic}, #{webMenuType}, - + @@ -84,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from hw_web_menu where web_menu_id in + delete from hw_web_menu where web_menu_id in #{webMenuId} diff --git a/ruoyi-ui/src/api/portal/hwWebMenu.js b/ruoyi-ui/src/api/portal/hwWebMenu.js index a1e1dde..c3956d7 100644 --- a/ruoyi-ui/src/api/portal/hwWebMenu.js +++ b/ruoyi-ui/src/api/portal/hwWebMenu.js @@ -42,3 +42,11 @@ export function delHwWebMenu(webMenuId) { method: 'delete' }) } + +export function selectMenuTree(query) { + return request({ + url: '/portal/hwWebMenu/selectMenuTree', + method: 'get', + params: query + }) +} From 382476a4f73215f40648b53d47ef7dc1f3b054fe Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 Aug 2025 17:32:56 +0800 Subject: [PATCH 8/9] =?UTF-8?q?feat(portal):=20=E6=B7=BB=E5=8A=A0=E7=BD=91?= =?UTF-8?q?=E9=A1=B5=E7=BC=96=E5=8F=B7=E5=B9=B6=E4=BC=98=E5=8C=96=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 HwWeb 模型中添加 webCode 字段,用于表示页面编号 - 修改 HwWebController 中的 getInfo 方法,使用 webCode 作为参数 - 更新 HwWebMapper 接口中的 selectHwWebByWebId 方法,改为 selectHwWebByWebcode - 修改 HwWebMapper.xml 中的 SQL 语句,支持 webCode 的查询和插入 - 优化 HwWebServiceImpl 中的 updateHwWeb 方法,实现编号唯一性校验 - 更新 IHwWebService接口中的方法定义 --- .../portal/controller/HwWebController.java | 9 ++--- .../java/com/ruoyi/portal/domain/HwWeb.java | 36 +++++++++++++------ .../com/ruoyi/portal/mapper/HwWebMapper.java | 2 +- .../ruoyi/portal/service/IHwWebService.java | 2 +- .../portal/service/impl/HwWebServiceImpl.java | 12 +++++-- .../resources/mapper/portal/HwWebMapper.xml | 32 ++++++++++------- 6 files changed, 61 insertions(+), 32 deletions(-) diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java index 45b8519..764d74d 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController.java @@ -64,10 +64,10 @@ public class HwWebController extends BaseController * 获取haiwei官网json详细信息 */ //@RequiresPermissions("portalhwWeb:query") - @GetMapping(value = "/{webId}") - public AjaxResult getInfo(@PathVariable("webId") Long webId) + @GetMapping(value = "/{webCode}") + public AjaxResult getInfo(@PathVariable("webCode") Long webCode) { - return success(hwWebService.selectHwWebByWebId(webId)); + return success(hwWebService.selectHwWebByWebcode(webCode)); } /** @@ -89,7 +89,8 @@ public class HwWebController extends BaseController @PutMapping public AjaxResult edit(@RequestBody HwWeb hwWeb) { - return toAjax(hwWebService.updateHwWeb(hwWeb)); + int i = hwWebService.updateHwWeb(hwWeb); + return toAjax(i); } /** 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 e2276ba..fb5b79f 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 @@ -7,7 +7,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity; /** * haiwei官网json对象 hw_web - * + * * @author ruoyi * @date 2025-08-18 */ @@ -26,40 +26,54 @@ public class HwWeb extends BaseEntity @Excel(name = "json字符串") private String webJsonString; - public void setWebId(Long webId) + /** 页面 */ + @Excel(name = "页面") + private Long webCode; + + public void setWebId(Long webId) { this.webId = webId; } - public Long getWebId() + public Long getWebId() { return webId; } - public void setWebJson(String webJson) + public void setWebJson(String webJson) { this.webJson = webJson; } - public String getWebJson() + public String getWebJson() { return webJson; } - public void setWebJsonString(String webJsonString) + public void setWebJsonString(String webJsonString) { this.webJsonString = webJsonString; } - public String getWebJsonString() + public String getWebJsonString() { return webJsonString; } + public void setWebCode(Long webCode) + { + this.webCode = webCode; + } + + public Long getWebCode() + { + return webCode; + } @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("webId", getWebId()) - .append("webJson", getWebJson()) - .append("webJsonString", getWebJsonString()) - .toString(); + .append("webId", getWebId()) + .append("webJson", getWebJson()) + .append("webJsonString", getWebJsonString()) + .append("webCode", getWebCode()) + .toString(); } } diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper.java index 5d49829..4951ebc 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper.java @@ -17,7 +17,7 @@ public interface HwWebMapper * @param webId haiwei官网json主键 * @return haiwei官网json */ - public HwWeb selectHwWebByWebId(Long webId); + public HwWeb selectHwWebByWebcode(Long webCode); /** * 查询haiwei官网json列表 diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService.java index 105ba1c..0665b6e 100644 --- a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService.java +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService.java @@ -17,7 +17,7 @@ public interface IHwWebService * @param webId haiwei官网json主键 * @return haiwei官网json */ - public HwWeb selectHwWebByWebId(Long webId); + public HwWeb selectHwWebByWebcode(Long webCode); /** * 查询haiwei官网json列表 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 98250fc..d77d7b7 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 @@ -26,11 +26,13 @@ public class HwWebServiceImpl implements IHwWebService * @return haiwei官网json */ @Override - public HwWeb selectHwWebByWebId(Long webId) + public HwWeb selectHwWebByWebcode(Long webCode) { - return hwWebMapper.selectHwWebByWebId(webId); + HwWeb hwWeb = hwWebMapper.selectHwWebByWebcode(webCode); + return hwWeb; } + /** * 查询haiwei官网json列表 * @@ -64,6 +66,12 @@ public class HwWebServiceImpl implements IHwWebService @Override public int updateHwWeb(HwWeb hwWeb) { + HwWeb codeWeb = new HwWeb(); + //编号唯一 + codeWeb.setWebCode(hwWeb.getWebCode()); + if(hwWebMapper.selectHwWebList(codeWeb).isEmpty()){ + return hwWebMapper.insertHwWeb(hwWeb); + } return hwWebMapper.updateHwWeb(hwWeb); } 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 30e8661..d3f11e1 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 @@ -1,42 +1,47 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + + - select web_id, web_json, web_json_string from hw_web + select web_id, web_json, web_json_string, web_code from hw_web - - - where web_id = #{webId} + where web_code = #{webCode} - + insert into hw_web web_json, web_json_string, - + web_code, + #{webJson}, #{webJsonString}, - + #{webCode}, + @@ -44,8 +49,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" web_json = #{webJson}, web_json_string = #{webJsonString}, + web_code = #{webCode}, - where web_id = #{webId} + where web_code = #{webCode} @@ -53,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from hw_web where web_id in + delete from hw_web where web_id in #{webId} From 56790f938e92a8ed400c25dc760e993083962c0d Mon Sep 17 00:00:00 2001 From: zch Date: Mon, 18 Aug 2025 17:39:06 +0800 Subject: [PATCH 9/9] =?UTF-8?q?feat(portal):=20=E6=B7=BB=E5=8A=A0=20haiwei?= =?UTF-8?q?=E5=AE=98=E7=BD=91=E8=8F=9C=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 haiwei 官网菜单页面,包含菜单列表、搜索、新增、修改、删除等功能 -集成 vue-treeselect 组件用于选择父节点 - 实现菜单数据的树形结构展示 - 添加菜单数据的异步加载和提交功能 --- ruoyi-ui/src/views/portal/hwWebMenu/index.vue | 308 ++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 ruoyi-ui/src/views/portal/hwWebMenu/index.vue diff --git a/ruoyi-ui/src/views/portal/hwWebMenu/index.vue b/ruoyi-ui/src/views/portal/hwWebMenu/index.vue new file mode 100644 index 0000000..39bcb6f --- /dev/null +++ b/ruoyi-ui/src/views/portal/hwWebMenu/index.vue @@ -0,0 +1,308 @@ + + +