Skip to content

Commit

Permalink
!203 菜单维护服务监控、 角色管理、岗位管理导入导出
Browse files Browse the repository at this point in the history
Merge pull request !203 from fxz/dev
  • Loading branch information
lbw authored and gitee-org committed Mar 21, 2022
2 parents 70eb455 + 4072305 commit b43aa85
Show file tree
Hide file tree
Showing 11 changed files with 374 additions and 1 deletion.
7 changes: 6 additions & 1 deletion db/pig.sql
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ INSERT INTO `sys_menu` VALUES (1301, '角色新增', 'sys_role_add', NULL, 1300,
INSERT INTO `sys_menu` VALUES (1302, '角色修改', 'sys_role_edit', NULL, 1300, NULL, 0, '0', '1', '0', ' ', '2017-11-08 10:14:41', ' ', '2021-05-25 06:48:34');
INSERT INTO `sys_menu` VALUES (1303, '角色删除', 'sys_role_del', NULL, 1300, NULL, 0, '0', '1', '0', ' ', '2017-11-08 10:14:59', ' ', '2021-05-25 06:48:34');
INSERT INTO `sys_menu` VALUES (1304, '分配权限', 'sys_role_perm', NULL, 1300, NULL, 0, '0', '1', '0', ' ', '2018-04-20 07:22:55', ' ', '2021-05-25 06:48:34');
INSERT INTO `sys_menu` VALUES (1305, '导入导出', 'sys_role_import_export', NULL, 1300, NULL, 0, '0', '1', '0', 'admin', '2022-03-21 11:14:52', 'admin', '2022-03-21 11:15:07');
INSERT INTO `sys_menu` VALUES (1400, '部门管理', NULL, '/admin/dept/index', 1000, 'icon-web-icon-', 0, '0', '0', '0', ' ', '2018-01-20 13:17:19', ' ', '2020-03-12 00:15:44');
INSERT INTO `sys_menu` VALUES (1401, '部门新增', 'sys_dept_add', NULL, 1400, NULL, 0, '0', '1', '0', ' ', '2018-01-20 14:56:16', ' ', '2021-05-25 06:48:34');
INSERT INTO `sys_menu` VALUES (1402, '部门修改', 'sys_dept_edit', NULL, 1400, NULL, 0, '0', '1', '0', ' ', '2018-01-20 14:56:59', ' ', '2021-05-25 06:48:34');
Expand All @@ -250,6 +251,7 @@ INSERT INTO `sys_menu` VALUES (1501, '岗位查看', 'sys_post_get', NULL, 1500,
INSERT INTO `sys_menu` VALUES (1502, '岗位新增', 'sys_post_add', NULL, 1500, '1', 1, '0', '1', '0', NULL, '2018-05-15 21:35:18', 'admin', '2022-03-15 17:32:48');
INSERT INTO `sys_menu` VALUES (1503, '岗位修改', 'sys_post_edit', NULL, 1500, '1', 2, '0', '1', '0', NULL, '2018-05-15 21:35:18', 'admin', '2022-03-15 17:33:10');
INSERT INTO `sys_menu` VALUES (1504, '岗位删除', 'sys_post_del', NULL, 1500, '1', 3, '0', '1', '0', NULL, '2018-05-15 21:35:18', 'admin', '2022-03-15 17:33:27');
INSERT INTO `sys_menu` VALUES (1505, '导入导出', 'sys_post_import_export', NULL, 1500, NULL, 4, '0', '1', '0', 'admin', '2022-03-21 12:53:05', 'admin', '2022-03-21 12:53:05');
INSERT INTO `sys_menu` VALUES (2000, '系统管理', NULL, '/setting', -1, 'icon-xitongguanli', 2, '0', '0', '0', ' ', '2017-11-07 20:56:00', ' ', '2020-03-11 23:52:53');
INSERT INTO `sys_menu` VALUES (2100, '日志管理', NULL, '/admin/log/index', 2000, 'icon-rizhiguanli', 0, '0', '0', '0', ' ', '2017-11-20 14:06:22', ' ', '2020-03-12 00:15:49');
INSERT INTO `sys_menu` VALUES (2101, '日志删除', 'sys_log_del', NULL, 2100, NULL, 0, '0', '1', '0', ' ', '2017-11-20 20:37:37', ' ', '2021-05-25 06:48:34');
Expand All @@ -264,7 +266,6 @@ INSERT INTO `sys_menu` VALUES (2400, '终端管理', '', '/admin/client/index',
INSERT INTO `sys_menu` VALUES (2401, '客户端新增', 'sys_client_add', NULL, 2400, '1', 0, '0', '1', '0', ' ', '2018-05-15 21:35:18', ' ', '2021-05-25 06:48:34');
INSERT INTO `sys_menu` VALUES (2402, '客户端修改', 'sys_client_edit', NULL, 2400, NULL, 0, '0', '1', '0', ' ', '2018-05-15 21:37:06', ' ', '2021-05-25 06:48:34');
INSERT INTO `sys_menu` VALUES (2403, '客户端删除', 'sys_client_del', NULL, 2400, NULL, 0, '0', '1', '0', ' ', '2018-05-15 21:39:16', ' ', '2021-05-25 06:48:34');
INSERT INTO `sys_menu` VALUES (2500, '服务监控', NULL, 'http://localhost:5001', 2000, 'icon-server', 0, '0', '0', '0', ' ', '2018-06-26 10:50:32', ' ', '2019-02-01 20:41:30');
INSERT INTO `sys_menu` VALUES (2600, '文件管理', NULL, '/admin/file/index', 2000, 'icon-wenjianguanli', 0, '0', '0', '0', ' ', '2018-06-26 10:50:32', ' ', '2019-02-01 20:41:30');
INSERT INTO `sys_menu` VALUES (2601, '文件删除', 'sys_file_del', NULL, 2600, NULL, 0, '0', '1', '0', ' ', '2017-11-29 11:30:11', ' ', '2021-05-25 06:48:34');
INSERT INTO `sys_menu` VALUES (2602, '文件新增', 'sys_file_add', NULL, 2600, NULL, 0, '0', '1', '0', ' ', '2018-05-11 22:34:55', ' ', '2021-05-25 06:48:34');
Expand All @@ -277,6 +278,7 @@ INSERT INTO `sys_menu` VALUES (3301, '表单新增', 'gen_form_add', NULL, 3300,
INSERT INTO `sys_menu` VALUES (3302, '表单修改', 'gen_form_edit', NULL, 3300, '', 0, '0', '1', '0', ' ', '2018-05-15 21:35:18', ' ', '2020-03-11 22:39:09');
INSERT INTO `sys_menu` VALUES (3303, '表单删除', 'gen_form_del', NULL, 3300, '', 0, '0', '1', '0', ' ', '2018-05-15 21:35:18', ' ', '2020-03-11 22:39:11');
INSERT INTO `sys_menu` VALUES (3400, '表单设计', NULL, '/gen/design', 3000, 'icon-biaodanbiaoqian', 0, '1', '0', '0', ' ', '2020-03-11 22:18:05', ' ', '2020-03-12 00:16:25');
INSERT INTO `sys_menu` VALUES (4000, '服务监控', NULL, 'http://localhost:5001/login', -1, 'icon-zhexiantu', 4, '0', '0', '0', 'admin', '2022-03-21 09:44:50', 'admin', '2022-03-21 09:47:06');
INSERT INTO `sys_menu` VALUES (9999, '系统官网', NULL, 'https://pig4cloud.com/#/', -1, 'icon-guanwangfangwen', 999, '0', '0', '0', ' ', '2019-01-17 17:05:19', 'admin', '2020-03-11 23:52:57');
COMMIT;

Expand Down Expand Up @@ -412,6 +414,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 1301);
INSERT INTO `sys_role_menu` VALUES (1, 1302);
INSERT INTO `sys_role_menu` VALUES (1, 1303);
INSERT INTO `sys_role_menu` VALUES (1, 1304);
INSERT INTO `sys_role_menu` VALUES (1, 1305);
INSERT INTO `sys_role_menu` VALUES (1, 1400);
INSERT INTO `sys_role_menu` VALUES (1, 1401);
INSERT INTO `sys_role_menu` VALUES (1, 1402);
Expand All @@ -421,6 +424,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 1501);
INSERT INTO `sys_role_menu` VALUES (1, 1502);
INSERT INTO `sys_role_menu` VALUES (1, 1503);
INSERT INTO `sys_role_menu` VALUES (1, 1504);
INSERT INTO `sys_role_menu` VALUES (1, 1505);
INSERT INTO `sys_role_menu` VALUES (1, 2000);
INSERT INTO `sys_role_menu` VALUES (1, 2100);
INSERT INTO `sys_role_menu` VALUES (1, 2101);
Expand All @@ -447,6 +451,7 @@ INSERT INTO `sys_role_menu` VALUES (1, 3301);
INSERT INTO `sys_role_menu` VALUES (1, 3302);
INSERT INTO `sys_role_menu` VALUES (1, 3303);
INSERT INTO `sys_role_menu` VALUES (1, 3400);
INSERT INTO `sys_role_menu` VALUES (1, 4000);
INSERT INTO `sys_role_menu` VALUES (1, 9999);
COMMIT;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package com.pig4cloud.pig.admin.api.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
* 岗位excel 对应的实体
*
* @author fxz
* @date 2022/3/21
*/
@Data
@ColumnWidth(30)
public class PostExcelVO implements Serializable {

private static final long serialVersionUID = 1L;

/**
* 主键ID
*/
@ExcelProperty("岗位编号")
private Long postId;

/**
* 岗位名称
*/
@NotBlank(message = "岗位名称不能为空")
@ExcelProperty("岗位名称")
private String postName;

/**
* 岗位标识
*/
@NotBlank(message = "岗位标识不能为空")
@ExcelProperty("岗位标识")
private String postCode;

/**
* 岗位排序
*/
@NotNull(message = "岗位排序不能为空")
@ExcelProperty("岗位排序")
private Integer postSort;

/**
* 岗位描述
*/
@NotBlank(message = "岗位描述不能为空")
@ExcelProperty(value = "岗位描述")
private String remark;

/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package com.pig4cloud.pig.admin.api.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
* 角色excel 对应的实体
*
* @author fxz
* @date 2022/3/21
*/
@Data
@ColumnWidth(30)
public class RoleExcelVO implements Serializable {

private static final long serialVersionUID = 1L;

/**
* 主键ID
*/
@ExcelProperty("角色编号")
private Long roleId;

/**
* 角色名称
*/
@NotBlank(message = "角色名称不能为空")
@ExcelProperty("角色名称")
private String roleName;

/**
* 角色标识
*/
@NotBlank(message = "角色标识不能为空")
@ExcelProperty("角色标识")
private String roleCode;

/**
* 角色描述
*/
@NotBlank(message = "角色描述不能为空")
@ExcelProperty("角色描述")
private String roleDesc;

/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private LocalDateTime createTime;

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.admin.api.entity.SysPost;
import com.pig4cloud.pig.admin.api.vo.PostExcelVO;
import com.pig4cloud.pig.admin.service.SysPostService;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import java.util.List;
Expand Down Expand Up @@ -115,4 +119,27 @@ public R removeById(@PathVariable Long postId) {
return R.ok(sysPostService.removeById(postId));
}

/**
* 导出excel 表格
* @return
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('sys_post_import_export')")
public List<PostExcelVO> export() {
return sysPostService.listPost();
}

/**
* 导入岗位
* @param excelVOList 岗位列表
* @param bindingResult 错误信息列表
* @return ok fail
*/
@PostMapping("/import")
@PreAuthorize("@pms.hasPermission('sys_post_import_export')")
public R importRole(@RequestExcel List<PostExcelVO> excelVOList, BindingResult bindingResult) {
return sysPostService.importPost(excelVOList, bindingResult);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,18 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.admin.api.entity.SysRole;
import com.pig4cloud.pig.admin.api.vo.RoleExcelVO;
import com.pig4cloud.pig.admin.api.vo.RoleVo;
import com.pig4cloud.pig.admin.service.SysRoleMenuService;
import com.pig4cloud.pig.admin.service.SysRoleService;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.log.annotation.SysLog;
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
import com.pig4cloud.plugin.excel.annotation.ResponseExcel;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
Expand Down Expand Up @@ -125,4 +129,27 @@ public R<Boolean> saveRoleMenus(@RequestBody RoleVo roleVo) {
return R.ok(sysRoleMenuService.saveRoleMenus(sysRole.getRoleCode(), roleVo.getRoleId(), roleVo.getMenuIds()));
}

/**
* 导出excel 表格
* @return
*/
@ResponseExcel
@GetMapping("/export")
@PreAuthorize("@pms.hasPermission('sys_role_import_export')")
public List<RoleExcelVO> export() {
return sysRoleService.listRole();
}

/**
* 导入角色
* @param excelVOList 角色列表
* @param bindingResult 错误信息列表
* @return ok fail
*/
@PostMapping("/import")
@PreAuthorize("@pms.hasPermission('sys_role_import_export')")
public R importRole(@RequestExcel List<RoleExcelVO> excelVOList, BindingResult bindingResult) {
return sysRoleService.importRole(excelVOList, bindingResult);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysPost;
import com.pig4cloud.pig.admin.api.vo.PostExcelVO;
import com.pig4cloud.pig.common.core.util.R;
import org.springframework.validation.BindingResult;

import java.util.List;

/**
* 岗位管理 服务类
Expand All @@ -28,4 +33,18 @@
*/
public interface SysPostService extends IService<SysPost> {

/**
* 导入岗位
* @param excelVOList 岗位列表
* @param bindingResult 错误信息列表
* @return ok fail
*/
R importPost(List<PostExcelVO> excelVOList, BindingResult bindingResult);

/**
* 导出excel 表格
* @return
*/
List<PostExcelVO> listPost();

}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.pig.admin.api.entity.SysRole;
import com.pig4cloud.pig.admin.api.vo.RoleExcelVO;
import com.pig4cloud.pig.common.core.util.R;
import org.springframework.validation.BindingResult;

import java.util.List;

/**
* <p>
Expand All @@ -36,4 +41,18 @@ public interface SysRoleService extends IService<SysRole> {
*/
Boolean removeRoleById(Long id);

/**
* 导入角色
* @param excelVOList 角色列表
* @param bindingResult 错误信息列表
* @return ok fail
*/
R importRole(List<RoleExcelVO> excelVOList, BindingResult bindingResult);

/**
* 查询全部的角色
* @return list
*/
List<RoleExcelVO> listRole();

}
Loading

0 comments on commit b43aa85

Please sign in to comment.