mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-10 09:05:07 +08:00
多模块重构 4:system 模块的创建,以及将相关的代码先进行迁移
This commit is contained in:
@ -0,0 +1,26 @@
|
||||
### 请求 /login 接口 => 成功
|
||||
POST {{baseUrl}}/login
|
||||
Content-Type: application/json
|
||||
tenant-id: 1
|
||||
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "admin123",
|
||||
"uuid": "3acd87a09a4f48fb9118333780e94883",
|
||||
"code": "1024"
|
||||
}
|
||||
|
||||
### 请求 /get-permission-info 接口 => 成功
|
||||
GET {{baseUrl}}/get-permission-info
|
||||
Authorization: Bearer {{token}}
|
||||
tenant-id: 1
|
||||
|
||||
### 请求 /list-menus 接口 => 成功
|
||||
GET {{baseUrl}}/list-menus
|
||||
Authorization: Bearer {{token}}
|
||||
#Authorization: Bearer a6aa7714a2e44c95aaa8a2c5adc2a67a
|
||||
tenant-id: 1
|
||||
|
||||
### 请求 /druid/xxx 接口 => 失败 TODO 临时测试
|
||||
GET http://127.0.0.1:8080/druid/123
|
||||
Authorization: Bearer {{token}}
|
@ -0,0 +1,140 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.auth.vo.auth.*;
|
||||
import cn.iocoder.yudao.module.system.convert.auth.SysAuthConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysMenuDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO;
|
||||
import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.service.auth.SysAuthService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.SysPermissionService;
|
||||
import cn.iocoder.yudao.module.system.service.permission.SysRoleService;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getClientIP;
|
||||
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getUserAgent;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserRoleIds;
|
||||
|
||||
@Api(tags = "认证")
|
||||
@RestController
|
||||
@RequestMapping("/")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class SysAuthController {
|
||||
|
||||
@Resource
|
||||
private SysAuthService authService;
|
||||
@Resource
|
||||
private SysUserCoreService userCoreService;
|
||||
@Resource
|
||||
private SysRoleService roleService;
|
||||
@Resource
|
||||
private SysPermissionService permissionService;
|
||||
@Resource
|
||||
private SysSocialCoreService socialCoreService;
|
||||
|
||||
@PostMapping("/login")
|
||||
@ApiOperation("使用账号密码登录")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<SysAuthLoginRespVO> login(@RequestBody @Valid SysAuthLoginReqVO reqVO) {
|
||||
String token = authService.login(reqVO, getClientIP(), getUserAgent());
|
||||
// 返回结果
|
||||
return success(SysAuthLoginRespVO.builder().token(token).build());
|
||||
}
|
||||
|
||||
@GetMapping("/get-permission-info")
|
||||
@ApiOperation("获取登录用户的权限信息")
|
||||
public CommonResult<SysAuthPermissionInfoRespVO> getPermissionInfo() {
|
||||
// 获得用户信息
|
||||
SysUserDO user = userCoreService.getUser(getLoginUserId());
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
// 获得角色列表
|
||||
List<SysRoleDO> roleList = roleService.getRolesFromCache(getLoginUserRoleIds());
|
||||
// 获得菜单列表
|
||||
List<SysMenuDO> menuList = permissionService.getRoleMenusFromCache(
|
||||
getLoginUserRoleIds(), // 注意,基于登录的角色,因为后续的权限判断也是基于它
|
||||
SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()),
|
||||
SetUtils.asSet(CommonStatusEnum.ENABLE.getStatus()));
|
||||
// 拼接结果返回
|
||||
return success(SysAuthConvert.INSTANCE.convert(user, roleList, menuList));
|
||||
}
|
||||
|
||||
@GetMapping("list-menus")
|
||||
@ApiOperation("获得登录用户的菜单列表")
|
||||
public CommonResult<List<SysAuthMenuRespVO>> getMenus() {
|
||||
// 获得用户拥有的菜单列表
|
||||
List<SysMenuDO> menuList = permissionService.getRoleMenusFromCache(
|
||||
getLoginUserRoleIds(), // 注意,基于登录的角色,因为后续的权限判断也是基于它
|
||||
SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType()), // 只要目录和菜单类型
|
||||
SetUtils.asSet(CommonStatusEnum.ENABLE.getStatus())); // 只要开启的
|
||||
// 转换成 Tree 结构返回
|
||||
return success(SysAuthConvert.INSTANCE.buildMenuTree(menuList));
|
||||
}
|
||||
|
||||
// ========== 社交登录相关 ==========
|
||||
|
||||
@GetMapping("/social-auth-redirect")
|
||||
@ApiOperation("社交授权的跳转")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "type", value = "社交类型", required = true, dataTypeClass = Integer.class),
|
||||
@ApiImplicitParam(name = "redirectUri", value = "回调路径", dataTypeClass = String.class)
|
||||
})
|
||||
public CommonResult<String> socialAuthRedirect(@RequestParam("type") Integer type,
|
||||
@RequestParam("redirectUri") String redirectUri) {
|
||||
return CommonResult.success(socialCoreService.getAuthorizeUrl(type, redirectUri));
|
||||
}
|
||||
|
||||
@PostMapping("/social-login")
|
||||
@ApiOperation("社交登录,使用 code 授权码")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<SysAuthLoginRespVO> socialLogin(@RequestBody @Valid SysAuthSocialLoginReqVO reqVO) {
|
||||
String token = authService.socialLogin(reqVO, getClientIP(), getUserAgent());
|
||||
// 返回结果
|
||||
return success(SysAuthLoginRespVO.builder().token(token).build());
|
||||
}
|
||||
|
||||
@PostMapping("/social-login2")
|
||||
@ApiOperation("社交登录,使用 code 授权码 + 账号密码")
|
||||
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志
|
||||
public CommonResult<SysAuthLoginRespVO> socialLogin2(@RequestBody @Valid SysAuthSocialLogin2ReqVO reqVO) {
|
||||
String token = authService.socialLogin2(reqVO, getClientIP(), getUserAgent());
|
||||
// 返回结果
|
||||
return success(SysAuthLoginRespVO.builder().token(token).build());
|
||||
}
|
||||
|
||||
@PostMapping("/social-bind")
|
||||
@ApiOperation("社交绑定,使用 code 授权码")
|
||||
public CommonResult<Boolean> socialBind(@RequestBody @Valid SysAuthSocialBindReqVO reqVO) {
|
||||
authService.socialBind(getLoginUserId(), reqVO);
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/social-unbind")
|
||||
@ApiOperation("取消社交绑定")
|
||||
public CommonResult<Boolean> socialUnbind(@RequestBody SysAuthSocialUnbindReqVO reqVO) {
|
||||
socialCoreService.unbindSocialUser(getLoginUserId(), reqVO.getType(), reqVO.getUnionId(), UserTypeEnum.ADMIN);
|
||||
return CommonResult.success(true);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.auth.vo.session.SysUserSessionPageItemRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.auth.vo.session.SysUserSessionPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.convert.auth.SysUserSessionConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO;
|
||||
import cn.iocoder.yudao.module.system.service.auth.SysUserSessionService;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
|
||||
@Api(tags = "用户 Session")
|
||||
@RestController
|
||||
@RequestMapping("/system/user-session")
|
||||
public class SysUserSessionController {
|
||||
|
||||
@Resource
|
||||
private SysUserSessionService userSessionService;
|
||||
@Resource
|
||||
private SysUserSessionCoreService userSessionCoreService;
|
||||
@Resource
|
||||
private SysUserCoreService userCoreService;
|
||||
|
||||
@Resource
|
||||
private SysDeptCoreService deptCoreService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得 Session 分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:user-session:page')")
|
||||
public CommonResult<PageResult<SysUserSessionPageItemRespVO>> getUserSessionPage(@Validated SysUserSessionPageReqVO reqVO) {
|
||||
// 获得 Session 分页
|
||||
PageResult<SysUserSessionDO> pageResult = userSessionService.getUserSessionPage(reqVO);
|
||||
|
||||
// 获得拼接需要的数据
|
||||
Map<Long, SysUserDO> userMap = userCoreService.getUserMap(
|
||||
convertList(pageResult.getList(), SysUserSessionDO::getUserId));
|
||||
Map<Long, SysDeptDO> deptMap = deptCoreService.getDeptMap(
|
||||
convertList(userMap.values(), SysUserDO::getDeptId));
|
||||
// 拼接结果返回
|
||||
List<SysUserSessionPageItemRespVO> sessionList = new ArrayList<>(pageResult.getList().size());
|
||||
pageResult.getList().forEach(session -> {
|
||||
SysUserSessionPageItemRespVO respVO = SysUserSessionConvert.INSTANCE.convert(session);
|
||||
sessionList.add(respVO);
|
||||
// 设置用户账号
|
||||
MapUtils.findAndThen(userMap, session.getUserId(), user -> {
|
||||
respVO.setUsername(user.getUsername());
|
||||
// 设置用户部门
|
||||
MapUtils.findAndThen(deptMap, user.getDeptId(), dept -> respVO.setDeptName(dept.getName()));
|
||||
});
|
||||
});
|
||||
return success(new PageResult<>(sessionList, pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除 Session")
|
||||
@ApiImplicitParam(name = "id", value = "Session 编号", required = true, dataTypeClass = String.class,
|
||||
example = "fe50b9f6-d177-44b1-8da9-72ea34f63db7")
|
||||
@PreAuthorize("@ss.hasPermission('system:user-session:delete')")
|
||||
public CommonResult<Boolean> deleteUserSession(@RequestParam("id") String id) {
|
||||
userSessionCoreService.deleteUserSession(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.auth;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@ApiModel("账号密码登录 Request VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthLoginReqVO {
|
||||
|
||||
@ApiModelProperty(value = "账号", required = true, example = "yudaoyuanma")
|
||||
@NotEmpty(message = "登录账号不能为空")
|
||||
@Length(min = 4, max = 16, message = "账号长度为 4-16 位")
|
||||
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码", required = true, example = "buzhidao")
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty(value = "验证码", required = true, example = "1024")
|
||||
@NotEmpty(message = "验证码不能为空")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "验证码的唯一标识", required = true, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||
@NotEmpty(message = "唯一标识不能为空")
|
||||
private String uuid;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.auth;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@ApiModel("账号密码登录 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthLoginRespVO {
|
||||
|
||||
@ApiModelProperty(value = "token", required = true, example = "yudaoyuanma")
|
||||
private String token;
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.auth;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("登录用户的菜单信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthMenuRespVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单名称", required = true, example = "芋道")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "父菜单 ID", required = true, example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty(value = "菜单名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "路由地址", example = "post", notes = "仅菜单类型为菜单或者目录时,才需要传")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "组件路径", example = "system/post/index", notes = "仅菜单类型为菜单时,才需要传")
|
||||
private String component;
|
||||
|
||||
@ApiModelProperty(value = "菜单图标", example = "/menu/list", notes = "仅菜单类型为菜单或者目录时,才需要传")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 子路由
|
||||
*/
|
||||
private List<SysAuthMenuRespVO> children;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.auth;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel(value = "登录用户的权限信息 Response VO", description = "额外包括用户信息和角色列表")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthPermissionInfoRespVO {
|
||||
|
||||
@ApiModelProperty(value = "用户信息", required = true)
|
||||
private UserVO user;
|
||||
|
||||
@ApiModelProperty(value = "角色标识数组", required = true)
|
||||
private Set<String> roles;
|
||||
|
||||
@ApiModelProperty(value = "操作权限数组", required = true)
|
||||
private Set<String> permissions;
|
||||
|
||||
@ApiModel("用户信息 VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class UserVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称", required = true, example = "芋道源码")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "用户头像", required = true, example = "http://www.iocoder.cn/xx.jpg")
|
||||
private String avatar;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.auth;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("社交绑定 Request VO,使用 code 授权码")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthSocialBindReqVO {
|
||||
|
||||
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
|
||||
@InEnum(SysSocialTypeEnum.class)
|
||||
@NotNull(message = "社交平台的类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "授权码", required = true, example = "1024")
|
||||
@NotEmpty(message = "授权码不能为空")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "state", required = true, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||
@NotEmpty(message = "state 不能为空")
|
||||
private String state;
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.auth;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@ApiModel("社交登录 Request VO,使用 code 授权码 + 账号密码")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthSocialLogin2ReqVO {
|
||||
|
||||
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
|
||||
@InEnum(SysSocialTypeEnum.class)
|
||||
@NotNull(message = "社交平台的类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "授权码", required = true, example = "1024")
|
||||
@NotEmpty(message = "授权码不能为空")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "state", required = true, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||
@NotEmpty(message = "state 不能为空")
|
||||
private String state;
|
||||
|
||||
@ApiModelProperty(value = "账号", required = true, example = "yudaoyuanma")
|
||||
@NotEmpty(message = "登录账号不能为空")
|
||||
@Length(min = 4, max = 16, message = "账号长度为 4-16 位")
|
||||
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "密码", required = true, example = "buzhidao")
|
||||
@NotEmpty(message = "密码不能为空")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String password;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.auth;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("社交登录 Request VO,使用 code 授权码")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthSocialLoginReqVO {
|
||||
|
||||
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
|
||||
@InEnum(SysSocialTypeEnum.class)
|
||||
@NotNull(message = "社交平台的类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "授权码", required = true, example = "1024")
|
||||
@NotEmpty(message = "授权码不能为空")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "state", required = true, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||
@NotEmpty(message = "state 不能为空")
|
||||
private String state;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.auth;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("取消社交绑定 Request VO,使用 code 授权码")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class SysAuthSocialUnbindReqVO {
|
||||
|
||||
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
|
||||
@InEnum(SysSocialTypeEnum.class)
|
||||
@NotNull(message = "社交平台的类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "社交的全局编号", required = true, example = "IPRmJ0wvBptiPIlGEZiPewGwiEiE")
|
||||
@NotEmpty(message = "社交的全局编号不能为空")
|
||||
private String unionId;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.session;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel(value = "用户在线 Session Response VO", description = "相比用户基本信息来说,会多部门、用户账号等信息")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysUserSessionPageItemRespVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "Session 编号", required = true, example = "fe50b9f6-d177-44b1-8da9-72ea34f63db7")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "用户 IP", required = true, example = "127.0.0.1")
|
||||
private String userIp;
|
||||
|
||||
@ApiModelProperty(value = "浏览器 UserAgent", required = true, example = "Mozilla/5.0")
|
||||
private String userAgent;
|
||||
|
||||
@ApiModelProperty(value = "登录时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "用户账号", required = true, example = "yudao")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "部门名称", example = "研发部")
|
||||
private String deptName;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.system.controller.auth.vo.session;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("在线用户 Session 分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysUserSessionPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模糊匹配")
|
||||
private String userIp;
|
||||
|
||||
@ApiModelProperty(value = "用户账号", example = "yudao", notes = "模糊匹配")
|
||||
private String username;
|
||||
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
### 请求 /captcha/get-image 接口 => 成功
|
||||
GET {{baseUrl}}/system/captcha/get-image
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.controller.common;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.controller.common.vo.SysCaptchaImageRespVO;
|
||||
import cn.iocoder.yudao.module.system.service.common.SysCaptchaService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "验证码")
|
||||
@RestController
|
||||
@RequestMapping("/system/captcha")
|
||||
public class SysCaptchaController {
|
||||
|
||||
@Resource
|
||||
private SysCaptchaService captchaService;
|
||||
|
||||
@GetMapping("/get-image")
|
||||
@ApiOperation("生成图片验证码")
|
||||
public CommonResult<SysCaptchaImageRespVO> getCaptchaImage() {
|
||||
return success(captchaService.getCaptchaImage());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.controller.common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@ApiModel("验证码图片 Response VO")
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysCaptchaImageRespVO {
|
||||
|
||||
@ApiModelProperty(value = "uuid", required = true, example = "1b3b7d00-83a8-4638-9e37-d67011855968", notes = "通过该 uuid 作为该验证码的标识")
|
||||
private String uuid;
|
||||
|
||||
@ApiModelProperty(value = "图片", required = true, notes = "验证码的图片内容,使用 Base64 编码")
|
||||
private String img;
|
||||
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.controller.dept.vo.dept.*;
|
||||
import cn.iocoder.yudao.module.system.convert.dept.SysDeptConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO;
|
||||
import cn.iocoder.yudao.module.system.service.dept.SysDeptService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "部门")
|
||||
@RestController
|
||||
@RequestMapping("/system/dept")
|
||||
@Validated
|
||||
public class SysDeptController {
|
||||
|
||||
@Resource
|
||||
private SysDeptService deptService;
|
||||
|
||||
@Resource
|
||||
private SysDeptCoreService deptCoreService;
|
||||
|
||||
@PostMapping("create")
|
||||
@ApiOperation("创建部门")
|
||||
@PreAuthorize("@ss.hasPermission('system:dept:create')")
|
||||
public CommonResult<Long> createDept(@Valid @RequestBody SysDeptCreateReqVO reqVO) {
|
||||
Long deptId = deptService.createDept(reqVO);
|
||||
return success(deptId);
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
@ApiOperation("更新部门")
|
||||
@PreAuthorize("@ss.hasPermission('system:dept:update')")
|
||||
public CommonResult<Boolean> updateDept(@Valid @RequestBody SysDeptUpdateReqVO reqVO) {
|
||||
deptService.updateDept(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("delete")
|
||||
@ApiOperation("删除部门")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:dept:delete')")
|
||||
public CommonResult<Boolean> deleteDept(@RequestParam("id") Long id) {
|
||||
deptService.deleteDept(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取部门列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
||||
public CommonResult<List<SysDeptRespVO>> listDepts(SysDeptListReqVO reqVO) {
|
||||
List<SysDeptDO> list = deptService.getSimpleDepts(reqVO);
|
||||
list.sort(Comparator.comparing(SysDeptDO::getSort));
|
||||
return success(SysDeptConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取部门精简信息列表", notes = "只包含被开启的部门,主要用于前端的下拉选项")
|
||||
public CommonResult<List<SysDeptSimpleRespVO>> getSimpleDepts() {
|
||||
// 获得部门列表,只要开启状态的
|
||||
SysDeptListReqVO reqVO = new SysDeptListReqVO();
|
||||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
List<SysDeptDO> list = deptService.getSimpleDepts(reqVO);
|
||||
// 排序后,返回给前端
|
||||
list.sort(Comparator.comparing(SysDeptDO::getSort));
|
||||
return success(SysDeptConvert.INSTANCE.convertList02(list));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得部门信息")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:dept:query')")
|
||||
public CommonResult<SysDeptRespVO> getDept(@RequestParam("id") Long id) {
|
||||
return success(SysDeptConvert.INSTANCE.convert(deptCoreService.getDept(id)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.dept.vo.post.*;
|
||||
import cn.iocoder.yudao.module.system.convert.dept.SysPostConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO;
|
||||
import cn.iocoder.yudao.module.system.service.dept.SysPostService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "岗位")
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
@Valid
|
||||
public class SysPostController {
|
||||
|
||||
@Resource
|
||||
private SysPostService postService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建岗位")
|
||||
@PreAuthorize("@ss.hasPermission('system:post:create')")
|
||||
public CommonResult<Long> createPost(@Valid @RequestBody SysPostCreateReqVO reqVO) {
|
||||
Long postId = postService.createPost(reqVO);
|
||||
return success(postId);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改岗位")
|
||||
@PreAuthorize("@ss.hasPermission('system:post:update')")
|
||||
public CommonResult<Boolean> updatePost(@Valid @RequestBody SysPostUpdateReqVO reqVO) {
|
||||
postService.updatePost(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除岗位")
|
||||
@PreAuthorize("@ss.hasPermission('system:post:delete')")
|
||||
public CommonResult<Boolean> deletePost(@RequestParam("id") Long id) {
|
||||
postService.deletePost(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get")
|
||||
@ApiOperation("获得岗位信息")
|
||||
@ApiImplicitParam(name = "id", value = "岗位编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:post:query')")
|
||||
public CommonResult<SysPostRespVO> getPost(@RequestParam("id") Long id) {
|
||||
return success(SysPostConvert.INSTANCE.convert(postService.getPost(id)));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取岗位精简信息列表", notes = "只包含被开启的岗位,主要用于前端的下拉选项")
|
||||
public CommonResult<List<SysPostSimpleRespVO>> getSimplePosts() {
|
||||
// 获得岗位列表,只要开启状态的
|
||||
List<SysPostDO> list = postService.getPosts(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
// 排序后,返回给前端
|
||||
list.sort(Comparator.comparing(SysPostDO::getSort));
|
||||
return success(SysPostConvert.INSTANCE.convertList02(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得岗位分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:post:query')")
|
||||
public CommonResult<PageResult<SysPostRespVO>> getPostPage(@Validated SysPostPageReqVO reqVO) {
|
||||
return success(SysPostConvert.INSTANCE.convertPage(postService.getPostPage(reqVO)));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("岗位管理")
|
||||
@PreAuthorize("@ss.hasPermission('system:post:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Validated SysPostExportReqVO reqVO) throws IOException {
|
||||
List<SysPostDO> posts = postService.getPosts(reqVO);
|
||||
List<SysPostExcelVO> data = SysPostConvert.INSTANCE.convertList03(posts);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "岗位数据.xls", "岗位列表", SysPostExcelVO.class, data);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.dept;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 部门 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysDeptBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单名称", required = true, example = "芋道")
|
||||
@NotBlank(message = "部门名称不能为空")
|
||||
@Size(max = 30, message = "部门名称长度不能超过30个字符")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "父菜单 ID", required = true, example = "1024")
|
||||
@NotNull(message = "父菜单 ID 不能为空")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty(value = "显示顺序不能为空", required = true, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "负责人的用户编号", example = "2048")
|
||||
private Long leaderUserId;
|
||||
|
||||
@ApiModelProperty(value = "联系电话", example = "15601691000")
|
||||
@Size(max = 11, message = "联系电话长度不能超过11个字符")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "邮箱", example = "yudao@iocoder.cn")
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Size(max = 50, message = "邮箱长度不能超过50个字符")
|
||||
private String email;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 SysCommonStatusEnum 枚举")
|
||||
@NotNull(message = "状态不能为空")
|
||||
// @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.dept;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("部门创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SysDeptCreateReqVO extends SysDeptBaseVO {
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.dept;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("部门列表 Request VO")
|
||||
@Data
|
||||
public class SysDeptListReqVO {
|
||||
|
||||
@ApiModelProperty(value = "部门名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.dept;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("部门信息 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDeptRespVO extends SysDeptBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.dept;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@ApiModel("部门精简信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysDeptSimpleRespVO {
|
||||
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "部门名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "父部门 ID", required = true, example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.dept;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("部门更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDeptUpdateReqVO extends SysDeptBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "部门编号", required = true, example = "1024")
|
||||
@NotNull(message = "部门编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 岗位 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysPostBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位名称", required = true, example = "小博主")
|
||||
@NotBlank(message = "岗位名称不能为空")
|
||||
@Size(max = 50, message = "岗位名称长度不能超过50个字符")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "岗位编码", required = true, example = "yudao")
|
||||
@NotBlank(message = "岗位编码不能为空")
|
||||
@Size(max = 64, message = "岗位编码长度不能超过64个字符")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "显示顺序不能为空", required = true, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注", example = "快乐的备注")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("岗位创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysPostCreateReqVO extends SysPostBaseVO {
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 岗位 Excel 导出响应 VO
|
||||
*/
|
||||
@Data
|
||||
public class SysPostExcelVO {
|
||||
|
||||
@ExcelProperty("岗位序号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("岗位编码")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("岗位名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("岗位排序")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat(SysDictTypeConstants.COMMON_STATUS)
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel(value = "岗位导出 Request VO", description = "参数和 SysPostExcelVO 是一致的")
|
||||
@Data
|
||||
public class SysPostExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("岗位列表 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysPostListReqVO extends SysPostBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("岗位分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysPostPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("岗位信息 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysPostRespVO extends SysPostBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位序号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@ApiModel("岗位精简信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysPostSimpleRespVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "岗位名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dept.vo.post;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("岗位更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysPostUpdateReqVO extends SysPostBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位编号", required = true, example = "1024")
|
||||
@NotNull(message = "岗位编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
### 请求 /menu/list 接口 => 成功
|
||||
GET {{baseUrl}}/system/dict-data/list-all-simple
|
||||
Authorization: Bearer {{token}}
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.dict.vo.data.*;
|
||||
import cn.iocoder.yudao.module.system.convert.dict.SysDictDataConvert;
|
||||
import cn.iocoder.yudao.module.system.service.dict.SysDictDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "字典数据")
|
||||
@RestController
|
||||
@RequestMapping("/system/dict-data")
|
||||
@Validated
|
||||
public class SysDictDataController {
|
||||
|
||||
@Resource
|
||||
private SysDictDataService dictDataService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("新增字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:create')")
|
||||
public CommonResult<Long> createDictData(@Valid @RequestBody SysDictDataCreateReqVO reqVO) {
|
||||
Long dictDataId = dictDataService.createDictData(reqVO);
|
||||
return success(dictDataId);
|
||||
}
|
||||
|
||||
@PutMapping("update")
|
||||
@ApiOperation("修改字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:update')")
|
||||
public CommonResult<Boolean> updateDictData(@Valid @RequestBody SysDictDataUpdateReqVO reqVO) {
|
||||
dictDataService.updateDictData(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除字典数据")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||
public CommonResult<Boolean> deleteDictData(Long id) {
|
||||
dictDataService.deleteDictData(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得全部字典数据列表", notes = "一般用于管理后台缓存字典数据在本地")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
public CommonResult<List<SysDictDataSimpleRespVO>> getSimpleDictDatas() {
|
||||
List<SysDictDataDO> list = dictDataService.getDictDatas();
|
||||
return success(SysDictDataConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("/获得字典类型的分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
public CommonResult<PageResult<SysDictDataRespVO>> getDictTypePage(@Valid SysDictDataPageReqVO reqVO) {
|
||||
return success(SysDictDataConvert.INSTANCE.convertPage(dictDataService.getDictDataPage(reqVO)));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get")
|
||||
@ApiOperation("/查询字典数据详细")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
public CommonResult<SysDictDataRespVO> getDictData(@RequestParam("id") Long id) {
|
||||
return success(SysDictDataConvert.INSTANCE.convert(dictDataService.getDictData(id)));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出字典数据")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Valid SysDictDataExportReqVO reqVO) throws IOException {
|
||||
List<SysDictDataDO> list = dictDataService.getDictDatas(reqVO);
|
||||
List<SysDictDataExcelVO> data = SysDictDataConvert.INSTANCE.convertList02(list);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "字典数据.xls", "数据列表", SysDictDataExcelVO.class, data);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.dict.vo.type.*;
|
||||
import cn.iocoder.yudao.module.system.convert.dict.SysDictTypeConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictTypeDO;
|
||||
import cn.iocoder.yudao.module.system.service.dict.SysDictTypeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "字典类型")
|
||||
@RestController
|
||||
@RequestMapping("/system/dict-type")
|
||||
@Validated
|
||||
public class SysDictTypeController {
|
||||
|
||||
@Resource
|
||||
private SysDictTypeService dictTypeService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建字典类型")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:create')")
|
||||
public CommonResult<Long> createDictType(@Valid @RequestBody SysDictTypeCreateReqVO reqVO) {
|
||||
Long dictTypeId = dictTypeService.createDictType(reqVO);
|
||||
return success(dictTypeId);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改字典类型")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:update')")
|
||||
public CommonResult<Boolean> updateDictType(@Valid @RequestBody SysDictTypeUpdateReqVO reqVO) {
|
||||
dictTypeService.updateDictType(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除字典类型")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:delete')")
|
||||
public CommonResult<Boolean> deleteDictType(Long id) {
|
||||
dictTypeService.deleteDictType(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ApiOperation("/获得字典类型的分页列表")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
public CommonResult<PageResult<SysDictTypeRespVO>> pageDictTypes(@Valid SysDictTypePageReqVO reqVO) {
|
||||
return success(SysDictTypeConvert.INSTANCE.convertPage(dictTypeService.getDictTypePage(reqVO)));
|
||||
}
|
||||
|
||||
@ApiOperation("/查询字典类型详细")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@GetMapping(value = "/get")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) {
|
||||
return success(SysDictTypeConvert.INSTANCE.convert(dictTypeService.getDictType(id)));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
|
||||
// 无需添加权限认证,因为前端全局都需要
|
||||
public CommonResult<List<SysDictTypeSimpleRespVO>> listSimpleDictTypes() {
|
||||
List<SysDictTypeDO> list = dictTypeService.getDictTypeList();
|
||||
return success(SysDictTypeConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据类型")
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@ss.hasPermission('system:dict:query')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void export(HttpServletResponse response, @Valid SysDictTypeExportReqVO reqVO) throws IOException {
|
||||
List<SysDictTypeDO> list = dictTypeService.getDictTypeList(reqVO);
|
||||
List<SysDictTypeExcelVO> data = SysDictTypeConvert.INSTANCE.convertList02(list);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "字典类型.xls", "类型列表", SysDictTypeExcelVO.class, data);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.data;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 字典数据 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysDictDataBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "显示顺序不能为空", required = true, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "字典标签", required = true, example = "芋道")
|
||||
@NotBlank(message = "字典标签不能为空")
|
||||
@Size(max = 100, message = "字典标签长度不能超过100个字符")
|
||||
private String label;
|
||||
|
||||
@ApiModelProperty(value = "字典值", required = true, example = "iocoder")
|
||||
@NotBlank(message = "字典键值不能为空")
|
||||
@Size(max = 100, message = "字典键值长度不能超过100个字符")
|
||||
private String value;
|
||||
|
||||
@ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex")
|
||||
@NotBlank(message = "字典类型不能为空")
|
||||
@Size(max = 100, message = "字典类型长度不能超过100个字符")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 SysCommonStatusEnum 枚举")
|
||||
@NotNull(message = "状态不能为空")
|
||||
// @InEnum(value = SysCommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注", example = "我是一个角色")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.data;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("字典数据创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictDataCreateReqVO extends SysDictDataBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.data;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典数据 Excel 导出响应 VO
|
||||
*/
|
||||
@Data
|
||||
public class SysDictDataExcelVO {
|
||||
|
||||
@ExcelProperty("字典编码")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("字典排序")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty("字典标签")
|
||||
private String label;
|
||||
|
||||
@ExcelProperty("字典键值")
|
||||
private String value;
|
||||
|
||||
@ExcelProperty("字典类型")
|
||||
private String dictType;
|
||||
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat(SysDictTypeConstants.COMMON_STATUS)
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.data;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@ApiModel("字典类型导出 Request VO")
|
||||
@Data
|
||||
public class SysDictDataExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "字典标签", example = "芋道")
|
||||
@Size(max = 100, message = "字典标签长度不能超过100个字符")
|
||||
private String label;
|
||||
|
||||
@ApiModelProperty(value = "字典类型", example = "sys_common_sex", notes = "模糊匹配")
|
||||
@Size(max = 100, message = "字典类型类型长度不能超过100个字符")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.data;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@ApiModel("字典类型分页列表 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictDataPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "字典标签", example = "芋道")
|
||||
@Size(max = 100, message = "字典标签长度不能超过100个字符")
|
||||
private String label;
|
||||
|
||||
@ApiModelProperty(value = "字典类型", example = "sys_common_sex", notes = "模糊匹配")
|
||||
@Size(max = 100, message = "字典类型类型长度不能超过100个字符")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.data;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("字典数据信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictDataRespVO extends SysDictDataBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "字典数据编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.data;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("数据字典精简 Response VO")
|
||||
@Data
|
||||
public class SysDictDataSimpleRespVO {
|
||||
|
||||
@ApiModelProperty(value = "字典类型", required = true, example = "gender")
|
||||
private String dictType;
|
||||
|
||||
@ApiModelProperty(value = "字典键值", required = true, example = "1")
|
||||
private String value;
|
||||
|
||||
@ApiModelProperty(value = "字典标签", required = true, example = "男")
|
||||
private String label;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.data;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("字典数据更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictDataUpdateReqVO extends SysDictDataBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "字典数据编号", required = true, example = "1024")
|
||||
@NotNull(message = "字典数据编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.type;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 字典类型 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysDictTypeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "字典名称", required = true, example = "性别")
|
||||
@NotBlank(message = "字典名称不能为空")
|
||||
@Size(max = 100, message = "字典类型名称长度不能超过100个字符")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 CommonStatusEnum 枚举类")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "备注", example = "快乐的备注")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.type;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
@ApiModel("字典类型创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictTypeCreateReqVO extends SysDictTypeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex")
|
||||
@NotNull(message = "字典类型不能为空")
|
||||
@Size(max = 100, message = "字典类型类型长度不能超过100个字符")
|
||||
private String type;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.type;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典类型 Excel 导出响应 VO
|
||||
*/
|
||||
@Data
|
||||
public class SysDictTypeExcelVO {
|
||||
|
||||
@ExcelProperty("字典主键")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("字典名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("字典类型")
|
||||
private String type;
|
||||
|
||||
@ExcelProperty(value = "状态", converter = DictConvert.class)
|
||||
@DictFormat(SysDictTypeConstants.COMMON_STATUS)
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.type;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("字典类型分页列表 Request VO")
|
||||
@Data
|
||||
public class SysDictTypeExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "字典类型", example = "sys_common_sex", notes = "模糊匹配")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "开始创建时间")
|
||||
private Date beginCreateTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "结束创建时间")
|
||||
private Date endCreateTime;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.type;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("字典类型分页列表 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictTypePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "字典类型", example = "sys_common_sex", notes = "模糊匹配")
|
||||
@Size(max = 100, message = "字典类型类型长度不能超过100个字符")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "开始创建时间")
|
||||
private Date beginCreateTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "结束创建时间")
|
||||
private Date endCreateTime;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.type;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("字典类型信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictTypeRespVO extends SysDictTypeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.type;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@ApiModel("字典类型精简信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysDictTypeSimpleRespVO {
|
||||
|
||||
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "字典类型名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex")
|
||||
private String type;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.controller.dict.vo.type;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("字典类型更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysDictTypeUpdateReqVO extends SysDictTypeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
|
||||
@NotNull(message = "字典类型编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
###
|
||||
POST {{baseUrl}}/inra/error-code/create
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type:application/json
|
||||
|
||||
{
|
||||
"code": 200,
|
||||
"message": "成功",
|
||||
"group": "test",
|
||||
"type": 1
|
||||
}
|
||||
|
@ -0,0 +1,89 @@
|
||||
package cn.iocoder.yudao.module.system.controller.errorcode;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.convert.errorcode.SysErrorCodeConvert;
|
||||
import cn.iocoder.yudao.module.system.controller.errorcode.vo.*;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.SysErrorCodeDO;
|
||||
import cn.iocoder.yudao.module.system.service.errorcode.SysErrorCodeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "错误码")
|
||||
@RestController
|
||||
@RequestMapping("/system/error-code")
|
||||
@Validated
|
||||
public class SysErrorCodeController {
|
||||
|
||||
@Resource
|
||||
private SysErrorCodeService errorCodeService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建错误码")
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:create')")
|
||||
public CommonResult<Long> createErrorCode(@Valid @RequestBody SysErrorCodeCreateReqVO createReqVO) {
|
||||
return success(errorCodeService.createErrorCode(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("更新错误码")
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:update')")
|
||||
public CommonResult<Boolean> updateErrorCode(@Valid @RequestBody SysErrorCodeUpdateReqVO updateReqVO) {
|
||||
errorCodeService.updateErrorCode(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除错误码")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:delete')")
|
||||
public CommonResult<Boolean> deleteErrorCode(@RequestParam("id") Long id) {
|
||||
errorCodeService.deleteErrorCode(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得错误码")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:query')")
|
||||
public CommonResult<SysErrorCodeRespVO> getErrorCode(@RequestParam("id") Long id) {
|
||||
SysErrorCodeDO errorCode = errorCodeService.getErrorCode(id);
|
||||
return success(SysErrorCodeConvert.INSTANCE.convert(errorCode));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得错误码分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:query')")
|
||||
public CommonResult<PageResult<SysErrorCodeRespVO>> getErrorCodePage(@Valid SysErrorCodePageReqVO pageVO) {
|
||||
PageResult<SysErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(pageVO);
|
||||
return success(SysErrorCodeConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@ApiOperation("导出错误码 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('system:error-code:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportErrorCodeExcel(@Valid SysErrorCodeExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<SysErrorCodeDO> list = errorCodeService.getErrorCodeList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<SysErrorCodeExcelVO> datas = SysErrorCodeConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "错误码.xls", "数据", SysErrorCodeExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 错误码 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysErrorCodeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "应用名", required = true, example = "dashboard")
|
||||
@NotNull(message = "应用名不能为空")
|
||||
private String applicationName;
|
||||
|
||||
@ApiModelProperty(value = "错误码编码", required = true, example = "1234")
|
||||
@NotNull(message = "错误码编码不能为空")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty(value = "错误码错误提示", required = true, example = "帅气")
|
||||
@NotNull(message = "错误码错误提示不能为空")
|
||||
private String message;
|
||||
|
||||
@ApiModelProperty(value = "备注", example = "哈哈哈")
|
||||
private String memo;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("错误码创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SysErrorCodeCreateReqVO extends SysErrorCodeBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.system.controller.errorcode.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
//import cn.iocoder.yudao.adminserver.modules.infra.enums.InfDictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 错误码 Excel VO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class SysErrorCodeExcelVO {
|
||||
|
||||
@ExcelProperty("错误码编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty(value = "错误码类型", converter = DictConvert.class)
|
||||
@DictFormat("inf_error_code_type") // TODO 芋艿:得思考下杂解决枚举值
|
||||
private Integer type;
|
||||
|
||||
@ExcelProperty("应用名")
|
||||
private String applicationName;
|
||||
|
||||
@ExcelProperty("错误码编码")
|
||||
private Integer code;
|
||||
|
||||
@ExcelProperty("错误码错误提示")
|
||||
private String message;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String memo;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel(value = "错误码 Excel 导出 Request VO", description = "参数和 InfErrorCodePageReqVO 是一致的")
|
||||
@Data
|
||||
public class SysErrorCodeExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "错误码类型", example = "1")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "应用名", example = "dashboard")
|
||||
private String applicationName;
|
||||
|
||||
@ApiModelProperty(value = "错误码编码", example = "1234")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty(value = "错误码错误提示", example = "帅气")
|
||||
private String message;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "开始创建时间")
|
||||
private Date beginCreateTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "结束创建时间")
|
||||
private Date endCreateTime;
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.system.controller.errorcode.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("错误码分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SysErrorCodePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "错误码类型", example = "1", notes = "参见 SysErrorCodeTypeEnum 枚举类")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "应用名", example = "dashboard")
|
||||
private String applicationName;
|
||||
|
||||
@ApiModelProperty(value = "错误码编码", example = "1234")
|
||||
private Integer code;
|
||||
|
||||
@ApiModelProperty(value = "错误码错误提示", example = "帅气")
|
||||
private String message;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "开始创建时间")
|
||||
private Date beginCreateTime;
|
||||
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
@ApiModelProperty(value = "结束创建时间")
|
||||
private Date endCreateTime;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("错误码 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SysErrorCodeRespVO extends SysErrorCodeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "错误码编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "错误码类型", required = true, example = "1", notes = "参见 SysErrorCodeTypeEnum 枚举类")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.errorcode.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("错误码更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SysErrorCodeUpdateReqVO extends SysErrorCodeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "错误码编号", required = true, example = "1024")
|
||||
@NotNull(message = "错误码编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger;
|
||||
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.logger.vo.loginlog.SysLoginLogExcelVO;
|
||||
import cn.iocoder.yudao.module.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.logger.vo.loginlog.SysLoginLogRespVO;
|
||||
import cn.iocoder.yudao.module.system.convert.logger.SysLoginLogConvert;
|
||||
import cn.iocoder.yudao.module.system.service.logger.SysLoginLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "登录日志")
|
||||
@RestController
|
||||
@RequestMapping("/system/login-log")
|
||||
@Validated
|
||||
public class SysLoginLogController {
|
||||
|
||||
@Resource
|
||||
private SysLoginLogService loginLogService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得登录日志分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:login-log:query')")
|
||||
public CommonResult<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Valid SysLoginLogPageReqVO reqVO) {
|
||||
PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO);
|
||||
return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@ApiOperation("导出登录日志 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('system:login-log:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportLoginLog(HttpServletResponse response, @Valid SysLoginLogExportReqVO reqVO) throws IOException {
|
||||
List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO);
|
||||
// 拼接数据
|
||||
List<SysLoginLogExcelVO> data = SysLoginLogConvert.INSTANCE.convertList(list);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "登录日志.xls", "数据列表", SysLoginLogExcelVO.class, data);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
### 请求 /system/operate-log/demo 接口 => 成功
|
||||
GET {{baseUrl}}/system/operate-log/demo
|
||||
Authorization: Bearer {{token}}
|
@ -0,0 +1,85 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.logger.vo.operatelog.SysOperateLogExcelVO;
|
||||
import cn.iocoder.yudao.module.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.logger.vo.operatelog.SysOperateLogRespVO;
|
||||
import cn.iocoder.yudao.module.system.convert.logger.SysOperateLogConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysOperateLogDO;
|
||||
import cn.iocoder.yudao.module.system.service.logger.SysOperateLogService;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "操作日志")
|
||||
@RestController
|
||||
@RequestMapping("/system/operate-log")
|
||||
@Validated
|
||||
public class SysOperateLogController {
|
||||
|
||||
@Resource
|
||||
private SysOperateLogService operateLogService;
|
||||
@Resource
|
||||
private SysUserCoreService userCoreService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("查看操作日志分页列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:operate-log:query')")
|
||||
public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Valid SysOperateLogPageReqVO reqVO) {
|
||||
PageResult<SysOperateLogDO> pageResult = operateLogService.getOperateLogPage(reqVO);
|
||||
|
||||
// 获得拼接需要的数据
|
||||
Collection<Long> userIds = CollectionUtils.convertList(pageResult.getList(), SysOperateLogDO::getUserId);
|
||||
Map<Long, SysUserDO> userMap = userCoreService.getUserMap(userIds);
|
||||
// 拼接数据
|
||||
List<SysOperateLogRespVO> list = new ArrayList<>(pageResult.getList().size());
|
||||
pageResult.getList().forEach(operateLog -> {
|
||||
SysOperateLogRespVO respVO = SysOperateLogConvert.INSTANCE.convert(operateLog);
|
||||
list.add(respVO);
|
||||
// 拼接用户信息
|
||||
MapUtils.findAndThen(userMap, operateLog.getUserId(), user -> respVO.setUserNickname(user.getNickname()));
|
||||
});
|
||||
return success(new PageResult<>(list, pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@ApiOperation("导出操作日志")
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@ss.hasPermission('system:operate-log:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportOperateLog(HttpServletResponse response, @Valid SysOperateLogExportReqVO reqVO) throws IOException {
|
||||
List<SysOperateLogDO> list = operateLogService.getOperateLogs(reqVO);
|
||||
|
||||
// 获得拼接需要的数据
|
||||
Collection<Long> userIds = CollectionUtils.convertList(list, SysOperateLogDO::getUserId);
|
||||
Map<Long, SysUserDO> userMap = userCoreService.getUserMap(userIds);
|
||||
// 拼接数据
|
||||
List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "操作日志.xls", "数据列表", SysOperateLogExcelVO.class, excelDataList);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 登录日志 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysLoginLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "日志类型", required = true, example = "1", notes = "参见 SysLoginLogTypeEnum 枚举类")
|
||||
@NotNull(message = "日志类型不能为空")
|
||||
private Integer logType;
|
||||
|
||||
@ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
|
||||
@NotEmpty(message = "链路追踪编号不能为空")
|
||||
private String traceId;
|
||||
|
||||
@ApiModelProperty(value = "用户账号", required = true, example = "yudao")
|
||||
@NotBlank(message = "用户账号不能为空")
|
||||
@Size(max = 30, message = "用户账号长度不能超过30个字符")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "登录结果", required = true, example = "1", notes = "参见 SysLoginResultEnum 枚举类")
|
||||
@NotNull(message = "登录结果不能为空")
|
||||
private Integer result;
|
||||
|
||||
@ApiModelProperty(value = "用户 IP", required = true, example = "127.0.0.1")
|
||||
@NotEmpty(message = "用户 IP 不能为空")
|
||||
private String userIp;
|
||||
|
||||
@ApiModelProperty(value = "浏览器 UserAgent", required = true, example = "Mozilla/5.0")
|
||||
@NotEmpty(message = "浏览器 UserAgent 不能为空")
|
||||
private String userAgent;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 登录日志 Excel 导出响应 VO
|
||||
*/
|
||||
@Data
|
||||
public class SysLoginLogExcelVO {
|
||||
|
||||
@ExcelProperty("日志主键")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("用户账号")
|
||||
private String username;
|
||||
|
||||
@ExcelProperty(value = "日志类型", converter = DictConvert.class)
|
||||
@DictFormat(SysDictTypeConstants.LOGIN_TYPE)
|
||||
private Integer logType;
|
||||
|
||||
@ExcelProperty(value = "登录结果", converter = DictConvert.class)
|
||||
@DictFormat(SysDictTypeConstants.LOGIN_RESULT)
|
||||
private Integer result;
|
||||
|
||||
@ExcelProperty("登录 IP")
|
||||
private String userIp;
|
||||
|
||||
@ExcelProperty("浏览器 UA")
|
||||
private String userAgent;
|
||||
|
||||
@ExcelProperty("登录时间")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("登录日志分页列表 Request VO")
|
||||
@Data
|
||||
public class SysLoginLogExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模拟匹配")
|
||||
private String userIp;
|
||||
|
||||
@ApiModelProperty(value = "用户账号", example = "芋道", notes = "模拟匹配")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "操作状态", example = "true")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("登录日志分页列表 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysLoginLogPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模拟匹配")
|
||||
private String userIp;
|
||||
|
||||
@ApiModelProperty(value = "用户账号", example = "芋道", notes = "模拟匹配")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "操作状态", example = "true")
|
||||
private Boolean status;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("登录日志 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SysLoginLogRespVO extends SysLoginLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "日志编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "666")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "用户类型", required = true, example = "2", notes = "参见 UserTypeEnum 枚举")
|
||||
@NotNull(message = "用户类型不能为空")
|
||||
private Integer userType;
|
||||
|
||||
@ApiModelProperty(value = "登录时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 操作日志 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysOperateLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
|
||||
@NotEmpty(message = "链路追踪编号不能为空")
|
||||
private String traceId;
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1024")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "操作模块", required = true, example = "订单")
|
||||
@NotEmpty(message = "操作模块不能为空")
|
||||
private String module;
|
||||
|
||||
@ApiModelProperty(value = "操作名", required = true, example = "创建订单")
|
||||
@NotEmpty(message = "操作名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "操作分类", required = true, example = "1", notes = "参见 SysOperateLogTypeEnum 枚举类")
|
||||
@NotNull(message = "操作分类不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "操作明细", example = "修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "拓展字段", example = "{'orderId': 1}")
|
||||
private Map<String, Object> exts;
|
||||
|
||||
@ApiModelProperty(value = "请求方法名", required = true, example = "GET")
|
||||
@NotEmpty(message = "请求方法名不能为空")
|
||||
private String requestMethod;
|
||||
|
||||
@ApiModelProperty(value = "请求地址", required = true, example = "/xxx/yyy")
|
||||
@NotEmpty(message = "请求地址不能为空")
|
||||
private String requestUrl;
|
||||
|
||||
@ApiModelProperty(value = "用户 IP", required = true, example = "127.0.0.1")
|
||||
@NotEmpty(message = "用户 IP 不能为空")
|
||||
private String userIp;
|
||||
|
||||
@ApiModelProperty(value = "浏览器 UserAgent", required = true, example = "Mozilla/5.0")
|
||||
@NotEmpty(message = "浏览器 UserAgent 不能为空")
|
||||
private String userAgent;
|
||||
|
||||
@ApiModelProperty(value = "Java 方法名", required = true, example = "cn.iocoder.yudao.adminserver.UserController.save(...)")
|
||||
@NotEmpty(message = "Java 方法名不能为空")
|
||||
private String javaMethod;
|
||||
|
||||
@ApiModelProperty(value = "Java 方法的参数")
|
||||
private String javaMethodArgs;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", required = true)
|
||||
@NotNull(message = "开始时间不能为空")
|
||||
private Date startTime;
|
||||
|
||||
@ApiModelProperty(value = "执行时长,单位:毫秒", required = true)
|
||||
@NotNull(message = "执行时长不能为空")
|
||||
private Integer duration;
|
||||
|
||||
@ApiModelProperty(value = "结果码", required = true)
|
||||
@NotNull(message = "结果码不能为空")
|
||||
private Integer resultCode;
|
||||
|
||||
@ApiModelProperty(value = "结果提示")
|
||||
private String resultMsg;
|
||||
|
||||
@ApiModelProperty(value = "结果数据")
|
||||
private String resultData;
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 操作日志 Excel 导出响应 VO
|
||||
*/
|
||||
@Data
|
||||
public class SysOperateLogExcelVO {
|
||||
|
||||
@ExcelProperty("日志编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("操作模块")
|
||||
private String module;
|
||||
|
||||
@ExcelProperty("操作名")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty(value = "操作类型", converter = DictConvert.class)
|
||||
@DictFormat(SysDictTypeConstants.OPERATE_TYPE)
|
||||
private String type;
|
||||
|
||||
@ExcelProperty("操作人")
|
||||
private String userNickname;
|
||||
|
||||
@ExcelProperty(value = "操作结果") // 成功 or 失败
|
||||
private String successStr;
|
||||
|
||||
@ExcelProperty("操作日志")
|
||||
private Date startTime;
|
||||
|
||||
@ExcelProperty("执行时长")
|
||||
private Integer duration;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("操作日志分页列表 Request VO")
|
||||
@Data
|
||||
public class SysOperateLogExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配")
|
||||
private String module;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称", example = "芋道", notes = "模拟匹配")
|
||||
private String userNickname;
|
||||
|
||||
@ApiModelProperty(value = "操作分类", example = "1", notes = "参见 SysOperateLogTypeEnum 枚举类")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "操作状态", example = "true")
|
||||
private Boolean success;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("操作日志分页列表 Request VO")
|
||||
@Data
|
||||
public class SysOperateLogPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配")
|
||||
private String module;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称", example = "芋道", notes = "模拟匹配")
|
||||
private String userNickname;
|
||||
|
||||
@ApiModelProperty(value = "操作分类", example = "1", notes = "参见 SysOperateLogTypeEnum 枚举类")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "操作状态", example = "true")
|
||||
private Boolean success;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@ApiModel("操作日志 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SysOperateLogRespVO extends SysOperateLogBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "日志编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称", required = true, example = "芋艿")
|
||||
private String userNickname;
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package cn.iocoder.yudao.module.system.controller.notice;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.system.controller.notice.vo.SysNoticeCreateReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.notice.vo.SysNoticePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.notice.vo.SysNoticeRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.notice.vo.SysNoticeUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.system.convert.notice.SysNoticeConvert;
|
||||
import cn.iocoder.yudao.module.system.service.notice.SysNoticeService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "通知公告")
|
||||
@RestController
|
||||
@RequestMapping("/system/notice")
|
||||
@Validated
|
||||
public class SysNoticeController {
|
||||
|
||||
@Resource
|
||||
private SysNoticeService noticeService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建通知公告")
|
||||
@PreAuthorize("@ss.hasPermission('system:notice:create')")
|
||||
public CommonResult<Long> createNotice(@Valid @RequestBody SysNoticeCreateReqVO reqVO) {
|
||||
Long noticeId = noticeService.createNotice(reqVO);
|
||||
return success(noticeId);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改通知公告")
|
||||
@PreAuthorize("@ss.hasPermission('system:notice:update')")
|
||||
public CommonResult<Boolean> updateNotice(@Valid @RequestBody SysNoticeUpdateReqVO reqVO) {
|
||||
noticeService.updateNotice(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除通知公告")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:notice:delete')")
|
||||
public CommonResult<Boolean> deleteNotice(@RequestParam("id") Long id) {
|
||||
noticeService.deleteNotice(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获取通知公告列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:notice:query')")
|
||||
public CommonResult<PageResult<SysNoticeRespVO>> pageNotices(@Validated SysNoticePageReqVO reqVO) {
|
||||
return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO)));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得通知公告")
|
||||
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:notice:query')")
|
||||
public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) {
|
||||
return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id)));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.system.controller.notice.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 通知公告 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysNoticeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "公告标题", required = true, example = "小博主")
|
||||
@NotBlank(message = "公告标题不能为空")
|
||||
@Size(max = 50, message = "公告标题不能超过50个字符")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "公告标题", required = true, example = "小博主")
|
||||
@NotNull(message = "公告类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "公告内容", required = true, example = "半生编码")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.system.controller.notice.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("通知公告创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysNoticeCreateReqVO extends SysNoticeBaseVO {
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.system.controller.notice.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("通知公告分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysNoticePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "通知公告名称", example = "芋道", notes = "模糊匹配")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.notice.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("通知公告信息 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysNoticeRespVO extends SysNoticeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "通知公告序号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.system.controller.notice.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("岗位公告更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysNoticeUpdateReqVO extends SysNoticeBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "岗位公告编号", required = true, example = "1024")
|
||||
@NotNull(message = "岗位公告编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
### 请求 /menu/list 接口 => 成功
|
||||
GET {{baseUrl}}/system/menu/list
|
||||
Authorization: Bearer {{token}}
|
@ -0,0 +1,86 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.controller.permission.vo.menu.*;
|
||||
import cn.iocoder.yudao.module.system.convert.permission.SysMenuConvert;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysMenuDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.SysMenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Api(tags = "菜单")
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
@Validated
|
||||
public class SysMenuController {
|
||||
|
||||
@Resource
|
||||
private SysMenuService menuService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建菜单")
|
||||
@PreAuthorize("@ss.hasPermission('system:menu:create')")
|
||||
public CommonResult<Long> createMenu(@Valid @RequestBody SysMenuCreateReqVO reqVO) {
|
||||
Long menuId = menuService.createMenu(reqVO);
|
||||
return success(menuId);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改菜单")
|
||||
@PreAuthorize("@ss.hasPermission('system:menu:update')")
|
||||
public CommonResult<Boolean> updateMenu(@Valid @RequestBody SysMenuUpdateReqVO reqVO) {
|
||||
menuService.updateMenu(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除菜单")
|
||||
@ApiImplicitParam(name = "id", value = "角色编号", required= true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:menu:delete')")
|
||||
public CommonResult<Boolean> deleteMenu(@RequestParam("id") Long id) {
|
||||
menuService.deleteMenu(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获取菜单列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:menu:query')")
|
||||
public CommonResult<List<SysMenuRespVO>> getMenus(SysMenuListReqVO reqVO) {
|
||||
List<SysMenuDO> list = menuService.getMenus(reqVO);
|
||||
list.sort(Comparator.comparing(SysMenuDO::getSort));
|
||||
return success(SysMenuConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取菜单精简信息列表", notes = "只包含被开启的菜单,主要用于前端的下拉选项")
|
||||
public CommonResult<List<SysMenuSimpleRespVO>> getSimpleMenus() {
|
||||
// 获得菜单列表,只要开启状态的
|
||||
SysMenuListReqVO reqVO = new SysMenuListReqVO();
|
||||
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||
List<SysMenuDO> list = menuService.getMenus(reqVO);
|
||||
// 排序后,返回个诶前端
|
||||
list.sort(Comparator.comparing(SysMenuDO::getSort));
|
||||
return success(SysMenuConvert.INSTANCE.convertList02(list));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获取菜单信息")
|
||||
@PreAuthorize("@ss.hasPermission('system:menu:query')")
|
||||
public CommonResult<SysMenuRespVO> getMenu(Long id) {
|
||||
SysMenuDO menu = menuService.getMenu(id);
|
||||
return success(SysMenuConvert.INSTANCE.convert(menu));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.system.controller.permission.vo.permission.SysPermissionAssignRoleDataScopeReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.permission.vo.permission.SysPermissionAssignRoleMenuReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.permission.vo.permission.SysPermissionAssignUserRoleReqVO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.SysPermissionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 权限 Controller,提供赋予用户、角色的权限的 API 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Api(tags = "权限")
|
||||
@RestController
|
||||
@RequestMapping("/system/permission")
|
||||
public class SysPermissionController {
|
||||
|
||||
@Resource
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@ApiOperation("获得角色拥有的菜单编号")
|
||||
@ApiImplicitParam(name = "roleId", value = "角色编号", required = true, dataTypeClass = Long.class)
|
||||
@GetMapping("/list-role-resources")
|
||||
// @RequiresPermissions("system:permission:assign-role-menu")
|
||||
public CommonResult<Set<Long>> listRoleMenus(Long roleId) {
|
||||
return success(permissionService.listRoleMenuIds(roleId));
|
||||
}
|
||||
|
||||
@PostMapping("/assign-role-menu")
|
||||
@ApiOperation("赋予角色菜单")
|
||||
// @RequiresPermissions("system:permission:assign-role-resource")
|
||||
public CommonResult<Boolean> assignRoleMenu(@Validated @RequestBody SysPermissionAssignRoleMenuReqVO reqVO) {
|
||||
permissionService.assignRoleMenu(reqVO.getRoleId(), reqVO.getMenuIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/assign-role-data-scope")
|
||||
@ApiOperation("赋予角色数据权限")
|
||||
// @RequiresPermissions("system:permission:assign-role-data-scope")
|
||||
public CommonResult<Boolean> assignRoleDataScope(
|
||||
@Validated @RequestBody SysPermissionAssignRoleDataScopeReqVO reqVO) {
|
||||
permissionService.assignRoleDataScope(reqVO.getRoleId(), reqVO.getDataScope(), reqVO.getDataScopeDeptIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ApiOperation("获得管理员拥有的角色编号列表")
|
||||
@ApiImplicitParam(name = "userId", value = "用户编号", required = true, dataTypeClass = Long.class)
|
||||
@GetMapping("/list-user-roles")
|
||||
// @RequiresPermissions("system:permission:assign-user-role")
|
||||
public CommonResult<Set<Long>> listAdminRoles(@RequestParam("userId") Long userId) {
|
||||
return success(permissionService.getUserRoleIdListByUserId(userId));
|
||||
}
|
||||
|
||||
@ApiOperation("赋予用户角色")
|
||||
@PostMapping("/assign-user-role")
|
||||
// @RequiresPermissions("system:permission:assign-user-role")
|
||||
public CommonResult<Boolean> assignUserRole(@Validated @RequestBody SysPermissionAssignUserRoleReqVO reqVO) {
|
||||
permissionService.assignUserRole(reqVO.getUserId(), reqVO.getRoleIds());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
### /role/create 成功
|
||||
POST {{baseUrl}}/system/role/create
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"name": "测试角色",
|
||||
"code": "test",
|
||||
"sort": 0
|
||||
}
|
||||
|
||||
### /role/update 成功
|
||||
POST {{baseUrl}}/system/role/update
|
||||
Authorization: Bearer {{token}}
|
||||
Content-Type: application/json
|
||||
|
||||
|
||||
{
|
||||
"id": 100,
|
||||
"name": "测试角色",
|
||||
"code": "test",
|
||||
"sort": 10
|
||||
}
|
||||
### /resource/delete 成功
|
||||
POST {{baseUrl}}/system/role/delete
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
roleId=14
|
||||
|
||||
### /role/get 成功
|
||||
GET {{baseUrl}}/system/role/get?id=100
|
||||
Content-Type: application/x-www-form-urlencoded
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
### /role/page 成功
|
||||
GET {{baseUrl}}/system/role/page?pageNo=1&pageSize=10
|
||||
Authorization: Bearer {{token}}
|
||||
|
||||
###
|
||||
|
@ -0,0 +1,106 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.system.controller.permission.vo.role.*;
|
||||
import cn.iocoder.yudao.module.system.convert.permission.SysRoleConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.SysRoleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Api(tags = "角色")
|
||||
@RestController
|
||||
@RequestMapping("/system/role")
|
||||
@Validated
|
||||
public class SysRoleController {
|
||||
|
||||
@Resource
|
||||
private SysRoleService roleService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@ApiOperation("创建角色")
|
||||
@PreAuthorize("@ss.hasPermission('system:role:create')")
|
||||
public CommonResult<Long> createRole(@Valid @RequestBody SysRoleCreateReqVO reqVO) {
|
||||
return success(roleService.createRole(reqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ApiOperation("修改角色")
|
||||
@PreAuthorize("@ss.hasPermission('system:role:update')")
|
||||
public CommonResult<Boolean> updateRole(@Valid @RequestBody SysRoleUpdateReqVO reqVO) {
|
||||
roleService.updateRole(reqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-status")
|
||||
@ApiOperation("修改角色状态")
|
||||
@PreAuthorize("@ss.hasPermission('system:role:update')")
|
||||
public CommonResult<Boolean> updateRoleStatus(@Valid @RequestBody SysRoleUpdateStatusReqVO reqVO) {
|
||||
roleService.updateRoleStatus(reqVO.getId(), reqVO.getStatus());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@ApiOperation("删除角色")
|
||||
@ApiImplicitParam(name = "id", value = "角色编号", required = true, example = "1024", dataTypeClass = Long.class)
|
||||
@PreAuthorize("@ss.hasPermission('system:role:delete')")
|
||||
public CommonResult<Boolean> deleteRole(@RequestParam("id") Long id) {
|
||||
roleService.deleteRole(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得角色信息")
|
||||
@PreAuthorize("@ss.hasPermission('system:role:query')")
|
||||
public CommonResult<SysRoleRespVO> getRole(@RequestParam("id") Long id) {
|
||||
SysRoleDO role = roleService.getRole(id);
|
||||
return success(SysRoleConvert.INSTANCE.convert(role));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得角色分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:role:query')")
|
||||
public CommonResult<PageResult<SysRoleDO>> getRolePage(SysRolePageReqVO reqVO) {
|
||||
return success(roleService.getRolePage(reqVO));
|
||||
}
|
||||
|
||||
@GetMapping("/list-all-simple")
|
||||
@ApiOperation(value = "获取角色精简信息列表", notes = "只包含被开启的角色,主要用于前端的下拉选项")
|
||||
public CommonResult<List<SysRoleSimpleRespVO>> getSimpleRoles() {
|
||||
// 获得角色列表,只要开启状态的
|
||||
List<SysRoleDO> list = roleService.getRoles(Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
|
||||
// 排序后,返回个诶前端
|
||||
list.sort(Comparator.comparing(SysRoleDO::getSort));
|
||||
return success(SysRoleConvert.INSTANCE.convertList02(list));
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
@OperateLog(type = EXPORT)
|
||||
@PreAuthorize("@ss.hasPermission('system:role:export')")
|
||||
public void export(HttpServletResponse response, @Validated SysRoleExportReqVO reqVO) throws IOException {
|
||||
List<SysRoleDO> list = roleService.getRoleList(reqVO);
|
||||
List<SysRoleExcelVO> data = SysRoleConvert.INSTANCE.convertList03(list);
|
||||
// 输出
|
||||
ExcelUtils.write(response, "角色数据.xls", "角色列表", SysRoleExcelVO.class, data);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.menu;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 菜单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysMenuBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单名称", required = true, example = "芋道")
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
@Size(max = 50, message = "菜单名称长度不能超过50个字符")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "权限标识", example = "sys:menu:add", notes = "仅菜单类型为按钮时,才需要传递")
|
||||
@Size(max = 100)
|
||||
private String permission;
|
||||
|
||||
@ApiModelProperty(value = "类型", required = true, example = "1", notes = "参见 SysMenuTypeEnum 枚举类")
|
||||
@NotNull(message = "菜单类型不能为空")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "显示顺序不能为空", required = true, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "父菜单 ID", required = true, example = "1024")
|
||||
@NotNull(message = "父菜单 ID 不能为空")
|
||||
private Long parentId;
|
||||
|
||||
@ApiModelProperty(value = "路由地址", example = "post", notes = "仅菜单类型为菜单或者目录时,才需要传")
|
||||
@Size(max = 200, message = "路由地址不能超过200个字符")
|
||||
private String path;
|
||||
|
||||
@ApiModelProperty(value = "菜单图标", example = "/menu/list", notes = "仅菜单类型为菜单或者目录时,才需要传")
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty(value = "组件路径", example = "system/post/index", notes = "仅菜单类型为菜单时,才需要传")
|
||||
@Size(max = 200, message = "组件路径不能超过255个字符")
|
||||
private String component;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 SysCommonStatusEnum 枚举")
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.menu;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.*;
|
||||
|
||||
@ApiModel("菜单创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysMenuCreateReqVO extends SysMenuBaseVO {
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.menu;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@ApiModel("菜单列表 Request VO")
|
||||
@Data
|
||||
public class SysMenuListReqVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.menu;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("菜单信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysMenuRespVO extends SysMenuBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.menu;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@ApiModel("菜单精简信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SysMenuSimpleRespVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "菜单名称", required = true, example = "芋道")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "父菜单 ID", required = true, example = "1024")
|
||||
private Long parentId;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.menu;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("菜单更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysMenuUpdateReqVO extends SysMenuBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "菜单编号", required = true, example = "1024")
|
||||
@NotNull(message = "菜单编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.permission;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel("赋予角色数据权限 Request VO")
|
||||
@Data
|
||||
public class SysPermissionAssignRoleDataScopeReqVO {
|
||||
|
||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||
@NotNull(message = "角色编号不能为空")
|
||||
private Long roleId;
|
||||
|
||||
@ApiModelProperty(value = "数据范围", required = true, example = "1", notes = "参见 SysDataScopeEnum 枚举类")
|
||||
@NotNull(message = "数据范围不能为空")
|
||||
// TODO 这里要多一个枚举校验
|
||||
private Integer dataScope;
|
||||
|
||||
@ApiModelProperty(value = "部门编号列表", example = "1,3,5", notes = "只有范围类型为 DEPT_CUSTOM 时,该字段才需要")
|
||||
private Set<Long> dataScopeDeptIds = Collections.emptySet(); // 兜底
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.permission;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel("赋予角色菜单 Request VO")
|
||||
@Data
|
||||
public class SysPermissionAssignRoleMenuReqVO {
|
||||
|
||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||
@NotNull(message = "角色编号不能为空")
|
||||
private Long roleId;
|
||||
|
||||
@ApiModelProperty(value = "菜单编号列表", example = "1,3,5")
|
||||
private Set<Long> menuIds = Collections.emptySet(); // 兜底
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.permission;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel("赋予用户角色 Request VO")
|
||||
@Data
|
||||
public class SysPermissionAssignUserRoleReqVO {
|
||||
|
||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||
@NotNull(message = "角色编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@ApiModelProperty(value = "角色编号列表", example = "1,3,5")
|
||||
private Set<Long> roleIds = Collections.emptySet(); // 兜底
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.role;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 角色 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SysRoleBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "角色名称", required = true, example = "管理员")
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
@Size(max = 30, message = "角色名称长度不能超过30个字符")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "角色标志不能为空")
|
||||
@Size(max = 100, message = "角色标志长度不能超过100个字符")
|
||||
@ApiModelProperty(value = "角色编码", required = true, example = "ADMIN")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "显示顺序不能为空", required = true, example = "1024")
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "角色类型", required = true, example = "1", notes = "见 SysRoleTypeEnum 枚举")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "备注", example = "我是一个角色")
|
||||
private String remark;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.role;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("角色创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysRoleCreateReqVO extends SysRoleBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.role;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
|
||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 角色 Excel 导出响应 VO
|
||||
*/
|
||||
@Data
|
||||
public class SysRoleExcelVO {
|
||||
|
||||
@ExcelProperty("角色序号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("角色名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("角色标志")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("角色排序")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty("数据范围")
|
||||
private Integer dataScope;
|
||||
|
||||
@ExcelProperty(value = "角色状态", converter = DictConvert.class)
|
||||
@DictFormat(SysDictTypeConstants.COMMON_STATUS)
|
||||
private String status;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.role;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("角色分页 Request VO")
|
||||
@Data
|
||||
public class SysRoleExportReqVO {
|
||||
|
||||
@ApiModelProperty(value = "角色名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "角色标识", example = "yudao", notes = "模糊匹配")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.role;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ApiModel("角色分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysRolePageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "角色名称", example = "芋道", notes = "模糊匹配")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "角色标识", example = "yudao", notes = "模糊匹配")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date beginTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date endTime;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.system.controller.permission.vo.role;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
@ApiModel("角色信息 Response VO")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SysRoleRespVO extends SysRoleBaseVO {
|
||||
|
||||
@ApiModelProperty(value = "角色编号", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "数据范围", required = true, example = "1", notes = "参见 DataScopeEnum 枚举类")
|
||||
private Integer dataScope;
|
||||
|
||||
@ApiModelProperty(value = "数据范围(指定部门数组)", example = "1")
|
||||
private Set<Long> dataScopeDeptIds;
|
||||
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "角色类型", required = true, example = "1", notes = "参见 SysRoleTypeEnum 枚举类")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user