feat(portal): 添加haiwei官网菜单模块
- 新增 HwWebMenu 实体类 - 创建 HwWebMenuController 控制器 - 实现 HwWebMenuMapper 接口 - 编写 HwWebMenuMapper.xml配置文件 - 开发 HwWebMenuServiceImpl 服务实现类 - 定义 IHwWebMenuService 服务接口master
parent
d9b72f83af
commit
96320bd1f4
@ -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<HwWebMenu> 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<HwWebMenu> list = hwWebMenuService.selectHwWebMenuList(hwWebMenu);
|
||||
ExcelUtil<HwWebMenu> util = new ExcelUtil<HwWebMenu>(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));
|
||||
}
|
||||
}
|
@ -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();
|
||||
}
|
||||
}
|
@ -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<HwWebMenu> 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);
|
||||
}
|
@ -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<HwWebMenu> 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);
|
||||
}
|
@ -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<HwWebMenu> 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);
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.portal.mapper.HwWebMenuMapper">
|
||||
|
||||
<resultMap type="HwWebMenu" id="HwWebMenuResult">
|
||||
<result property="webMenuId" column="web_menu_id" />
|
||||
<result property="parent" column="parent" />
|
||||
<result property="ancestors" column="ancestors" />
|
||||
<result property="status" column="status" />
|
||||
<result property="webMenuName" column="web_menu_name" />
|
||||
<result property="tenantId" column="tenant_id" />
|
||||
<result property="webMenuPic" column="web_menu__pic" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectHwWebMenuVo">
|
||||
select web_menu_id, parent, ancestors, status, web_menu_name, tenant_id, web_menu__pic from hw_web_menu
|
||||
</sql>
|
||||
|
||||
<select id="selectHwWebMenuList" parameterType="HwWebMenu" resultMap="HwWebMenuResult">
|
||||
<include refid="selectHwWebMenuVo"/>
|
||||
<where>
|
||||
<if test="parent != null "> and parent = #{parent}</if>
|
||||
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
|
||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||
<if test="webMenuName != null and webMenuName != ''"> and web_menu_name like concat('%', #{webMenuName}, '%')</if>
|
||||
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||
<if test="webMenuPic != null and webMenuPic != ''"> and web_menu__pic = #{webMenuPic}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectHwWebMenuByWebMenuId" parameterType="Long" resultMap="HwWebMenuResult">
|
||||
<include refid="selectHwWebMenuVo"/>
|
||||
where web_menu_id = #{webMenuId}
|
||||
</select>
|
||||
|
||||
<insert id="insertHwWebMenu" parameterType="HwWebMenu">
|
||||
insert into hw_web_menu
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="webMenuId != null">web_menu_id,</if>
|
||||
<if test="parent != null">parent,</if>
|
||||
<if test="ancestors != null">ancestors,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="webMenuName != null">web_menu_name,</if>
|
||||
<if test="tenantId != null">tenant_id,</if>
|
||||
<if test="webMenuPic != null">web_menu__pic,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="webMenuId != null">#{webMenuId},</if>
|
||||
<if test="parent != null">#{parent},</if>
|
||||
<if test="ancestors != null">#{ancestors},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="webMenuName != null">#{webMenuName},</if>
|
||||
<if test="tenantId != null">#{tenantId},</if>
|
||||
<if test="webMenuPic != null">#{webMenuPic},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateHwWebMenu" parameterType="HwWebMenu">
|
||||
update hw_web_menu
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="parent != null">parent = #{parent},</if>
|
||||
<if test="ancestors != null">ancestors = #{ancestors},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="webMenuName != null">web_menu_name = #{webMenuName},</if>
|
||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||
<if test="webMenuPic != null">web_menu__pic = #{webMenuPic},</if>
|
||||
</trim>
|
||||
where web_menu_id = #{webMenuId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteHwWebMenuByWebMenuId" parameterType="Long">
|
||||
delete from hw_web_menu where web_menu_id = #{webMenuId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteHwWebMenuByWebMenuIds" parameterType="String">
|
||||
delete from hw_web_menu where web_menu_id in
|
||||
<foreach item="webMenuId" collection="array" open="(" separator="," close=")">
|
||||
#{webMenuId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue