diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController1.java new file mode 100644 index 0000000..621bdcb --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebController1.java @@ -0,0 +1,98 @@ +package com.ruoyi.portal.controller; + +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.core.web.page.TableDataInfo; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.portal.domain.HwWeb1; +import com.ruoyi.portal.service.IHwWebService1; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * haiwei官网jsonController + * + * @author ruoyi + * @date 2025-08-18 + */ +@RestController +@RequestMapping("/HwWeb1") +public class HwWebController1 extends BaseController +{ + @Autowired + private IHwWebService1 hwWebService1; + + /** + * 查询haiwei官网json列表 + */ + //@RequiresPermissions("portalhwWeb:list") + @GetMapping("/list") + public TableDataInfo list(HwWeb1 HwWeb1) + { + startPage(); + List list = hwWebService1.selectHwWebList(HwWeb1); + return getDataTable(list); + } + + /** + * 导出haiwei官网json列表 + */ + //@RequiresPermissions("portalhwWeb:export") + @Log(title = "haiwei官网json", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwWeb1 HwWeb1) + { + List list = hwWebService1.selectHwWebList(HwWeb1); + ExcelUtil util = new ExcelUtil(HwWeb1.class); + util.exportExcel(response, list, "haiwei官网json数据"); + } + + /** + * 获取haiwei官网json详细信息 + */ + //@RequiresPermissions("portalhwWeb:query") + @GetMapping(value = "/{webCode}") + public AjaxResult getInfo(@PathVariable("webCode") Long webCode) + { + return success(hwWebService1.selectHwWebByWebcode(webCode)); + } + + /** + * 新增haiwei官网json + */ + //@RequiresPermissions("portalhwWeb:add") + @Log(title = "haiwei官网json", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwWeb1 HwWeb1) + { + return toAjax(hwWebService1.insertHwWeb(HwWeb1)); + } + + /** + * 修改haiwei官网json + */ + //@RequiresPermissions("portalhwWeb:edit") + @Log(title = "haiwei官网json", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwWeb1 HwWeb1) + { + int i = hwWebService1.updateHwWeb(HwWeb1); + return toAjax(i); + } + + /** + * 删除haiwei官网json + */ + //@RequiresPermissions("portalhwWeb:remove") + @Log(title = "haiwei官网json", businessType = BusinessType.DELETE) + @DeleteMapping("/{webIds}") + public AjaxResult remove(@PathVariable Long[] webIds) + { + return toAjax(hwWebService1.deleteHwWebByWebIds(webIds)); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController1.java new file mode 100644 index 0000000..1faf456 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/controller/HwWebMenuController1.java @@ -0,0 +1,103 @@ +package com.ruoyi.portal.controller; + +import com.ruoyi.common.core.utils.poi.ExcelUtil; +import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.common.log.annotation.Log; +import com.ruoyi.common.log.enums.BusinessType; +import com.ruoyi.portal.domain.HwWebMenu1; +import com.ruoyi.portal.service.IHwWebMenuService1; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * haiwei官网菜单Controller + * + * @author zch + * @date 2025-08-18 + */ +@RestController +@RequestMapping("/hwWebMenu1") +public class HwWebMenuController1 extends BaseController +{ + @Autowired + private IHwWebMenuService1 hwWebMenuService1; + + /** + * 查询haiwei官网菜单列表 + */ + //@RequiresPermissions("portalhwWebMenu:list") + @GetMapping("/list") + public AjaxResult list(HwWebMenu1 hwWebMenu1) + { + List list = hwWebMenuService1.selectHwWebMenuList(hwWebMenu1); + return success(list); + } + + /** + * 导出haiwei官网菜单列表 + */ + //@RequiresPermissions("portalhwWebMenu:export") + @Log(title = "haiwei官网菜单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, HwWebMenu1 hwWebMenu1) + { + List list = hwWebMenuService1.selectHwWebMenuList(hwWebMenu1); + ExcelUtil util = new ExcelUtil(HwWebMenu1.class); + util.exportExcel(response, list, "haiwei官网菜单数据"); + } + + /** + * 获取haiwei官网菜单详细信息 + */ + //@RequiresPermissions("portalhwWebMenu:query") + @GetMapping(value = "/{webMenuId}") + public AjaxResult getInfo(@PathVariable("webMenuId") Long webMenuId) + { + return success(hwWebMenuService1.selectHwWebMenuByWebMenuId(webMenuId)); + } + + /** + * 新增haiwei官网菜单 + */ + //@RequiresPermissions("portalhwWebMenu:add") + @Log(title = "haiwei官网菜单", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody HwWebMenu1 hwWebMenu1) + { + return toAjax(hwWebMenuService1.insertHwWebMenu(hwWebMenu1)); + } + + /** + * 修改haiwei官网菜单 + */ + //@RequiresPermissions("portalhwWebMenu:edit") + @Log(title = "haiwei官网菜单", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody HwWebMenu1 hwWebMenu1) + { + return toAjax(hwWebMenuService1.updateHwWebMenu(hwWebMenu1)); + } + + /** + * 删除haiwei官网菜单 + */ + //@RequiresPermissions("portalhwWebMenu:remove") + @Log(title = "haiwei官网菜单", businessType = BusinessType.DELETE) + @DeleteMapping("/{webMenuIds}") + public AjaxResult remove(@PathVariable Long[] webMenuIds) + { + return toAjax(hwWebMenuService1.deleteHwWebMenuByWebMenuIds(webMenuIds)); + } + + /** + * 获取菜单树列表 + */ + @GetMapping("/selectMenuTree") + public AjaxResult selectMenuTree(HwWebMenu1 hwWebMenu1){ + return success(hwWebMenuService1.selectMenuTree(hwWebMenu1)); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb1.java new file mode 100644 index 0000000..84f8600 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWeb1.java @@ -0,0 +1,80 @@ +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 HwWeb1 extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long webId; + + /** json */ + @Excel(name = "json") + private String webJson; + + /** json字符串 */ + @Excel(name = "json字符串") + private String webJsonString; + + /** 页面 */ + @Excel(name = "页面") + private Long webCode; + + + 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; + } + public void setWebJsonString(String webJsonString) + { + this.webJsonString = webJsonString; + } + + 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()) + .append("webCode", getWebCode()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu1.java new file mode 100644 index 0000000..7b0b6a2 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/domain/HwWebMenu1.java @@ -0,0 +1,134 @@ +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.TreeEntity; + +import java.util.List; + +/** + * haiwei官网菜单对象 hw_web_menu + * + * @author zch + * @date 2025-08-18 + */ +public class HwWebMenu1 extends TreeEntity +{ + private static final long serialVersionUID = 1L; + + /** 菜单主键id */ + private Long webMenuId; + + /** 父节点 */ + @Excel(name = "父节点") + private Long parent; + + /** 状态 */ + @Excel(name = "状态") + private String status; + + /** 菜单名称 */ + @Excel(name = "菜单名称") + private String webMenuName; + + /** 租户 */ + @Excel(name = "租户") + private Long tenantId; + + /** 图片地址 */ + @Excel(name = "图片地址") + private String webMenuPic; + + /** 官网菜单类型 */ + @Excel(name = "官网菜单类型") + private Long webMenuType; + + private String valuel; + + 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 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; + } + public void setWebMenuType(Long webMenuType) + { + this.webMenuType = webMenuType; + } + + public Long getWebMenuType() + { + return webMenuType; + } + + public String getValuel() { + return valuel; + } + public void setValuel(String valuel) { + this.valuel = valuel; + } + + @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()) + .append("valuel", getValuel()) + .toString(); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper1.java new file mode 100644 index 0000000..b38da82 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMapper1.java @@ -0,0 +1,63 @@ +package com.ruoyi.portal.mapper; + +import com.ruoyi.portal.domain.HwWeb1; +import com.ruoyi.portal.domain.HwWeb1; + +import java.util.List; + +/** + * haiwei官网jsonMapper接口 + * + * @author ruoyi + * @date 2025-08-18 + */ +public interface HwWebMapper1 +{ + /** + * 查询haiwei官网json + * + * @param webId haiwei官网json主键 + * @return haiwei官网json + */ + public HwWeb1 selectHwWebByWebcode(Long webCode); + + /** + * 查询haiwei官网json列表 + * + * @param HwWeb1 haiwei官网json + * @return haiwei官网json集合 + */ + public List selectHwWebList(HwWeb1 HwWeb1); + + /** + * 新增haiwei官网json + * + * @param HwWeb1 haiwei官网json + * @return 结果 + */ + public int insertHwWeb(HwWeb1 HwWeb1); + + /** + * 修改haiwei官网json + * + * @param HwWeb1 haiwei官网json + * @return 结果 + */ + public int updateHwWeb(HwWeb1 HwWeb1); + + /** + * 删除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/mapper/HwWebMenuMapper1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMenuMapper1.java new file mode 100644 index 0000000..332770f --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/mapper/HwWebMenuMapper1.java @@ -0,0 +1,71 @@ +package com.ruoyi.portal.mapper; + +import com.ruoyi.portal.domain.HwWebMenu; +import com.ruoyi.portal.domain.HwWebMenu1; +import com.ruoyi.portal.domain.HwWebMenu1; + +import java.util.List; + +/** + * haiwei官网菜单Mapper接口 + * + * @author zch + * @date 2025-08-18 + */ +public interface HwWebMenuMapper1 +{ + /** + * 查询haiwei官网菜单 + * + * @param webMenuId haiwei官网菜单主键 + * @return haiwei官网菜单 + */ + public HwWebMenu1 selectHwWebMenuByWebMenuId(Long webMenuId); + + /** + * 查询haiwei官网菜单列表 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return haiwei官网菜单集合 + */ + public List selectHwWebMenuList(HwWebMenu1 HwWebMenu1); + + /** + * 新增haiwei官网菜单 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return 结果 + */ + public int insertHwWebMenu(HwWebMenu1 HwWebMenu1); + + /** + * 修改haiwei官网菜单 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return 结果 + */ + public int updateHwWebMenu(HwWebMenu1 HwWebMenu1); + + /** + * 删除haiwei官网菜单 + * + * @param webMenuId haiwei官网菜单主键 + * @return 结果 + */ + public int deleteHwWebMenuByWebMenuId(Long webMenuId); + + /** + * 批量删除haiwei官网菜单 + * + * @param webMenuIds 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteHwWebMenuByWebMenuIds(Long[] webMenuIds); + + + /** + * 获取菜单树列表 + */ + public List selectMenuTree(HwWebMenu1 hwWebMenu); + +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService1.java new file mode 100644 index 0000000..f86d510 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebMenuService1.java @@ -0,0 +1,70 @@ +package com.ruoyi.portal.service; + +import com.ruoyi.portal.domain.HwWebMenu1; +import com.ruoyi.portal.domain.HwWebMenu1; + +import java.util.List; + +/** + * haiwei官网菜单Service接口 + * + * @author zch + * @date 2025-08-18 + */ +public interface IHwWebMenuService1 +{ + /** + * 查询haiwei官网菜单 + * + * @param webMenuId haiwei官网菜单主键 + * @return haiwei官网菜单 + */ + public HwWebMenu1 selectHwWebMenuByWebMenuId(Long webMenuId); + + /** + * 查询haiwei官网菜单列表 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return haiwei官网菜单集合 + */ + public List selectHwWebMenuList(HwWebMenu1 HwWebMenu1); + + /** + * 新增haiwei官网菜单 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return 结果 + */ + public int insertHwWebMenu(HwWebMenu1 HwWebMenu1); + + /** + * 修改haiwei官网菜单 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return 结果 + */ + public int updateHwWebMenu(HwWebMenu1 HwWebMenu1); + + /** + * 批量删除haiwei官网菜单 + * + * @param webMenuIds 需要删除的haiwei官网菜单主键集合 + * @return 结果 + */ + public int deleteHwWebMenuByWebMenuIds(Long[] webMenuIds); + + /** + * 删除haiwei官网菜单信息 + * + * @param webMenuId haiwei官网菜单主键 + * @return 结果 + */ + public int deleteHwWebMenuByWebMenuId(Long webMenuId); + + + /** + * 获取菜单树列表 + */ + public List selectMenuTree(HwWebMenu1 HwWebMenu1); + +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService1.java new file mode 100644 index 0000000..84602be --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/IHwWebService1.java @@ -0,0 +1,63 @@ +package com.ruoyi.portal.service; + +import com.ruoyi.portal.domain.HwWeb1; +import com.ruoyi.portal.domain.HwWeb1; + +import java.util.List; + +/** + * haiwei官网jsonService接口 + * + * @author ruoyi + * @date 2025-08-18 + */ +public interface IHwWebService1 +{ + /** + * 查询haiwei官网json + * + * @param webId haiwei官网json主键 + * @return haiwei官网json + */ + public HwWeb1 selectHwWebByWebcode(Long webCode); + + /** + * 查询haiwei官网json列表 + * + * @param HwWeb1 haiwei官网json + * @return haiwei官网json集合 + */ + public List selectHwWebList(HwWeb1 HwWeb1); + + /** + * 新增haiwei官网json + * + * @param HwWeb1 haiwei官网json + * @return 结果 + */ + public int insertHwWeb(HwWeb1 HwWeb1); + + /** + * 修改haiwei官网json + * + * @param HwWeb1 haiwei官网json + * @return 结果 + */ + public int updateHwWeb(HwWeb1 HwWeb1); + + /** + * 批量删除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/HwWebMenuServiceImpl1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl1.java new file mode 100644 index 0000000..606289c --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebMenuServiceImpl1.java @@ -0,0 +1,167 @@ +package com.ruoyi.portal.service.impl; + +import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.portal.domain.HwWebMenu1; +import com.ruoyi.portal.mapper.HwWebMenuMapper1; +import com.ruoyi.portal.service.IHwWebMenuService1; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * haiwei官网菜单Service业务层处理 + * + * @author zch + * @date 2025-08-18 + */ +@Service +public class HwWebMenuServiceImpl1 implements IHwWebMenuService1 +{ + @Autowired + private HwWebMenuMapper1 HwWebMenuMapper1; + + /** + * 查询haiwei官网菜单 + * + * @param webMenuId haiwei官网菜单主键 + * @return haiwei官网菜单 + */ + @Override + public HwWebMenu1 selectHwWebMenuByWebMenuId(Long webMenuId) + { + return HwWebMenuMapper1.selectHwWebMenuByWebMenuId(webMenuId); + } + + /** + * 查询haiwei官网菜单列表 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return haiwei官网菜单 + */ + @Override + public List selectHwWebMenuList(HwWebMenu1 HwWebMenu1) + { + List hwWebMenus = HwWebMenuMapper1.selectHwWebMenuList(HwWebMenu1); + return hwWebMenus; + } + + /** + * 获取菜单树列表 + */ + @Override + public List selectMenuTree(HwWebMenu1 HwWebMenu1) + { + List hwWebMenus = HwWebMenuMapper1.selectHwWebMenuList(HwWebMenu1); + return buildWebMenuTree(hwWebMenus); + } + + /** + * 新增haiwei官网菜单 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return 结果 + */ + @Override + public int insertHwWebMenu(HwWebMenu1 HwWebMenu1) + { + return HwWebMenuMapper1.insertHwWebMenu(HwWebMenu1); + } + + /** + * 修改haiwei官网菜单 + * + * @param HwWebMenu1 haiwei官网菜单 + * @return 结果 + */ + @Override + public int updateHwWebMenu(HwWebMenu1 HwWebMenu1) + { + return HwWebMenuMapper1.updateHwWebMenu(HwWebMenu1); + } + + /** + * 批量删除haiwei官网菜单 + * + * @param webMenuIds 需要删除的haiwei官网菜单主键 + * @return 结果 + */ + @Override + public int deleteHwWebMenuByWebMenuIds(Long[] webMenuIds) + { + return HwWebMenuMapper1.deleteHwWebMenuByWebMenuIds(webMenuIds); + } + + /** + * 删除haiwei官网菜单信息 + * + * @param webMenuId haiwei官网菜单主键 + * @return 结果 + */ + @Override + public int deleteHwWebMenuByWebMenuId(Long webMenuId) + { + return HwWebMenuMapper1.deleteHwWebMenuByWebMenuId(webMenuId); + } + +/** + * 构建前端所需要树结构(根据传入的平铺菜单列表构造树) + * + * @param menus 菜单列表 + * @return 树结构列表 + */ + public List buildWebMenuTree(List menus) { + List returnList = new ArrayList<>(); + List tempList = menus.stream().map(HwWebMenu1::getWebMenuId).collect(Collectors.toList()); + for (HwWebMenu1 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, HwWebMenu1 t) { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (HwWebMenu1 tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, HwWebMenu1 t) { + List tlist = new ArrayList(); + Iterator it = list.iterator(); + while (it.hasNext()) { + HwWebMenu1 n = it.next(); + if (StringUtils.isNotNull(n.getParent()) && n.getParent().longValue() == t.getWebMenuId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, HwWebMenu1 t) { + return !getChildList(list, t).isEmpty(); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl1.java b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl1.java new file mode 100644 index 0000000..95965c4 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/java/com/ruoyi/portal/service/impl/HwWebServiceImpl1.java @@ -0,0 +1,104 @@ +package com.ruoyi.portal.service.impl; + +import com.ruoyi.portal.domain.HwWeb1; + +import com.ruoyi.portal.mapper.HwWebMapper1; + +import com.ruoyi.portal.service.IHwWebService1; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * haiwei官网jsonService业务层处理 + * + * @author ruoyi + * @date 2025-08-18 + */ +@Service +public class HwWebServiceImpl1 implements IHwWebService1 +{ + @Autowired + private HwWebMapper1 hwWebMapper1; + + /** + * 查询haiwei官网json + * + * @param webId haiwei官网json主键 + * @return haiwei官网json + */ + @Override + public HwWeb1 selectHwWebByWebcode(Long webCode) + { + return hwWebMapper1.selectHwWebByWebcode(webCode); + } + + + /** + * 查询haiwei官网json列表 + * + * @param HwWeb1 haiwei官网json + * @return haiwei官网json + */ + @Override + public List selectHwWebList(HwWeb1 HwWeb1) + { + return hwWebMapper1.selectHwWebList(HwWeb1); + } + + /** + * 新增haiwei官网json + * + * @param HwWeb1 haiwei官网json + * @return 结果 + */ + @Override + public int insertHwWeb(HwWeb1 HwWeb1) + { + return hwWebMapper1.insertHwWeb(HwWeb1); + } + + /** + * 修改haiwei官网json + * + * @param HwWeb1 haiwei官网json + * @return 结果 + */ + @Override + public int updateHwWeb(HwWeb1 HwWeb1) + { + HwWeb1 codeWeb = new HwWeb1(); + //编号唯一 + codeWeb.setWebCode(HwWeb1.getWebCode()); + if(hwWebMapper1.selectHwWebList(codeWeb).isEmpty()){ + return hwWebMapper1.insertHwWeb(HwWeb1); + } + return hwWebMapper1.updateHwWeb(HwWeb1); + } + + /** + * 批量删除haiwei官网json + * + * @param webIds 需要删除的haiwei官网json主键 + * @return 结果 + */ + @Override + public int deleteHwWebByWebIds(Long[] webIds) + { + return hwWebMapper1.deleteHwWebByWebIds(webIds); + } + + /** + * 删除haiwei官网json信息 + * + * @param webId haiwei官网json主键 + * @return 结果 + */ + @Override + public int deleteHwWebByWebId(Long webId) + { + return hwWebMapper1.deleteHwWebByWebId(webId); + } +} diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper1.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper1.xml new file mode 100644 index 0000000..28e0c97 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMapper1.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + select web_id, web_json, web_json_string, web_code from hw_web1 + + + + + + + + insert into hw_web1 + + web_json, + web_json_string, + web_code, + + + #{webJson}, + #{webJsonString}, + #{webCode}, + + + + + update hw_web1 + + web_json = #{webJson}, + web_json_string = #{webJsonString}, + web_code = #{webCode}, + + where web_code = #{webCode} + + + + delete from hw_web1 where web_id = #{webId} + + + + delete from hw_web1 where web_id in + + #{webId} + + + \ No newline at end of file diff --git a/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml new file mode 100644 index 0000000..dc8a876 --- /dev/null +++ b/ruoyi-modules/hw-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + select web_menu_id, parent, ancestors, status, web_menu_name, tenant_id, web_menu__pic, + value, + web_menu_type from hw_web_menu1 + + + + + + + + insert into hw_web_menu1 + + web_menu_id, + parent, + ancestors, + status, + web_menu_name, + tenant_id, + web_menu__pic, + web_menu_type, + value, + + + #{webMenuId}, + #{parent}, + #{ancestors}, + #{status}, + #{webMenuName}, + #{tenantId}, + #{webMenuPic}, + #{webMenuType}, + #{value}, + + + + + update hw_web_menu1 + + parent = #{parent}, + ancestors = #{ancestors}, + status = #{status}, + web_menu_name = #{webMenuName}, + tenant_id = #{tenantId}, + web_menu__pic = #{webMenuPic}, + web_menu_type = #{webMenuType}, + value = #{value}, + + where web_menu_id = #{webMenuId} + + + + delete from hw_web_menu1 where web_menu_id = #{webMenuId} + + + + delete from hw_web_menu1 where web_menu_id in + + #{webMenuId} + + + \ No newline at end of file