【新增】系统菜单
This commit is contained in:
52
src/main/java/com/corewing/app/entity/SysMenu.java
Normal file
52
src/main/java/com/corewing/app/entity/SysMenu.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.corewing.app.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.corewing.app.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
@TableName("sys_menu")
|
||||
public class SysMenu extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 菜单id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
private String menuName;
|
||||
|
||||
/**
|
||||
* 菜单地址
|
||||
*/
|
||||
private String menuUrl;
|
||||
|
||||
/**
|
||||
* 菜单图标
|
||||
*/
|
||||
private String menuIcon;
|
||||
|
||||
/**
|
||||
* 菜单分类
|
||||
*/
|
||||
private String menuCategory;
|
||||
|
||||
/**
|
||||
* 是否隐藏
|
||||
*/
|
||||
private boolean visible;
|
||||
|
||||
|
||||
|
||||
}
|
||||
9
src/main/java/com/corewing/app/mapper/SysMenuMapper.java
Normal file
9
src/main/java/com/corewing/app/mapper/SysMenuMapper.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.corewing.app.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.corewing.app.entity.SysMenu;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class SysMainController {
|
||||
*/
|
||||
@GetMapping("/admin/index.html")
|
||||
public String adminIndex() {
|
||||
return "admin/index";
|
||||
return "admin/main";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.corewing.app.modules.admin;
|
||||
|
||||
import com.corewing.app.common.Result;
|
||||
import com.corewing.app.entity.SysMenu;
|
||||
import com.corewing.app.service.SysMenuService;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/sys/menu")
|
||||
public class SysMenuController {
|
||||
|
||||
@Resource
|
||||
private SysMenuService sysMenuService;
|
||||
|
||||
@GetMapping("/initSysMenu")
|
||||
@ResponseBody
|
||||
public Result<List<SysMenu>> initSysMenu() {
|
||||
List<SysMenu> sysMenus = sysMenuService.initSysMenu();
|
||||
return Result.success(sysMenus);
|
||||
}
|
||||
|
||||
}
|
||||
10
src/main/java/com/corewing/app/service/SysMenuService.java
Normal file
10
src/main/java/com/corewing/app/service/SysMenuService.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.corewing.app.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.corewing.app.entity.SysMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SysMenuService extends IService<SysMenu> {
|
||||
List<SysMenu> initSysMenu();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.corewing.app.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.corewing.app.entity.SysMenu;
|
||||
import com.corewing.app.mapper.SysMenuMapper;
|
||||
import com.corewing.app.service.SysMenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> implements SysMenuService {
|
||||
|
||||
|
||||
@Override
|
||||
public List<SysMenu> initSysMenu() {
|
||||
LambdaQueryWrapper<SysMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SysMenu::isVisible, Boolean.TRUE);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user