多模块重构 4:system 模块的创建,去除 Sys

This commit is contained in:
YunaiV 2022-01-29 21:29:54 +08:00
parent 06887bff16
commit 117914d92b
335 changed files with 2481 additions and 2498 deletions

View File

@ -1,10 +1,11 @@
{ {
"local": { "local": {
"baseUrl": "http://127.0.0.1:48080/api", "baseUrl": "http://127.0.0.1:48080/admin-api",
"token": "test1", "token": "test1",
"adminTenentId": "1",
"userApi": "http://127.0.0.1:48080/app-api", "userApi": "http://127.0.0.1:48080/app-api",
"userToken": "test1", "appToken": "test1",
"userTenentId": "1" "appTenentId": "1"
} }
} }

View File

@ -54,11 +54,11 @@ yudao:
base-package: cn.iocoder.yudao.coreservice base-package: cn.iocoder.yudao.coreservice
web: web:
admin-api: admin-api:
prefix: /api prefix: /admin-api
controller: ${yudao.info.base-package} controller: cn.iocoder.yudao.module.system.controller.admin # TODO 芋艿:需要改造
app-api: app-api:
prefix: /app-api prefix: /app-api
controller: cn.iocoder.yudao.module.member.controller.app controller: cn.iocoder.yudao.module.member.controller.app # TODO 芋艿:需要改造
swagger: swagger:
title: 管理后台 title: 管理后台

View File

@ -123,12 +123,13 @@ public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdap
.accessDeniedHandler(accessDeniedHandler).and() .accessDeniedHandler(accessDeniedHandler).and()
// 登出地址的配置 // 登出地址的配置
.logout().logoutSuccessHandler(logoutSuccessHandler).logoutRequestMatcher(request -> // 匹配多种用户类型的登出 .logout().logoutSuccessHandler(logoutSuccessHandler).logoutRequestMatcher(request -> // 匹配多种用户类型的登出
StrUtil.equalsAny(request.getRequestURI(), buildAdminApi("/logout"), buildAppApi("/member/logout"))); StrUtil.equalsAny(request.getRequestURI(), buildAdminApi("/system/logout"),
buildAppApi("/member/logout")));
// 设置每个请求的权限 全局共享规则 // 设置每个请求的权限 全局共享规则
httpSecurity.authorizeRequests() httpSecurity.authorizeRequests()
// 登录的接口可匿名访问 // 登录的接口可匿名访问
.antMatchers(buildAdminApi("/login")).anonymous() .antMatchers(buildAdminApi("/system/login"), buildAdminApi("/member/login")).anonymous()
// 静态资源可匿名访问 // 静态资源可匿名访问
.antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll() .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
// 文件的获取接口可匿名访问 // 文件的获取接口可匿名访问

View File

@ -1,7 +1,7 @@
### 请求 /login 接口 => 成功 ### 请求 /login 接口 => 成功
POST {{userApi}}/member/login POST {{appApi}}/member/login
Content-Type: application/json Content-Type: application/json
tenant-id: {{userTenentId}} tenant-id: {{appTenentId}}
{ {
"mobile": "15601691300", "mobile": "15601691300",
@ -9,9 +9,9 @@ tenant-id: {{userTenentId}}
} }
### 请求 /send-sms-code 接口 => 成功 ### 请求 /send-sms-code 接口 => 成功
POST {{userApi}}/member/send-sms-code POST {{appApi}}/member/send-sms-code
Content-Type: application/json Content-Type: application/json
tenant-id: {{userTenentId}} tenant-id: {{appTenentId}}
{ {
"mobile": "15601691399", "mobile": "15601691399",
@ -19,9 +19,9 @@ tenant-id: {{userTenentId}}
} }
### 请求 /sms-login 接口 => 成功 ### 请求 /sms-login 接口 => 成功
POST {{userApi}}/member/sms-login POST {{appApi}}/member/sms-login
Content-Type: application/json Content-Type: application/json
tenant-id: {{userTenentId}} tenant-id: {{appTenentId}}
{ {
"mobile": "15601691301", "mobile": "15601691301",
@ -29,7 +29,7 @@ tenant-id: {{userTenentId}}
} }
### 请求 /logout 接口 => 成功 ### 请求 /logout 接口 => 成功
POST {{userApi}}/member/logout POST {{appApi}}/member/logout
Content-Type: application/json Content-Type: application/json
Authorization: Bearer c1b76bdaf2c146c581caa4d7fd81ee66 Authorization: Bearer c1b76bdaf2c146c581caa4d7fd81ee66
tenant-id: {{userTenentId}} tenant-id: {{appTenentId}}

View File

@ -14,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -26,14 +27,15 @@ import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getCli
import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getUserAgent; 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.getLoginUserId;
@Api(tags = "APP - 认证") @Api(tags = "用户 APP - 认证")
@RestController @RestController
@RequestMapping("/member/") @RequestMapping("/member/")
@Validated @Validated
@Slf4j @Slf4j
public class AppAuthController { public class AppAuthController {
@Resource @Autowired
@SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // AuthService 存在重名
private AuthService authService; private AuthService authService;
@Resource @Resource
@ -41,9 +43,6 @@ public class AppAuthController {
@Resource @Resource
private SysSocialCoreService socialService; private SysSocialCoreService socialService;
@Resource
private LogoutSuccessHandler logoutSuccessHandler;
@PostMapping("/login") @PostMapping("/login")
@ApiOperation("使用手机 + 密码登录") @ApiOperation("使用手机 + 密码登录")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志 @OperateLog(enable = false) // 避免 Post 请求被记录操作日志

View File

@ -16,7 +16,7 @@ import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
// TODO 芋艿code review 相关逻辑 // TODO 芋艿code review 相关逻辑
@ApiModel("APP - 校验验证码 Request VO") @ApiModel("用户 APP - 校验验证码 Request VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -11,7 +11,7 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
@ApiModel("APP - 手机 + 密码登录 Request VO") @ApiModel("用户 APP - 手机 + 密码登录 Request VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -7,7 +7,7 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ApiModel("APP - 手机密码登录 Response VO") @ApiModel("用户 APP - 手机密码登录 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -14,7 +14,7 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
// TODO 芋艿code review 相关逻辑 // TODO 芋艿code review 相关逻辑
@ApiModel("APP - 重置密码 Request VO") @ApiModel("用户 APP - 重置密码 Request VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -10,7 +10,7 @@ import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("APP - 发送手机验证码 Response VO") @ApiModel("用户 APP - 发送手机验证码 Response VO")
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
public class AppAuthSendSmsReqVO { public class AppAuthSendSmsReqVO {

View File

@ -12,7 +12,7 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
@ApiModel("APP - 手机 + 验证码登录 Request VO") @ApiModel("用户 APP - 手机 + 验证码登录 Request VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("APP - 社交绑定 Request VO使用 code 授权码") @ApiModel("用户 APP - 社交绑定 Request VO使用 code 授权码")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -14,7 +14,7 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
@ApiModel("APP - 社交登录 Request VO使用 code 授权码 + 账号密码") @ApiModel("用户 APP - 社交登录 Request VO使用 code 授权码 + 账号密码")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("APP - 社交登录 Request VO使用 code 授权码") @ApiModel("用户 APP - 社交登录 Request VO使用 code 授权码")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -12,7 +12,7 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("APP - 取消社交绑定 Request VO使用 code 授权码") @ApiModel("用户 APP - 取消社交绑定 Request VO使用 code 授权码")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -12,7 +12,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
// TODO 芋艿code review 相关逻辑 // TODO 芋艿code review 相关逻辑
@ApiModel("APP - 修改密码 Request VO") @ApiModel("用户 APP - 修改密码 Request VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -1 +0,0 @@
package cn.iocoder.yudao.module.member.controller.app;

View File

@ -23,7 +23,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.module.member.enums.MemberErrorCodeConstants.FILE_IS_EMPTY; import static cn.iocoder.yudao.module.member.enums.MemberErrorCodeConstants.FILE_IS_EMPTY;
@Api(tags = "APP - 用户个人中心") @Api(tags = "用户 APP - 用户个人中心")
@RestController @RestController
@RequestMapping("/member/user") @RequestMapping("/member/user")
@Validated @Validated

View File

@ -6,7 +6,7 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ApiModel("APP - 用户个人信息 Response VO") @ApiModel("用户 APP - 用户个人信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -13,7 +13,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
@ApiModel("APP - 修改手机 Request VO") @ApiModel("用户 APP - 修改手机 Request VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor

View File

@ -1,6 +1,6 @@
/** /**
* 提供 RESTful API 给前端 * 提供 RESTful API 给前端
* 1. admin 提供给管理后台 yudao-ui-admin 前端项目 * 1. admin 提供给管理后台 yudao-ui-admin 前端项目
* 2. app 提供给用户 APP yudao-ui-app 前端项目 * 2. app 提供给用户 APP yudao-ui-app 前端项目它的 Controller VO 都要添加 App 前缀用于和管理后台进行区分
*/ */
package cn.iocoder.yudao.module.member.controller; package cn.iocoder.yudao.module.member.controller;

View File

@ -51,7 +51,7 @@ import static cn.iocoder.yudao.module.member.enums.SysErrorCodeConstants.*;
* *
* @author 芋道源码 * @author 芋道源码
*/ */
@Service @Service("memberAuthService")
@Slf4j @Slf4j
public class AuthServiceImpl implements AuthService { public class AuthServiceImpl implements AuthService {

View File

@ -32,7 +32,7 @@ import static cn.iocoder.yudao.module.member.enums.MemberErrorCodeConstants.USER
* *
* @author 芋道源码 * @author 芋道源码
*/ */
@Service @Service("memberUserService")
@Valid @Valid
@Slf4j @Slf4j
public class UserServiceImpl implements UserService { public class UserServiceImpl implements UserService {

View File

@ -1,7 +1,7 @@
### 请求 /login 接口 => 成功 ### 请求 /login 接口 => 成功
POST {{baseUrl}}/login POST {{baseUrl}}/system/login
Content-Type: application/json Content-Type: application/json
tenant-id: 1 tenant-id: {{adminTenentId}}
{ {
"username": "admin", "username": "admin",
@ -11,16 +11,12 @@ tenant-id: 1
} }
### 请求 /get-permission-info 接口 => 成功 ### 请求 /get-permission-info 接口 => 成功
GET {{baseUrl}}/get-permission-info GET {{baseUrl}}/system/get-permission-info
Authorization: Bearer {{token}} Authorization: Bearer {{token}}
tenant-id: 1 tenant-id: {{adminTenentId}}
### 请求 /list-menus 接口 => 成功 ### 请求 /list-menus 接口 => 成功
GET {{baseUrl}}/list-menus GET {{baseUrl}}/system/list-menus
Authorization: Bearer {{token}} Authorization: Bearer {{token}}
#Authorization: Bearer a6aa7714a2e44c95aaa8a2c5adc2a67a #Authorization: Bearer a6aa7714a2e44c95aaa8a2c5adc2a67a
tenant-id: 1 tenant-id: {{adminTenentId}}
### 请求 /druid/xxx 接口 => 失败 TODO 临时测试
GET http://127.0.0.1:8080/druid/123
Authorization: Bearer {{token}}

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.system.controller.auth; package cn.iocoder.yudao.module.system.controller.admin.auth;
import cn.iocoder.yudao.module.system.controller.auth.vo.auth.*; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.*;
import cn.iocoder.yudao.module.system.convert.auth.SysAuthConvert; import cn.iocoder.yudao.module.system.convert.auth.AuthConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysMenuDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; 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.enums.permission.MenuTypeEnum;
import cn.iocoder.yudao.module.system.service.auth.SysAuthService; import cn.iocoder.yudao.module.system.service.auth.AuthService;
import cn.iocoder.yudao.module.system.service.permission.SysPermissionService; import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.SysRoleService; import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; 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.social.SysSocialCoreService;
import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService;
@ -21,6 +21,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -34,36 +35,37 @@ import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getUse
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserRoleIds; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserRoleIds;
@Api(tags = "认证") @Api(tags = "管理后台 - 认证")
@RestController @RestController
@RequestMapping("/") @RequestMapping("/system") // 暂时不跟 /auth 结尾
@Validated @Validated
@Slf4j @Slf4j
public class SysAuthController { public class AuthController {
@Resource @Autowired
private SysAuthService authService; @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // AuthService 存在重名
private AuthService authService;
@Resource @Resource
private SysUserCoreService userCoreService; private SysUserCoreService userCoreService;
@Resource @Resource
private SysRoleService roleService; private RoleService roleService;
@Resource @Resource
private SysPermissionService permissionService; private PermissionService permissionService;
@Resource @Resource
private SysSocialCoreService socialCoreService; private SysSocialCoreService socialCoreService;
@PostMapping("/login") @PostMapping("/login")
@ApiOperation("使用账号密码登录") @ApiOperation("使用账号密码登录")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志 @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
public CommonResult<SysAuthLoginRespVO> login(@RequestBody @Valid SysAuthLoginReqVO reqVO) { public CommonResult<AuthLoginRespVO> login(@RequestBody @Valid AuthLoginReqVO reqVO) {
String token = authService.login(reqVO, getClientIP(), getUserAgent()); String token = authService.login(reqVO, getClientIP(), getUserAgent());
// 返回结果 // 返回结果
return success(SysAuthLoginRespVO.builder().token(token).build()); return success(AuthLoginRespVO.builder().token(token).build());
} }
@GetMapping("/get-permission-info") @GetMapping("/get-permission-info")
@ApiOperation("获取登录用户的权限信息") @ApiOperation("获取登录用户的权限信息")
public CommonResult<SysAuthPermissionInfoRespVO> getPermissionInfo() { public CommonResult<AuthPermissionInfoRespVO> getPermissionInfo() {
// 获得用户信息 // 获得用户信息
SysUserDO user = userCoreService.getUser(getLoginUserId()); SysUserDO user = userCoreService.getUser(getLoginUserId());
if (user == null) { if (user == null) {
@ -72,24 +74,24 @@ public class SysAuthController {
// 获得角色列表 // 获得角色列表
List<SysRoleDO> roleList = roleService.getRolesFromCache(getLoginUserRoleIds()); List<SysRoleDO> roleList = roleService.getRolesFromCache(getLoginUserRoleIds());
// 获得菜单列表 // 获得菜单列表
List<SysMenuDO> menuList = permissionService.getRoleMenusFromCache( List<MenuDO> menuList = permissionService.getRoleMenusFromCache(
getLoginUserRoleIds(), // 注意基于登录的角色因为后续的权限判断也是基于它 getLoginUserRoleIds(), // 注意基于登录的角色因为后续的权限判断也是基于它
SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()), SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType(), MenuTypeEnum.BUTTON.getType()),
SetUtils.asSet(CommonStatusEnum.ENABLE.getStatus())); SetUtils.asSet(CommonStatusEnum.ENABLE.getStatus()));
// 拼接结果返回 // 拼接结果返回
return success(SysAuthConvert.INSTANCE.convert(user, roleList, menuList)); return success(AuthConvert.INSTANCE.convert(user, roleList, menuList));
} }
@GetMapping("list-menus") @GetMapping("list-menus")
@ApiOperation("获得登录用户的菜单列表") @ApiOperation("获得登录用户的菜单列表")
public CommonResult<List<SysAuthMenuRespVO>> getMenus() { public CommonResult<List<AuthMenuRespVO>> getMenus() {
// 获得用户拥有的菜单列表 // 获得用户拥有的菜单列表
List<SysMenuDO> menuList = permissionService.getRoleMenusFromCache( List<MenuDO> menuList = permissionService.getRoleMenusFromCache(
getLoginUserRoleIds(), // 注意基于登录的角色因为后续的权限判断也是基于它 getLoginUserRoleIds(), // 注意基于登录的角色因为后续的权限判断也是基于它
SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType()), // 只要目录和菜单类型 SetUtils.asSet(MenuTypeEnum.DIR.getType(), MenuTypeEnum.MENU.getType()), // 只要目录和菜单类型
SetUtils.asSet(CommonStatusEnum.ENABLE.getStatus())); // 只要开启的 SetUtils.asSet(CommonStatusEnum.ENABLE.getStatus())); // 只要开启的
// 转换成 Tree 结构返回 // 转换成 Tree 结构返回
return success(SysAuthConvert.INSTANCE.buildMenuTree(menuList)); return success(AuthConvert.INSTANCE.buildMenuTree(menuList));
} }
// ========== 社交登录相关 ========== // ========== 社交登录相关 ==========
@ -108,31 +110,31 @@ public class SysAuthController {
@PostMapping("/social-login") @PostMapping("/social-login")
@ApiOperation("社交登录,使用 code 授权码") @ApiOperation("社交登录,使用 code 授权码")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志 @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
public CommonResult<SysAuthLoginRespVO> socialLogin(@RequestBody @Valid SysAuthSocialLoginReqVO reqVO) { public CommonResult<AuthLoginRespVO> socialLogin(@RequestBody @Valid AuthSocialLoginReqVO reqVO) {
String token = authService.socialLogin(reqVO, getClientIP(), getUserAgent()); String token = authService.socialLogin(reqVO, getClientIP(), getUserAgent());
// 返回结果 // 返回结果
return success(SysAuthLoginRespVO.builder().token(token).build()); return success(AuthLoginRespVO.builder().token(token).build());
} }
@PostMapping("/social-login2") @PostMapping("/social-login2")
@ApiOperation("社交登录,使用 code 授权码 + 账号密码") @ApiOperation("社交登录,使用 code 授权码 + 账号密码")
@OperateLog(enable = false) // 避免 Post 请求被记录操作日志 @OperateLog(enable = false) // 避免 Post 请求被记录操作日志
public CommonResult<SysAuthLoginRespVO> socialLogin2(@RequestBody @Valid SysAuthSocialLogin2ReqVO reqVO) { public CommonResult<AuthLoginRespVO> socialLogin2(@RequestBody @Valid AuthSocialLogin2ReqVO reqVO) {
String token = authService.socialLogin2(reqVO, getClientIP(), getUserAgent()); String token = authService.socialLogin2(reqVO, getClientIP(), getUserAgent());
// 返回结果 // 返回结果
return success(SysAuthLoginRespVO.builder().token(token).build()); return success(AuthLoginRespVO.builder().token(token).build());
} }
@PostMapping("/social-bind") @PostMapping("/social-bind")
@ApiOperation("社交绑定,使用 code 授权码") @ApiOperation("社交绑定,使用 code 授权码")
public CommonResult<Boolean> socialBind(@RequestBody @Valid SysAuthSocialBindReqVO reqVO) { public CommonResult<Boolean> socialBind(@RequestBody @Valid AuthSocialBindReqVO reqVO) {
authService.socialBind(getLoginUserId(), reqVO); authService.socialBind(getLoginUserId(), reqVO);
return CommonResult.success(true); return CommonResult.success(true);
} }
@DeleteMapping("/social-unbind") @DeleteMapping("/social-unbind")
@ApiOperation("取消社交绑定") @ApiOperation("取消社交绑定")
public CommonResult<Boolean> socialUnbind(@RequestBody SysAuthSocialUnbindReqVO reqVO) { public CommonResult<Boolean> socialUnbind(@RequestBody AuthSocialUnbindReqVO reqVO) {
socialCoreService.unbindSocialUser(getLoginUserId(), reqVO.getType(), reqVO.getUnionId(), UserTypeEnum.ADMIN); socialCoreService.unbindSocialUser(getLoginUserId(), reqVO.getType(), reqVO.getUnionId(), UserTypeEnum.ADMIN);
return CommonResult.success(true); return CommonResult.success(true);
} }

View File

@ -1,10 +1,10 @@
package cn.iocoder.yudao.module.system.controller.auth; package cn.iocoder.yudao.module.system.controller.admin.auth;
import cn.iocoder.yudao.module.system.controller.auth.vo.session.SysUserSessionPageItemRespVO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageItemRespVO;
import cn.iocoder.yudao.module.system.controller.auth.vo.session.SysUserSessionPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageReqVO;
import cn.iocoder.yudao.module.system.convert.auth.SysUserSessionConvert; import cn.iocoder.yudao.module.system.convert.auth.UserSessionConvert;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO;
import cn.iocoder.yudao.module.system.service.auth.SysUserSessionService; import cn.iocoder.yudao.module.system.service.auth.UserSessionService;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; 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.dal.dataobject.user.SysUserDO;
import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService;
@ -28,13 +28,13 @@ import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
@Api(tags = "用户 Session") @Api(tags = "管理后台 - 用户 Session")
@RestController @RestController
@RequestMapping("/system/user-session") @RequestMapping("/system/user-session")
public class SysUserSessionController { public class UserSessionController {
@Resource @Resource
private SysUserSessionService userSessionService; private UserSessionService userSessionService;
@Resource @Resource
private SysUserSessionCoreService userSessionCoreService; private SysUserSessionCoreService userSessionCoreService;
@Resource @Resource
@ -46,7 +46,7 @@ public class SysUserSessionController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得 Session 分页列表") @ApiOperation("获得 Session 分页列表")
@PreAuthorize("@ss.hasPermission('system:user-session:page')") @PreAuthorize("@ss.hasPermission('system:user-session:page')")
public CommonResult<PageResult<SysUserSessionPageItemRespVO>> getUserSessionPage(@Validated SysUserSessionPageReqVO reqVO) { public CommonResult<PageResult<UserSessionPageItemRespVO>> getUserSessionPage(@Validated UserSessionPageReqVO reqVO) {
// 获得 Session 分页 // 获得 Session 分页
PageResult<SysUserSessionDO> pageResult = userSessionService.getUserSessionPage(reqVO); PageResult<SysUserSessionDO> pageResult = userSessionService.getUserSessionPage(reqVO);
@ -56,9 +56,9 @@ public class SysUserSessionController {
Map<Long, SysDeptDO> deptMap = deptCoreService.getDeptMap( Map<Long, SysDeptDO> deptMap = deptCoreService.getDeptMap(
convertList(userMap.values(), SysUserDO::getDeptId)); convertList(userMap.values(), SysUserDO::getDeptId));
// 拼接结果返回 // 拼接结果返回
List<SysUserSessionPageItemRespVO> sessionList = new ArrayList<>(pageResult.getList().size()); List<UserSessionPageItemRespVO> sessionList = new ArrayList<>(pageResult.getList().size());
pageResult.getList().forEach(session -> { pageResult.getList().forEach(session -> {
SysUserSessionPageItemRespVO respVO = SysUserSessionConvert.INSTANCE.convert(session); UserSessionPageItemRespVO respVO = UserSessionConvert.INSTANCE.convert(session);
sessionList.add(respVO); sessionList.add(respVO);
// 设置用户账号 // 设置用户账号
MapUtils.findAndThen(userMap, session.getUserId(), user -> { MapUtils.findAndThen(userMap, session.getUserId(), user -> {

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.auth; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -11,12 +11,12 @@ import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
@ApiModel("账号密码登录 Request VO") @ApiModel("管理后台 - 账号密码登录 Request VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class SysAuthLoginReqVO { public class AuthLoginReqVO {
@ApiModelProperty(value = "账号", required = true, example = "yudaoyuanma") @ApiModelProperty(value = "账号", required = true, example = "yudaoyuanma")
@NotEmpty(message = "登录账号不能为空") @NotEmpty(message = "登录账号不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.auth; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -7,12 +7,12 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ApiModel("账号密码登录 Response VO") @ApiModel("管理后台 - 账号密码登录 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class SysAuthLoginRespVO { public class AuthLoginRespVO {
@ApiModelProperty(value = "token", required = true, example = "yudaoyuanma") @ApiModelProperty(value = "token", required = true, example = "yudaoyuanma")
private String token; private String token;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.auth; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,12 +9,12 @@ import lombok.NoArgsConstructor;
import java.util.List; import java.util.List;
@ApiModel("登录用户的菜单信息 Response VO") @ApiModel("管理后台 - 登录用户的菜单信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class SysAuthMenuRespVO { public class AuthMenuRespVO {
@ApiModelProperty(value = "菜单名称", required = true, example = "芋道") @ApiModelProperty(value = "菜单名称", required = true, example = "芋道")
private Long id; private Long id;
@ -37,6 +37,6 @@ public class SysAuthMenuRespVO {
/** /**
* 子路由 * 子路由
*/ */
private List<SysAuthMenuRespVO> children; private List<AuthMenuRespVO> children;
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.auth; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,12 +9,12 @@ import lombok.NoArgsConstructor;
import java.util.Set; import java.util.Set;
@ApiModel(value = "登录用户的权限信息 Response VO", description = "额外包括用户信息和角色列表") @ApiModel(value = "管理后台 - 登录用户的权限信息 Response VO", description = "额外包括用户信息和角色列表")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class SysAuthPermissionInfoRespVO { public class AuthPermissionInfoRespVO {
@ApiModelProperty(value = "用户信息", required = true) @ApiModelProperty(value = "用户信息", required = true)
private UserVO user; private UserVO user;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.auth; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth;
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
@ -12,12 +12,12 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("社交绑定 Request VO使用 code 授权码") @ApiModel("管理后台 - 社交绑定 Request VO使用 code 授权码")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class SysAuthSocialBindReqVO { public class AuthSocialBindReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值") @ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
@InEnum(SysSocialTypeEnum.class) @InEnum(SysSocialTypeEnum.class)

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.auth; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth;
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
@ -14,12 +14,12 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
@ApiModel("社交登录 Request VO使用 code 授权码 + 账号密码") @ApiModel("管理后台 - 社交登录 Request VO使用 code 授权码 + 账号密码")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class SysAuthSocialLogin2ReqVO { public class AuthSocialLogin2ReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值") @ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
@InEnum(SysSocialTypeEnum.class) @InEnum(SysSocialTypeEnum.class)

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.auth; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth;
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
@ -12,12 +12,12 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("社交登录 Request VO使用 code 授权码") @ApiModel("管理后台 - 社交登录 Request VO使用 code 授权码")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class SysAuthSocialLoginReqVO { public class AuthSocialLoginReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值") @ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
@InEnum(SysSocialTypeEnum.class) @InEnum(SysSocialTypeEnum.class)

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.auth; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth;
import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum;
import cn.iocoder.yudao.framework.common.validation.InEnum; import cn.iocoder.yudao.framework.common.validation.InEnum;
@ -12,12 +12,12 @@ import lombok.NoArgsConstructor;
import javax.validation.constraints.NotEmpty; import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("取消社交绑定 Request VO使用 code 授权码") @ApiModel("管理后台 - 取消社交绑定 Request VO使用 code 授权码")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class SysAuthSocialUnbindReqVO { public class AuthSocialUnbindReqVO {
@ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值") @ApiModelProperty(value = "社交平台的类型", required = true, example = "10", notes = "参见 SysUserSocialTypeEnum 枚举值")
@InEnum(SysSocialTypeEnum.class) @InEnum(SysSocialTypeEnum.class)

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.session; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.session;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -10,12 +10,12 @@ import lombok.NoArgsConstructor;
import java.util.Date; import java.util.Date;
@ApiModel(value = "用户在线 Session Response VO", description = "相比用户基本信息来说,会多部门、用户账号等信息") @ApiModel(value = "管理后台 - 用户在线 Session Response VO", description = "相比用户基本信息来说,会多部门、用户账号等信息")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysUserSessionPageItemRespVO extends PageParam { public class UserSessionPageItemRespVO extends PageParam {
@ApiModelProperty(value = "Session 编号", required = true, example = "fe50b9f6-d177-44b1-8da9-72ea34f63db7") @ApiModelProperty(value = "Session 编号", required = true, example = "fe50b9f6-d177-44b1-8da9-72ea34f63db7")
private String id; private String id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.auth.vo.session; package cn.iocoder.yudao.module.system.controller.admin.auth.vo.session;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ApiModel("在线用户 Session 分页 Request VO") @ApiModel("管理后台 - 在线用户 Session 分页 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysUserSessionPageReqVO extends PageParam { public class UserSessionPageReqVO extends PageParam {
@ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模糊匹配") @ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模糊匹配")
private String userIp; private String userIp;

View File

@ -1,8 +1,8 @@
package cn.iocoder.yudao.module.system.controller.common; package cn.iocoder.yudao.module.system.controller.admin.common;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.controller.common.vo.SysCaptchaImageRespVO; import cn.iocoder.yudao.module.system.controller.admin.common.vo.CaptchaImageRespVO;
import cn.iocoder.yudao.module.system.service.common.SysCaptchaService; import cn.iocoder.yudao.module.system.service.common.CaptchaService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -13,17 +13,17 @@ import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Api(tags = "验证码") @Api(tags = "管理后台 - 验证码")
@RestController @RestController
@RequestMapping("/system/captcha") @RequestMapping("/system/captcha")
public class SysCaptchaController { public class CaptchaController {
@Resource @Resource
private SysCaptchaService captchaService; private CaptchaService captchaService;
@GetMapping("/get-image") @GetMapping("/get-image")
@ApiOperation("生成图片验证码") @ApiOperation("生成图片验证码")
public CommonResult<SysCaptchaImageRespVO> getCaptchaImage() { public CommonResult<CaptchaImageRespVO> getCaptchaImage() {
return success(captchaService.getCaptchaImage()); return success(captchaService.getCaptchaImage());
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.common.vo; package cn.iocoder.yudao.module.system.controller.admin.common.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -7,14 +7,15 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ApiModel("验证码图片 Response VO") @ApiModel("管理后台 - 验证码图片 Response VO")
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class SysCaptchaImageRespVO { public class CaptchaImageRespVO {
@ApiModelProperty(value = "uuid", required = true, example = "1b3b7d00-83a8-4638-9e37-d67011855968", notes = "通过该 uuid 作为该验证码的标识") @ApiModelProperty(value = "uuid", required = true, example = "1b3b7d00-83a8-4638-9e37-d67011855968",
notes = "通过该 uuid 作为该验证码的标识")
private String uuid; private String uuid;
@ApiModelProperty(value = "图片", required = true, notes = "验证码的图片内容,使用 Base64 编码") @ApiModelProperty(value = "图片", required = true, notes = "验证码的图片内容,使用 Base64 编码")

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.system.controller.dept; package cn.iocoder.yudao.module.system.controller.admin.dept;
import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.controller.dept.vo.dept.*; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.*;
import cn.iocoder.yudao.module.system.convert.dept.SysDeptConvert; import cn.iocoder.yudao.module.system.convert.dept.DeptConvert;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO;
import cn.iocoder.yudao.module.system.service.dept.SysDeptService; import cn.iocoder.yudao.module.system.service.dept.DeptService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -21,14 +21,14 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Api(tags = "部门") @Api(tags = "管理后台 - 部门")
@RestController @RestController
@RequestMapping("/system/dept") @RequestMapping("/system/dept")
@Validated @Validated
public class SysDeptController { public class DeptController {
@Resource @Resource
private SysDeptService deptService; private DeptService deptService;
@Resource @Resource
private SysDeptCoreService deptCoreService; private SysDeptCoreService deptCoreService;
@ -36,7 +36,7 @@ public class SysDeptController {
@PostMapping("create") @PostMapping("create")
@ApiOperation("创建部门") @ApiOperation("创建部门")
@PreAuthorize("@ss.hasPermission('system:dept:create')") @PreAuthorize("@ss.hasPermission('system:dept:create')")
public CommonResult<Long> createDept(@Valid @RequestBody SysDeptCreateReqVO reqVO) { public CommonResult<Long> createDept(@Valid @RequestBody DeptCreateReqVO reqVO) {
Long deptId = deptService.createDept(reqVO); Long deptId = deptService.createDept(reqVO);
return success(deptId); return success(deptId);
} }
@ -44,7 +44,7 @@ public class SysDeptController {
@PutMapping("update") @PutMapping("update")
@ApiOperation("更新部门") @ApiOperation("更新部门")
@PreAuthorize("@ss.hasPermission('system:dept:update')") @PreAuthorize("@ss.hasPermission('system:dept:update')")
public CommonResult<Boolean> updateDept(@Valid @RequestBody SysDeptUpdateReqVO reqVO) { public CommonResult<Boolean> updateDept(@Valid @RequestBody DeptUpdateReqVO reqVO) {
deptService.updateDept(reqVO); deptService.updateDept(reqVO);
return success(true); return success(true);
} }
@ -61,30 +61,30 @@ public class SysDeptController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation("获取部门列表") @ApiOperation("获取部门列表")
@PreAuthorize("@ss.hasPermission('system:dept:query')") @PreAuthorize("@ss.hasPermission('system:dept:query')")
public CommonResult<List<SysDeptRespVO>> listDepts(SysDeptListReqVO reqVO) { public CommonResult<List<DeptRespVO>> listDepts(DeptListReqVO reqVO) {
List<SysDeptDO> list = deptService.getSimpleDepts(reqVO); List<SysDeptDO> list = deptService.getSimpleDepts(reqVO);
list.sort(Comparator.comparing(SysDeptDO::getSort)); list.sort(Comparator.comparing(SysDeptDO::getSort));
return success(SysDeptConvert.INSTANCE.convertList(list)); return success(DeptConvert.INSTANCE.convertList(list));
} }
@GetMapping("/list-all-simple") @GetMapping("/list-all-simple")
@ApiOperation(value = "获取部门精简信息列表", notes = "只包含被开启的部门,主要用于前端的下拉选项") @ApiOperation(value = "获取部门精简信息列表", notes = "只包含被开启的部门,主要用于前端的下拉选项")
public CommonResult<List<SysDeptSimpleRespVO>> getSimpleDepts() { public CommonResult<List<DeptSimpleRespVO>> getSimpleDepts() {
// 获得部门列表只要开启状态的 // 获得部门列表只要开启状态的
SysDeptListReqVO reqVO = new SysDeptListReqVO(); DeptListReqVO reqVO = new DeptListReqVO();
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus()); reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
List<SysDeptDO> list = deptService.getSimpleDepts(reqVO); List<SysDeptDO> list = deptService.getSimpleDepts(reqVO);
// 排序后返回给前端 // 排序后返回给前端
list.sort(Comparator.comparing(SysDeptDO::getSort)); list.sort(Comparator.comparing(SysDeptDO::getSort));
return success(SysDeptConvert.INSTANCE.convertList02(list)); return success(DeptConvert.INSTANCE.convertList02(list));
} }
@GetMapping("/get") @GetMapping("/get")
@ApiOperation("获得部门信息") @ApiOperation("获得部门信息")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('system:dept:query')") @PreAuthorize("@ss.hasPermission('system:dept:query')")
public CommonResult<SysDeptRespVO> getDept(@RequestParam("id") Long id) { public CommonResult<DeptRespVO> getDept(@RequestParam("id") Long id) {
return success(SysDeptConvert.INSTANCE.convert(deptCoreService.getDept(id))); return success(DeptConvert.INSTANCE.convert(deptCoreService.getDept(id)));
} }
} }

View File

@ -1,14 +1,14 @@
package cn.iocoder.yudao.module.system.controller.dept; package cn.iocoder.yudao.module.system.controller.admin.dept;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 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.controller.admin.dept.vo.post.*;
import cn.iocoder.yudao.module.system.convert.dept.SysPostConvert; import cn.iocoder.yudao.module.system.convert.dept.PostConvert;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO;
import cn.iocoder.yudao.module.system.service.dept.SysPostService; import cn.iocoder.yudao.module.system.service.dept.PostService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -27,19 +27,19 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "岗位") @Api(tags = "管理后台 - 岗位")
@RestController @RestController
@RequestMapping("/system/post") @RequestMapping("/system/post")
@Valid @Validated
public class SysPostController { public class PostController {
@Resource @Resource
private SysPostService postService; private PostService postService;
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("创建岗位") @ApiOperation("创建岗位")
@PreAuthorize("@ss.hasPermission('system:post:create')") @PreAuthorize("@ss.hasPermission('system:post:create')")
public CommonResult<Long> createPost(@Valid @RequestBody SysPostCreateReqVO reqVO) { public CommonResult<Long> createPost(@Valid @RequestBody PostCreateReqVO reqVO) {
Long postId = postService.createPost(reqVO); Long postId = postService.createPost(reqVO);
return success(postId); return success(postId);
} }
@ -47,7 +47,7 @@ public class SysPostController {
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("修改岗位") @ApiOperation("修改岗位")
@PreAuthorize("@ss.hasPermission('system:post:update')") @PreAuthorize("@ss.hasPermission('system:post:update')")
public CommonResult<Boolean> updatePost(@Valid @RequestBody SysPostUpdateReqVO reqVO) { public CommonResult<Boolean> updatePost(@Valid @RequestBody PostUpdateReqVO reqVO) {
postService.updatePost(reqVO); postService.updatePost(reqVO);
return success(true); return success(true);
} }
@ -64,36 +64,36 @@ public class SysPostController {
@ApiOperation("获得岗位信息") @ApiOperation("获得岗位信息")
@ApiImplicitParam(name = "id", value = "岗位编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "岗位编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('system:post:query')") @PreAuthorize("@ss.hasPermission('system:post:query')")
public CommonResult<SysPostRespVO> getPost(@RequestParam("id") Long id) { public CommonResult<PostRespVO> getPost(@RequestParam("id") Long id) {
return success(SysPostConvert.INSTANCE.convert(postService.getPost(id))); return success(PostConvert.INSTANCE.convert(postService.getPost(id)));
} }
@GetMapping("/list-all-simple") @GetMapping("/list-all-simple")
@ApiOperation(value = "获取岗位精简信息列表", notes = "只包含被开启的岗位,主要用于前端的下拉选项") @ApiOperation(value = "获取岗位精简信息列表", notes = "只包含被开启的岗位,主要用于前端的下拉选项")
public CommonResult<List<SysPostSimpleRespVO>> getSimplePosts() { public CommonResult<List<PostSimpleRespVO>> getSimplePosts() {
// 获得岗位列表只要开启状态的 // 获得岗位列表只要开启状态的
List<SysPostDO> list = postService.getPosts(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus())); List<SysPostDO> list = postService.getPosts(null, Collections.singleton(CommonStatusEnum.ENABLE.getStatus()));
// 排序后返回给前端 // 排序后返回给前端
list.sort(Comparator.comparing(SysPostDO::getSort)); list.sort(Comparator.comparing(SysPostDO::getSort));
return success(SysPostConvert.INSTANCE.convertList02(list)); return success(PostConvert.INSTANCE.convertList02(list));
} }
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得岗位分页列表") @ApiOperation("获得岗位分页列表")
@PreAuthorize("@ss.hasPermission('system:post:query')") @PreAuthorize("@ss.hasPermission('system:post:query')")
public CommonResult<PageResult<SysPostRespVO>> getPostPage(@Validated SysPostPageReqVO reqVO) { public CommonResult<PageResult<PostRespVO>> getPostPage(@Validated PostPageReqVO reqVO) {
return success(SysPostConvert.INSTANCE.convertPage(postService.getPostPage(reqVO))); return success(PostConvert.INSTANCE.convertPage(postService.getPostPage(reqVO)));
} }
@GetMapping("/export") @GetMapping("/export")
@ApiOperation("岗位管理") @ApiOperation("岗位管理")
@PreAuthorize("@ss.hasPermission('system:post:export')") @PreAuthorize("@ss.hasPermission('system:post:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void export(HttpServletResponse response, @Validated SysPostExportReqVO reqVO) throws IOException { public void export(HttpServletResponse response, @Validated PostExportReqVO reqVO) throws IOException {
List<SysPostDO> posts = postService.getPosts(reqVO); List<SysPostDO> posts = postService.getPosts(reqVO);
List<SysPostExcelVO> data = SysPostConvert.INSTANCE.convertList03(posts); List<PostExcelVO> data = PostConvert.INSTANCE.convertList03(posts);
// 输出 // 输出
ExcelUtils.write(response, "岗位数据.xls", "岗位列表", SysPostExcelVO.class, data); ExcelUtils.write(response, "岗位数据.xls", "岗位列表", PostExcelVO.class, data);
} }
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.dept; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -13,7 +13,7 @@ import javax.validation.constraints.Size;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class SysDeptBaseVO { public class DeptBaseVO {
@ApiModelProperty(value = "菜单名称", required = true, example = "芋道") @ApiModelProperty(value = "菜单名称", required = true, example = "芋道")
@NotBlank(message = "部门名称不能为空") @NotBlank(message = "部门名称不能为空")

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.dept; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
@ApiModel("部门创建 Request VO") @ApiModel("管理后台 - 部门创建 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class SysDeptCreateReqVO extends SysDeptBaseVO { public class DeptCreateReqVO extends DeptBaseVO {
} }

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.dept; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ApiModel("部门列表 Request VO") @ApiModel("管理后台 - 部门列表 Request VO")
@Data @Data
public class SysDeptListReqVO { public class DeptListReqVO {
@ApiModelProperty(value = "部门名称", example = "芋道", notes = "模糊匹配") @ApiModelProperty(value = "部门名称", example = "芋道", notes = "模糊匹配")
private String name; private String name;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.dept; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -7,10 +7,10 @@ import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
@ApiModel("部门信息 Response VO") @ApiModel("管理后台 - 部门信息 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDeptRespVO extends SysDeptBaseVO { public class DeptRespVO extends DeptBaseVO {
@ApiModelProperty(value = "部门编号", required = true, example = "1024") @ApiModelProperty(value = "部门编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.dept; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -6,11 +6,11 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ApiModel("部门精简信息 Response VO") @ApiModel("管理后台 - 部门精简信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class SysDeptSimpleRespVO { public class DeptSimpleRespVO {
@ApiModelProperty(value = "部门编号", required = true, example = "1024") @ApiModelProperty(value = "部门编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.dept; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -7,10 +7,10 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("部门更新 Request VO") @ApiModel("管理后台 - 部门更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDeptUpdateReqVO extends SysDeptBaseVO { public class DeptUpdateReqVO extends DeptBaseVO {
@ApiModelProperty(value = "部门编号", required = true, example = "1024") @ApiModelProperty(value = "部门编号", required = true, example = "1024")
@NotNull(message = "部门编号不能为空") @NotNull(message = "部门编号不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.post; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -12,7 +12,7 @@ import javax.validation.constraints.Size;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class SysPostBaseVO { public class PostBaseVO {
@ApiModelProperty(value = "岗位名称", required = true, example = "小博主") @ApiModelProperty(value = "岗位名称", required = true, example = "小博主")
@NotBlank(message = "岗位名称不能为空") @NotBlank(message = "岗位名称不能为空")

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("管理后台 - 岗位创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class PostCreateReqVO extends PostBaseVO {
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.post; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@ -10,7 +10,7 @@ import lombok.Data;
* 岗位 Excel 导出响应 VO * 岗位 Excel 导出响应 VO
*/ */
@Data @Data
public class SysPostExcelVO { public class PostExcelVO {
@ExcelProperty("岗位序号") @ExcelProperty("岗位序号")
private Long id; private Long id;

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.post; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ApiModel(value = "岗位导出 Request VO", description = "参数和 SysPostExcelVO 是一致的") @ApiModel(value = "管理后台 - 岗位导出 Request VO", description = "参数和 SysPostExcelVO 是一致的")
@Data @Data
public class SysPostExportReqVO { public class PostExportReqVO {
@ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配") @ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配")
private String code; private String code;

View File

@ -1,14 +1,14 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.post; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ApiModel("岗位列表 Request VO") @ApiModel("管理后台 - 岗位列表 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysPostListReqVO extends SysPostBaseVO { public class PostListReqVO extends PostBaseVO {
@ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配") @ApiModelProperty(value = "岗位名称", example = "芋道", notes = "模糊匹配")
private String name; private String name;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.post; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -6,10 +6,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ApiModel("岗位分页 Request VO") @ApiModel("管理后台 - 岗位分页 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysPostPageReqVO extends PageParam { public class PostPageReqVO extends PageParam {
@ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配") @ApiModelProperty(value = "岗位编码", example = "yudao", notes = "模糊匹配")
private String code; private String code;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.post; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -7,10 +7,10 @@ import lombok.EqualsAndHashCode;
import java.util.Date; import java.util.Date;
@ApiModel("岗位信息 Response VO") @ApiModel("管理后台 - 岗位信息 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysPostRespVO extends SysPostBaseVO { public class PostRespVO extends PostBaseVO {
@ApiModelProperty(value = "岗位序号", required = true, example = "1024") @ApiModelProperty(value = "岗位序号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.post; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -6,11 +6,11 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ApiModel("岗位精简信息 Response VO") @ApiModel("管理后台 - 岗位精简信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class SysPostSimpleRespVO { public class PostSimpleRespVO {
@ApiModelProperty(value = "岗位编号", required = true, example = "1024") @ApiModelProperty(value = "岗位编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dept.vo.post; package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -7,10 +7,10 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("岗位更新 Request VO") @ApiModel("管理后台 - 岗位更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysPostUpdateReqVO extends SysPostBaseVO { public class PostUpdateReqVO extends PostBaseVO {
@ApiModelProperty(value = "岗位编号", required = true, example = "1024") @ApiModelProperty(value = "岗位编号", required = true, example = "1024")
@NotNull(message = "岗位编号不能为空") @NotNull(message = "岗位编号不能为空")

View File

@ -1,3 +1,4 @@
### 请求 /menu/list 接口 => 成功 ### 请求 /menu/list 接口 => 成功
GET {{baseUrl}}/system/dict-data/list-all-simple GET {{baseUrl}}/system/dict-data/list-all-simple
Authorization: Bearer {{token}} Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.system.controller.dict; package cn.iocoder.yudao.module.system.controller.admin.dict;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; 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.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 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.controller.admin.dict.vo.data.*;
import cn.iocoder.yudao.module.system.convert.dict.SysDictDataConvert; import cn.iocoder.yudao.module.system.convert.dict.DictDataConvert;
import cn.iocoder.yudao.module.system.service.dict.SysDictDataService; import cn.iocoder.yudao.module.system.service.dict.DictDataService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -24,19 +24,19 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "字典数据") @Api(tags = "管理后台 - 字典数据")
@RestController @RestController
@RequestMapping("/system/dict-data") @RequestMapping("/system/dict-data")
@Validated @Validated
public class SysDictDataController { public class DictDataController {
@Resource @Resource
private SysDictDataService dictDataService; private DictDataService dictDataService;
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("新增字典数据") @ApiOperation("新增字典数据")
@PreAuthorize("@ss.hasPermission('system:dict:create')") @PreAuthorize("@ss.hasPermission('system:dict:create')")
public CommonResult<Long> createDictData(@Valid @RequestBody SysDictDataCreateReqVO reqVO) { public CommonResult<Long> createDictData(@Valid @RequestBody DictDataCreateReqVO reqVO) {
Long dictDataId = dictDataService.createDictData(reqVO); Long dictDataId = dictDataService.createDictData(reqVO);
return success(dictDataId); return success(dictDataId);
} }
@ -44,7 +44,7 @@ public class SysDictDataController {
@PutMapping("update") @PutMapping("update")
@ApiOperation("修改字典数据") @ApiOperation("修改字典数据")
@PreAuthorize("@ss.hasPermission('system:dict:update')") @PreAuthorize("@ss.hasPermission('system:dict:update')")
public CommonResult<Boolean> updateDictData(@Valid @RequestBody SysDictDataUpdateReqVO reqVO) { public CommonResult<Boolean> updateDictData(@Valid @RequestBody DictDataUpdateReqVO reqVO) {
dictDataService.updateDictData(reqVO); dictDataService.updateDictData(reqVO);
return success(true); return success(true);
} }
@ -61,35 +61,35 @@ public class SysDictDataController {
@GetMapping("/list-all-simple") @GetMapping("/list-all-simple")
@ApiOperation(value = "获得全部字典数据列表", notes = "一般用于管理后台缓存字典数据在本地") @ApiOperation(value = "获得全部字典数据列表", notes = "一般用于管理后台缓存字典数据在本地")
// 无需添加权限认证因为前端全局都需要 // 无需添加权限认证因为前端全局都需要
public CommonResult<List<SysDictDataSimpleRespVO>> getSimpleDictDatas() { public CommonResult<List<DictDataSimpleRespVO>> getSimpleDictDatas() {
List<SysDictDataDO> list = dictDataService.getDictDatas(); List<SysDictDataDO> list = dictDataService.getDictDatas();
return success(SysDictDataConvert.INSTANCE.convertList(list)); return success(DictDataConvert.INSTANCE.convertList(list));
} }
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("/获得字典类型的分页列表") @ApiOperation("/获得字典类型的分页列表")
@PreAuthorize("@ss.hasPermission('system:dict:query')") @PreAuthorize("@ss.hasPermission('system:dict:query')")
public CommonResult<PageResult<SysDictDataRespVO>> getDictTypePage(@Valid SysDictDataPageReqVO reqVO) { public CommonResult<PageResult<DictDataRespVO>> getDictTypePage(@Valid DictDataPageReqVO reqVO) {
return success(SysDictDataConvert.INSTANCE.convertPage(dictDataService.getDictDataPage(reqVO))); return success(DictDataConvert.INSTANCE.convertPage(dictDataService.getDictDataPage(reqVO)));
} }
@GetMapping(value = "/get") @GetMapping(value = "/get")
@ApiOperation("/查询字典数据详细") @ApiOperation("/查询字典数据详细")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('system:dict:query')") @PreAuthorize("@ss.hasPermission('system:dict:query')")
public CommonResult<SysDictDataRespVO> getDictData(@RequestParam("id") Long id) { public CommonResult<DictDataRespVO> getDictData(@RequestParam("id") Long id) {
return success(SysDictDataConvert.INSTANCE.convert(dictDataService.getDictData(id))); return success(DictDataConvert.INSTANCE.convert(dictDataService.getDictData(id)));
} }
@GetMapping("/export") @GetMapping("/export")
@ApiOperation("导出字典数据") @ApiOperation("导出字典数据")
@PreAuthorize("@ss.hasPermission('system:dict:export')") @PreAuthorize("@ss.hasPermission('system:dict:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void export(HttpServletResponse response, @Valid SysDictDataExportReqVO reqVO) throws IOException { public void export(HttpServletResponse response, @Valid DictDataExportReqVO reqVO) throws IOException {
List<SysDictDataDO> list = dictDataService.getDictDatas(reqVO); List<SysDictDataDO> list = dictDataService.getDictDatas(reqVO);
List<SysDictDataExcelVO> data = SysDictDataConvert.INSTANCE.convertList02(list); List<DictDataExcelVO> data = DictDataConvert.INSTANCE.convertList02(list);
// 输出 // 输出
ExcelUtils.write(response, "字典数据.xls", "数据列表", SysDictDataExcelVO.class, data); ExcelUtils.write(response, "字典数据.xls", "数据列表", DictDataExcelVO.class, data);
} }
} }

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.system.controller.dict; package cn.iocoder.yudao.module.system.controller.admin.dict;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 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.controller.admin.dict.vo.type.*;
import cn.iocoder.yudao.module.system.convert.dict.SysDictTypeConvert; import cn.iocoder.yudao.module.system.convert.dict.DictTypeConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictTypeDO; import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO;
import cn.iocoder.yudao.module.system.service.dict.SysDictTypeService; import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -24,19 +24,19 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "字典类型") @Api(tags = "管理后台 - 字典类型")
@RestController @RestController
@RequestMapping("/system/dict-type") @RequestMapping("/system/dict-type")
@Validated @Validated
public class SysDictTypeController { public class DictTypeController {
@Resource @Resource
private SysDictTypeService dictTypeService; private DictTypeService dictTypeService;
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("创建字典类型") @ApiOperation("创建字典类型")
@PreAuthorize("@ss.hasPermission('system:dict:create')") @PreAuthorize("@ss.hasPermission('system:dict:create')")
public CommonResult<Long> createDictType(@Valid @RequestBody SysDictTypeCreateReqVO reqVO) { public CommonResult<Long> createDictType(@Valid @RequestBody DictTypeCreateReqVO reqVO) {
Long dictTypeId = dictTypeService.createDictType(reqVO); Long dictTypeId = dictTypeService.createDictType(reqVO);
return success(dictTypeId); return success(dictTypeId);
} }
@ -44,7 +44,7 @@ public class SysDictTypeController {
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("修改字典类型") @ApiOperation("修改字典类型")
@PreAuthorize("@ss.hasPermission('system:dict:update')") @PreAuthorize("@ss.hasPermission('system:dict:update')")
public CommonResult<Boolean> updateDictType(@Valid @RequestBody SysDictTypeUpdateReqVO reqVO) { public CommonResult<Boolean> updateDictType(@Valid @RequestBody DictTypeUpdateReqVO reqVO) {
dictTypeService.updateDictType(reqVO); dictTypeService.updateDictType(reqVO);
return success(true); return success(true);
} }
@ -61,35 +61,35 @@ public class SysDictTypeController {
@ApiOperation("/获得字典类型的分页列表") @ApiOperation("/获得字典类型的分页列表")
@GetMapping("/page") @GetMapping("/page")
@PreAuthorize("@ss.hasPermission('system:dict:query')") @PreAuthorize("@ss.hasPermission('system:dict:query')")
public CommonResult<PageResult<SysDictTypeRespVO>> pageDictTypes(@Valid SysDictTypePageReqVO reqVO) { public CommonResult<PageResult<DictTypeRespVO>> pageDictTypes(@Valid DictTypePageReqVO reqVO) {
return success(SysDictTypeConvert.INSTANCE.convertPage(dictTypeService.getDictTypePage(reqVO))); return success(DictTypeConvert.INSTANCE.convertPage(dictTypeService.getDictTypePage(reqVO)));
} }
@ApiOperation("/查询字典类型详细") @ApiOperation("/查询字典类型详细")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@GetMapping(value = "/get") @GetMapping(value = "/get")
@PreAuthorize("@ss.hasPermission('system:dict:query')") @PreAuthorize("@ss.hasPermission('system:dict:query')")
public CommonResult<SysDictTypeRespVO> getDictType(@RequestParam("id") Long id) { public CommonResult<DictTypeRespVO> getDictType(@RequestParam("id") Long id) {
return success(SysDictTypeConvert.INSTANCE.convert(dictTypeService.getDictType(id))); return success(DictTypeConvert.INSTANCE.convert(dictTypeService.getDictType(id)));
} }
@GetMapping("/list-all-simple") @GetMapping("/list-all-simple")
@ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项") @ApiOperation(value = "获得全部字典类型列表", notes = "包括开启 + 禁用的字典类型,主要用于前端的下拉选项")
// 无需添加权限认证因为前端全局都需要 // 无需添加权限认证因为前端全局都需要
public CommonResult<List<SysDictTypeSimpleRespVO>> listSimpleDictTypes() { public CommonResult<List<DictTypeSimpleRespVO>> listSimpleDictTypes() {
List<SysDictTypeDO> list = dictTypeService.getDictTypeList(); List<DictTypeDO> list = dictTypeService.getDictTypeList();
return success(SysDictTypeConvert.INSTANCE.convertList(list)); return success(DictTypeConvert.INSTANCE.convertList(list));
} }
@ApiOperation("导出数据类型") @ApiOperation("导出数据类型")
@GetMapping("/export") @GetMapping("/export")
@PreAuthorize("@ss.hasPermission('system:dict:query')") @PreAuthorize("@ss.hasPermission('system:dict:query')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void export(HttpServletResponse response, @Valid SysDictTypeExportReqVO reqVO) throws IOException { public void export(HttpServletResponse response, @Valid DictTypeExportReqVO reqVO) throws IOException {
List<SysDictTypeDO> list = dictTypeService.getDictTypeList(reqVO); List<DictTypeDO> list = dictTypeService.getDictTypeList(reqVO);
List<SysDictTypeExcelVO> data = SysDictTypeConvert.INSTANCE.convertList02(list); List<DictTypeExcelVO> data = DictTypeConvert.INSTANCE.convertList02(list);
// 输出 // 输出
ExcelUtils.write(response, "字典类型.xls", "类型列表", SysDictTypeExcelVO.class, data); ExcelUtils.write(response, "字典类型.xls", "类型列表", DictTypeExcelVO.class, data);
} }
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.data; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -12,7 +12,7 @@ import javax.validation.constraints.Size;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class SysDictDataBaseVO { public class DictDataBaseVO {
@ApiModelProperty(value = "显示顺序不能为空", required = true, example = "1024") @ApiModelProperty(value = "显示顺序不能为空", required = true, example = "1024")
@NotNull(message = "显示顺序不能为空") @NotNull(message = "显示顺序不能为空")

View File

@ -0,0 +1,12 @@
package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("管理后台 - 字典数据创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class DictDataCreateReqVO extends DictDataBaseVO {
}

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.data; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@ -10,7 +10,7 @@ import lombok.Data;
* 字典数据 Excel 导出响应 VO * 字典数据 Excel 导出响应 VO
*/ */
@Data @Data
public class SysDictDataExcelVO { public class DictDataExcelVO {
@ExcelProperty("字典编码") @ExcelProperty("字典编码")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.data; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -6,9 +6,9 @@ import lombok.Data;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ApiModel("字典类型导出 Request VO") @ApiModel("管理后台 - 字典类型导出 Request VO")
@Data @Data
public class SysDictDataExportReqVO { public class DictDataExportReqVO {
@ApiModelProperty(value = "字典标签", example = "芋道") @ApiModelProperty(value = "字典标签", example = "芋道")
@Size(max = 100, message = "字典标签长度不能超过100个字符") @Size(max = 100, message = "字典标签长度不能超过100个字符")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.data; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -8,10 +8,10 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ApiModel("字典类型分页列表 Request VO") @ApiModel("管理后台 - 字典类型分页列表 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictDataPageReqVO extends PageParam { public class DictDataPageReqVO extends PageParam {
@ApiModelProperty(value = "字典标签", example = "芋道") @ApiModelProperty(value = "字典标签", example = "芋道")
@Size(max = 100, message = "字典标签长度不能超过100个字符") @Size(max = 100, message = "字典标签长度不能超过100个字符")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.data; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,12 +9,12 @@ import lombok.NoArgsConstructor;
import java.util.Date; import java.util.Date;
@ApiModel("字典数据信息 Response VO") @ApiModel("管理后台 - 字典数据信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictDataRespVO extends SysDictDataBaseVO { public class DictDataRespVO extends DictDataBaseVO {
@ApiModelProperty(value = "字典数据编号", required = true, example = "1024") @ApiModelProperty(value = "字典数据编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.data; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ApiModel("数据字典精简 Response VO") @ApiModel("管理后台 - 数据字典精简 Response VO")
@Data @Data
public class SysDictDataSimpleRespVO { public class DictDataSimpleRespVO {
@ApiModelProperty(value = "字典类型", required = true, example = "gender") @ApiModelProperty(value = "字典类型", required = true, example = "gender")
private String dictType; private String dictType;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.data; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -7,10 +7,10 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("字典数据更新 Request VO") @ApiModel("管理后台 - 字典数据更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictDataUpdateReqVO extends SysDictDataBaseVO { public class DictDataUpdateReqVO extends DictDataBaseVO {
@ApiModelProperty(value = "字典数据编号", required = true, example = "1024") @ApiModelProperty(value = "字典数据编号", required = true, example = "1024")
@NotNull(message = "字典数据编号不能为空") @NotNull(message = "字典数据编号不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.type; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -12,7 +12,7 @@ import javax.validation.constraints.Size;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class SysDictTypeBaseVO { public class DictTypeBaseVO {
@ApiModelProperty(value = "字典名称", required = true, example = "性别") @ApiModelProperty(value = "字典名称", required = true, example = "性别")
@NotBlank(message = "字典名称不能为空") @NotBlank(message = "字典名称不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.type; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -8,10 +8,10 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size; import javax.validation.constraints.Size;
@ApiModel("字典类型创建 Request VO") @ApiModel("管理后台 - 字典类型创建 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictTypeCreateReqVO extends SysDictTypeBaseVO { public class DictTypeCreateReqVO extends DictTypeBaseVO {
@ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex") @ApiModelProperty(value = "字典类型", required = true, example = "sys_common_sex")
@NotNull(message = "字典类型不能为空") @NotNull(message = "字典类型不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.type; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@ -10,7 +10,7 @@ import lombok.Data;
* 字典类型 Excel 导出响应 VO * 字典类型 Excel 导出响应 VO
*/ */
@Data @Data
public class SysDictTypeExcelVO { public class DictTypeExcelVO {
@ExcelProperty("字典主键") @ExcelProperty("字典主键")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.type; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,9 +9,9 @@ import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("字典类型分页列表 Request VO") @ApiModel("管理后台 - 字典类型分页列表 Request VO")
@Data @Data
public class SysDictTypeExportReqVO { public class DictTypeExportReqVO {
@ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配") @ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配")
private String name; private String name;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.type; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -12,10 +12,10 @@ import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("字典类型分页列表 Request VO") @ApiModel("管理后台 - 字典类型分页列表 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictTypePageReqVO extends PageParam { public class DictTypePageReqVO extends PageParam {
@ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配") @ApiModelProperty(value = "字典类型名称", example = "芋道", notes = "模糊匹配")
private String name; private String name;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.type; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,12 +9,12 @@ import lombok.NoArgsConstructor;
import java.util.Date; import java.util.Date;
@ApiModel("字典类型信息 Response VO") @ApiModel("管理后台 - 字典类型信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictTypeRespVO extends SysDictTypeBaseVO { public class DictTypeRespVO extends DictTypeBaseVO {
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024") @ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.type; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -6,11 +6,11 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ApiModel("字典类型精简信息 Response VO") @ApiModel("管理后台 - 字典类型精简信息 Response VO")
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class SysDictTypeSimpleRespVO { public class DictTypeSimpleRespVO {
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024") @ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.dict.vo.type; package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -7,10 +7,10 @@ import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("字典类型更新 Request VO") @ApiModel("管理后台 - 字典类型更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysDictTypeUpdateReqVO extends SysDictTypeBaseVO { public class DictTypeUpdateReqVO extends DictTypeBaseVO {
@ApiModelProperty(value = "字典类型编号", required = true, example = "1024") @ApiModelProperty(value = "字典类型编号", required = true, example = "1024")
@NotNull(message = "字典类型编号不能为空") @NotNull(message = "字典类型编号不能为空")

View File

@ -1,7 +1,8 @@
### ### 创建错误码
POST {{baseUrl}}/inra/error-code/create POST {{baseUrl}}/inra/error-code/create
Authorization: Bearer {{token}} Authorization: Bearer {{token}}
Content-Type: application/json Content-Type: application/json
tenant-id: {{adminTenentId}}
{ {
"code": 200, "code": 200,

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.system.controller.errorcode; package cn.iocoder.yudao.module.system.controller.admin.errorcode;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.system.convert.errorcode.SysErrorCodeConvert; import cn.iocoder.yudao.module.system.convert.errorcode.ErrorCodeConvert;
import cn.iocoder.yudao.module.system.controller.errorcode.vo.*; import cn.iocoder.yudao.module.system.controller.admin.errorcode.vo.*;
import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.SysErrorCodeDO; import cn.iocoder.yudao.module.system.dal.dataobject.errorcode.ErrorCodeDO;
import cn.iocoder.yudao.module.system.service.errorcode.SysErrorCodeService; import cn.iocoder.yudao.module.system.service.errorcode.ErrorCodeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -24,26 +24,26 @@ import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "错误码") @Api(tags = "管理后台 - 错误码")
@RestController @RestController
@RequestMapping("/system/error-code") @RequestMapping("/system/error-code")
@Validated @Validated
public class SysErrorCodeController { public class ErrorCodeController {
@Resource @Resource
private SysErrorCodeService errorCodeService; private ErrorCodeService errorCodeService;
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("创建错误码") @ApiOperation("创建错误码")
@PreAuthorize("@ss.hasPermission('system:error-code:create')") @PreAuthorize("@ss.hasPermission('system:error-code:create')")
public CommonResult<Long> createErrorCode(@Valid @RequestBody SysErrorCodeCreateReqVO createReqVO) { public CommonResult<Long> createErrorCode(@Valid @RequestBody ErrorCodeCreateReqVO createReqVO) {
return success(errorCodeService.createErrorCode(createReqVO)); return success(errorCodeService.createErrorCode(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("更新错误码") @ApiOperation("更新错误码")
@PreAuthorize("@ss.hasPermission('system:error-code:update')") @PreAuthorize("@ss.hasPermission('system:error-code:update')")
public CommonResult<Boolean> updateErrorCode(@Valid @RequestBody SysErrorCodeUpdateReqVO updateReqVO) { public CommonResult<Boolean> updateErrorCode(@Valid @RequestBody ErrorCodeUpdateReqVO updateReqVO) {
errorCodeService.updateErrorCode(updateReqVO); errorCodeService.updateErrorCode(updateReqVO);
return success(true); return success(true);
} }
@ -61,29 +61,29 @@ public class SysErrorCodeController {
@ApiOperation("获得错误码") @ApiOperation("获得错误码")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('system:error-code:query')") @PreAuthorize("@ss.hasPermission('system:error-code:query')")
public CommonResult<SysErrorCodeRespVO> getErrorCode(@RequestParam("id") Long id) { public CommonResult<ErrorCodeRespVO> getErrorCode(@RequestParam("id") Long id) {
SysErrorCodeDO errorCode = errorCodeService.getErrorCode(id); ErrorCodeDO errorCode = errorCodeService.getErrorCode(id);
return success(SysErrorCodeConvert.INSTANCE.convert(errorCode)); return success(ErrorCodeConvert.INSTANCE.convert(errorCode));
} }
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得错误码分页") @ApiOperation("获得错误码分页")
@PreAuthorize("@ss.hasPermission('system:error-code:query')") @PreAuthorize("@ss.hasPermission('system:error-code:query')")
public CommonResult<PageResult<SysErrorCodeRespVO>> getErrorCodePage(@Valid SysErrorCodePageReqVO pageVO) { public CommonResult<PageResult<ErrorCodeRespVO>> getErrorCodePage(@Valid ErrorCodePageReqVO pageVO) {
PageResult<SysErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(pageVO); PageResult<ErrorCodeDO> pageResult = errorCodeService.getErrorCodePage(pageVO);
return success(SysErrorCodeConvert.INSTANCE.convertPage(pageResult)); return success(ErrorCodeConvert.INSTANCE.convertPage(pageResult));
} }
@GetMapping("/export-excel") @GetMapping("/export-excel")
@ApiOperation("导出错误码 Excel") @ApiOperation("导出错误码 Excel")
@PreAuthorize("@ss.hasPermission('system:error-code:export')") @PreAuthorize("@ss.hasPermission('system:error-code:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportErrorCodeExcel(@Valid SysErrorCodeExportReqVO exportReqVO, public void exportErrorCodeExcel(@Valid ErrorCodeExportReqVO exportReqVO,
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
List<SysErrorCodeDO> list = errorCodeService.getErrorCodeList(exportReqVO); List<ErrorCodeDO> list = errorCodeService.getErrorCodeList(exportReqVO);
// 导出 Excel // 导出 Excel
List<SysErrorCodeExcelVO> datas = SysErrorCodeConvert.INSTANCE.convertList02(list); List<ErrorCodeExcelVO> datas = ErrorCodeConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "错误码.xls", "数据", SysErrorCodeExcelVO.class, datas); ExcelUtils.write(response, "错误码.xls", "数据", ErrorCodeExcelVO.class, datas);
} }
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.errorcode.vo; package cn.iocoder.yudao.module.system.controller.admin.errorcode.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class SysErrorCodeBaseVO { public class ErrorCodeBaseVO {
@ApiModelProperty(value = "应用名", required = true, example = "dashboard") @ApiModelProperty(value = "应用名", required = true, example = "dashboard")
@NotNull(message = "应用名不能为空") @NotNull(message = "应用名不能为空")

View File

@ -1,14 +1,14 @@
package cn.iocoder.yudao.module.system.controller.sms.vo.template; package cn.iocoder.yudao.module.system.controller.admin.errorcode.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
@ApiModel("短信模板创建 Request VO") @ApiModel("管理后台 - 错误码创建 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class SysSmsTemplateCreateReqVO extends SysSmsTemplateBaseVO { public class ErrorCodeCreateReqVO extends ErrorCodeBaseVO {
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.errorcode.vo; package cn.iocoder.yudao.module.system.controller.admin.errorcode.vo;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@ -14,7 +14,7 @@ import java.util.Date;
* @author 芋道源码 * @author 芋道源码
*/ */
@Data @Data
public class SysErrorCodeExcelVO { public class ErrorCodeExcelVO {
@ExcelProperty("错误码编号") @ExcelProperty("错误码编号")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.errorcode.vo; package cn.iocoder.yudao.module.system.controller.admin.errorcode.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,9 +9,9 @@ import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel(value = "错误码 Excel 导出 Request VO", description = "参数和 InfErrorCodePageReqVO 是一致的") @ApiModel(value = "管理后台 - 错误码 Excel 导出 Request VO", description = "参数和 InfErrorCodePageReqVO 是一致的")
@Data @Data
public class SysErrorCodeExportReqVO { public class ErrorCodeExportReqVO {
@ApiModelProperty(value = "错误码类型", example = "1") @ApiModelProperty(value = "错误码类型", example = "1")
private Integer type; private Integer type;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.errorcode.vo; package cn.iocoder.yudao.module.system.controller.admin.errorcode.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -12,11 +12,11 @@ import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("错误码分页 Request VO") @ApiModel("管理后台 - 错误码分页 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class SysErrorCodePageReqVO extends PageParam { public class ErrorCodePageReqVO extends PageParam {
@ApiModelProperty(value = "错误码类型", example = "1", notes = "参见 SysErrorCodeTypeEnum 枚举类") @ApiModelProperty(value = "错误码类型", example = "1", notes = "参见 SysErrorCodeTypeEnum 枚举类")
private Integer type; private Integer type;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.errorcode.vo; package cn.iocoder.yudao.module.system.controller.admin.errorcode.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -8,11 +8,11 @@ import lombok.ToString;
import java.util.Date; import java.util.Date;
@ApiModel("错误码 Response VO") @ApiModel("管理后台 - 错误码 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class SysErrorCodeRespVO extends SysErrorCodeBaseVO { public class ErrorCodeRespVO extends ErrorCodeBaseVO {
@ApiModelProperty(value = "错误码编号", required = true, example = "1024") @ApiModelProperty(value = "错误码编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.errorcode.vo; package cn.iocoder.yudao.module.system.controller.admin.errorcode.vo;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -8,11 +8,11 @@ import lombok.ToString;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
@ApiModel("错误码更新 Request VO") @ApiModel("管理后台 - 错误码更新 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class SysErrorCodeUpdateReqVO extends SysErrorCodeBaseVO { public class ErrorCodeUpdateReqVO extends ErrorCodeBaseVO {
@ApiModelProperty(value = "错误码编号", required = true, example = "1024") @ApiModelProperty(value = "错误码编号", required = true, example = "1024")
@NotNull(message = "错误码编号不能为空") @NotNull(message = "错误码编号不能为空")

View File

@ -1,16 +1,16 @@
package cn.iocoder.yudao.module.system.controller.logger; package cn.iocoder.yudao.module.system.controller.admin.logger;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; 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.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; 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.admin.logger.vo.loginlog.LoginLogExcelVO;
import cn.iocoder.yudao.module.system.controller.logger.vo.loginlog.SysLoginLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogExportReqVO;
import cn.iocoder.yudao.module.system.controller.logger.vo.loginlog.SysLoginLogPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO;
import cn.iocoder.yudao.module.system.controller.logger.vo.loginlog.SysLoginLogRespVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogRespVO;
import cn.iocoder.yudao.module.system.convert.logger.SysLoginLogConvert; import cn.iocoder.yudao.module.system.convert.logger.LoginLogConvert;
import cn.iocoder.yudao.module.system.service.logger.SysLoginLogService; import cn.iocoder.yudao.module.system.service.logger.LoginLogService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
@ -27,33 +27,33 @@ import java.util.List;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "登录日志") @Api(tags = "管理后台 - 登录日志")
@RestController @RestController
@RequestMapping("/system/login-log") @RequestMapping("/system/login-log")
@Validated @Validated
public class SysLoginLogController { public class LoginLogController {
@Resource @Resource
private SysLoginLogService loginLogService; private LoginLogService loginLogService;
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获得登录日志分页列表") @ApiOperation("获得登录日志分页列表")
@PreAuthorize("@ss.hasPermission('system:login-log:query')") @PreAuthorize("@ss.hasPermission('system:login-log:query')")
public CommonResult<PageResult<SysLoginLogRespVO>> getLoginLogPage(@Valid SysLoginLogPageReqVO reqVO) { public CommonResult<PageResult<LoginLogRespVO>> getLoginLogPage(@Valid LoginLogPageReqVO reqVO) {
PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO); PageResult<SysLoginLogDO> page = loginLogService.getLoginLogPage(reqVO);
return CommonResult.success(SysLoginLogConvert.INSTANCE.convertPage(page)); return CommonResult.success(LoginLogConvert.INSTANCE.convertPage(page));
} }
@GetMapping("/export") @GetMapping("/export")
@ApiOperation("导出登录日志 Excel") @ApiOperation("导出登录日志 Excel")
@PreAuthorize("@ss.hasPermission('system:login-log:export')") @PreAuthorize("@ss.hasPermission('system:login-log:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportLoginLog(HttpServletResponse response, @Valid SysLoginLogExportReqVO reqVO) throws IOException { public void exportLoginLog(HttpServletResponse response, @Valid LoginLogExportReqVO reqVO) throws IOException {
List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO); List<SysLoginLogDO> list = loginLogService.getLoginLogList(reqVO);
// 拼接数据 // 拼接数据
List<SysLoginLogExcelVO> data = SysLoginLogConvert.INSTANCE.convertList(list); List<LoginLogExcelVO> data = LoginLogConvert.INSTANCE.convertList(list);
// 输出 // 输出
ExcelUtils.write(response, "登录日志.xls", "数据列表", SysLoginLogExcelVO.class, data); ExcelUtils.write(response, "登录日志.xls", "数据列表", LoginLogExcelVO.class, data);
} }
} }

View File

@ -1,3 +1,4 @@
### 请求 /system/operate-log/demo 接口 => 成功 ### 请求 /system/operate-log/demo 接口 => 成功
GET {{baseUrl}}/system/operate-log/demo GET {{baseUrl}}/system/operate-log/demo
Authorization: Bearer {{token}} Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}

View File

@ -1,12 +1,12 @@
package cn.iocoder.yudao.module.system.controller.logger; package cn.iocoder.yudao.module.system.controller.admin.logger;
import cn.iocoder.yudao.module.system.controller.logger.vo.operatelog.SysOperateLogExcelVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExcelVO;
import cn.iocoder.yudao.module.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExportReqVO;
import cn.iocoder.yudao.module.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogPageReqVO;
import cn.iocoder.yudao.module.system.controller.logger.vo.operatelog.SysOperateLogRespVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogRespVO;
import cn.iocoder.yudao.module.system.convert.logger.SysOperateLogConvert; import cn.iocoder.yudao.module.system.convert.logger.OperateLogConvert;
import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysOperateLogDO; import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO;
import cn.iocoder.yudao.module.system.service.logger.SysOperateLogService; import cn.iocoder.yudao.module.system.service.logger.OperateLogService;
import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; 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.coreservice.modules.system.service.user.SysUserCoreService;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
@ -35,30 +35,30 @@ import java.util.Map;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Api(tags = "操作日志") @Api(tags = "管理后台 - 操作日志")
@RestController @RestController
@RequestMapping("/system/operate-log") @RequestMapping("/system/operate-log")
@Validated @Validated
public class SysOperateLogController { public class OperateLogController {
@Resource @Resource
private SysOperateLogService operateLogService; private OperateLogService operateLogService;
@Resource @Resource
private SysUserCoreService userCoreService; private SysUserCoreService userCoreService;
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("查看操作日志分页列表") @ApiOperation("查看操作日志分页列表")
@PreAuthorize("@ss.hasPermission('system:operate-log:query')") @PreAuthorize("@ss.hasPermission('system:operate-log:query')")
public CommonResult<PageResult<SysOperateLogRespVO>> pageOperateLog(@Valid SysOperateLogPageReqVO reqVO) { public CommonResult<PageResult<OperateLogRespVO>> pageOperateLog(@Valid OperateLogPageReqVO reqVO) {
PageResult<SysOperateLogDO> pageResult = operateLogService.getOperateLogPage(reqVO); PageResult<OperateLogDO> pageResult = operateLogService.getOperateLogPage(reqVO);
// 获得拼接需要的数据 // 获得拼接需要的数据
Collection<Long> userIds = CollectionUtils.convertList(pageResult.getList(), SysOperateLogDO::getUserId); Collection<Long> userIds = CollectionUtils.convertList(pageResult.getList(), OperateLogDO::getUserId);
Map<Long, SysUserDO> userMap = userCoreService.getUserMap(userIds); Map<Long, SysUserDO> userMap = userCoreService.getUserMap(userIds);
// 拼接数据 // 拼接数据
List<SysOperateLogRespVO> list = new ArrayList<>(pageResult.getList().size()); List<OperateLogRespVO> list = new ArrayList<>(pageResult.getList().size());
pageResult.getList().forEach(operateLog -> { pageResult.getList().forEach(operateLog -> {
SysOperateLogRespVO respVO = SysOperateLogConvert.INSTANCE.convert(operateLog); OperateLogRespVO respVO = OperateLogConvert.INSTANCE.convert(operateLog);
list.add(respVO); list.add(respVO);
// 拼接用户信息 // 拼接用户信息
MapUtils.findAndThen(userMap, operateLog.getUserId(), user -> respVO.setUserNickname(user.getNickname())); MapUtils.findAndThen(userMap, operateLog.getUserId(), user -> respVO.setUserNickname(user.getNickname()));
@ -70,16 +70,16 @@ public class SysOperateLogController {
@GetMapping("/export") @GetMapping("/export")
@PreAuthorize("@ss.hasPermission('system:operate-log:export')") @PreAuthorize("@ss.hasPermission('system:operate-log:export')")
@OperateLog(type = EXPORT) @OperateLog(type = EXPORT)
public void exportOperateLog(HttpServletResponse response, @Valid SysOperateLogExportReqVO reqVO) throws IOException { public void exportOperateLog(HttpServletResponse response, @Valid OperateLogExportReqVO reqVO) throws IOException {
List<SysOperateLogDO> list = operateLogService.getOperateLogs(reqVO); List<OperateLogDO> list = operateLogService.getOperateLogs(reqVO);
// 获得拼接需要的数据 // 获得拼接需要的数据
Collection<Long> userIds = CollectionUtils.convertList(list, SysOperateLogDO::getUserId); Collection<Long> userIds = CollectionUtils.convertList(list, OperateLogDO::getUserId);
Map<Long, SysUserDO> userMap = userCoreService.getUserMap(userIds); Map<Long, SysUserDO> userMap = userCoreService.getUserMap(userIds);
// 拼接数据 // 拼接数据
List<SysOperateLogExcelVO> excelDataList = SysOperateLogConvert.INSTANCE.convertList(list, userMap); List<OperateLogExcelVO> excelDataList = OperateLogConvert.INSTANCE.convertList(list, userMap);
// 输出 // 输出
ExcelUtils.write(response, "操作日志.xls", "数据列表", SysOperateLogExcelVO.class, excelDataList); ExcelUtils.write(response, "操作日志.xls", "数据列表", OperateLogExcelVO.class, excelDataList);
} }
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -13,7 +13,7 @@ import javax.validation.constraints.Size;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class SysLoginLogBaseVO { public class LoginLogBaseVO {
@ApiModelProperty(value = "日志类型", required = true, example = "1", notes = "参见 SysLoginLogTypeEnum 枚举类") @ApiModelProperty(value = "日志类型", required = true, example = "1", notes = "参见 SysLoginLogTypeEnum 枚举类")
@NotNull(message = "日志类型不能为空") @NotNull(message = "日志类型不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@ -12,7 +12,7 @@ import java.util.Date;
* 登录日志 Excel 导出响应 VO * 登录日志 Excel 导出响应 VO
*/ */
@Data @Data
public class SysLoginLogExcelVO { public class LoginLogExcelVO {
@ExcelProperty("日志主键") @ExcelProperty("日志主键")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,9 +9,9 @@ import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("登录日志分页列表 Request VO") @ApiModel("管理后台 - 登录日志分页列表 Request VO")
@Data @Data
public class SysLoginLogExportReqVO { public class LoginLogExportReqVO {
@ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模拟匹配") @ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模拟匹配")
private String userIp; private String userIp;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -11,10 +11,10 @@ import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("登录日志分页列表 Request VO") @ApiModel("管理后台 - 登录日志分页列表 Request VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class SysLoginLogPageReqVO extends PageParam { public class LoginLogPageReqVO extends PageParam {
@ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模拟匹配") @ApiModelProperty(value = "用户 IP", example = "127.0.0.1", notes = "模拟匹配")
private String userIp; private String userIp;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.loginlog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,11 +9,11 @@ import lombok.ToString;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
@ApiModel("登录日志 Response VO") @ApiModel("管理后台 - 登录日志 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class SysLoginLogRespVO extends SysLoginLogBaseVO { public class LoginLogRespVO extends LoginLogBaseVO {
@ApiModelProperty(value = "日志编号", required = true, example = "1024") @ApiModelProperty(value = "日志编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -13,7 +13,7 @@ import java.util.Map;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class SysOperateLogBaseVO { public class OperateLogBaseVO {
@ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab") @ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab")
@NotEmpty(message = "链路追踪编号不能为空") @NotEmpty(message = "链路追踪编号不能为空")

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
@ -12,7 +12,7 @@ import java.util.Date;
* 操作日志 Excel 导出响应 VO * 操作日志 Excel 导出响应 VO
*/ */
@Data @Data
public class SysOperateLogExcelVO { public class OperateLogExcelVO {
@ExcelProperty("日志编号") @ExcelProperty("日志编号")
private Long id; private Long id;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -9,9 +9,9 @@ import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("操作日志分页列表 Request VO") @ApiModel("管理后台 - 操作日志分页列表 Request VO")
@Data @Data
public class SysOperateLogExportReqVO { public class OperateLogExportReqVO {
@ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配") @ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配")
private String module; private String module;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog;
import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -10,9 +10,9 @@ import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("操作日志分页列表 Request VO") @ApiModel("管理后台 - 操作日志分页列表 Request VO")
@Data @Data
public class SysOperateLogPageReqVO extends PageParam { public class OperateLogPageReqVO extends PageParam {
@ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配") @ApiModelProperty(value = "操作模块", example = "订单", notes = "模拟匹配")
private String module; private String module;

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.logger.vo.operatelog; package cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -6,11 +6,11 @@ import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.ToString; import lombok.ToString;
@ApiModel("操作日志 Response VO") @ApiModel("管理后台 - 操作日志 Response VO")
@Data @Data
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true) @ToString(callSuper = true)
public class SysOperateLogRespVO extends SysOperateLogBaseVO { public class OperateLogRespVO extends OperateLogBaseVO {
@ApiModelProperty(value = "日志编号", required = true, example = "1024") @ApiModelProperty(value = "日志编号", required = true, example = "1024")
private Long id; private Long id;

View File

@ -1,13 +1,13 @@
package cn.iocoder.yudao.module.system.controller.notice; package cn.iocoder.yudao.module.system.controller.admin.notice;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.admin.notice.vo.NoticeCreateReqVO;
import cn.iocoder.yudao.module.system.controller.notice.vo.SysNoticePageReqVO; import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticePageReqVO;
import cn.iocoder.yudao.module.system.controller.notice.vo.SysNoticeRespVO; import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeRespVO;
import cn.iocoder.yudao.module.system.controller.notice.vo.SysNoticeUpdateReqVO; import cn.iocoder.yudao.module.system.controller.admin.notice.vo.NoticeUpdateReqVO;
import cn.iocoder.yudao.module.system.convert.notice.SysNoticeConvert; import cn.iocoder.yudao.module.system.convert.notice.NoticeConvert;
import cn.iocoder.yudao.module.system.service.notice.SysNoticeService; import cn.iocoder.yudao.module.system.service.notice.NoticeService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -20,19 +20,19 @@ import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Api(tags = "通知公告") @Api(tags = "管理后台 - 通知公告")
@RestController @RestController
@RequestMapping("/system/notice") @RequestMapping("/system/notice")
@Validated @Validated
public class SysNoticeController { public class NoticeController {
@Resource @Resource
private SysNoticeService noticeService; private NoticeService noticeService;
@PostMapping("/create") @PostMapping("/create")
@ApiOperation("创建通知公告") @ApiOperation("创建通知公告")
@PreAuthorize("@ss.hasPermission('system:notice:create')") @PreAuthorize("@ss.hasPermission('system:notice:create')")
public CommonResult<Long> createNotice(@Valid @RequestBody SysNoticeCreateReqVO reqVO) { public CommonResult<Long> createNotice(@Valid @RequestBody NoticeCreateReqVO reqVO) {
Long noticeId = noticeService.createNotice(reqVO); Long noticeId = noticeService.createNotice(reqVO);
return success(noticeId); return success(noticeId);
} }
@ -40,7 +40,7 @@ public class SysNoticeController {
@PutMapping("/update") @PutMapping("/update")
@ApiOperation("修改通知公告") @ApiOperation("修改通知公告")
@PreAuthorize("@ss.hasPermission('system:notice:update')") @PreAuthorize("@ss.hasPermission('system:notice:update')")
public CommonResult<Boolean> updateNotice(@Valid @RequestBody SysNoticeUpdateReqVO reqVO) { public CommonResult<Boolean> updateNotice(@Valid @RequestBody NoticeUpdateReqVO reqVO) {
noticeService.updateNotice(reqVO); noticeService.updateNotice(reqVO);
return success(true); return success(true);
} }
@ -57,16 +57,16 @@ public class SysNoticeController {
@GetMapping("/page") @GetMapping("/page")
@ApiOperation("获取通知公告列表") @ApiOperation("获取通知公告列表")
@PreAuthorize("@ss.hasPermission('system:notice:query')") @PreAuthorize("@ss.hasPermission('system:notice:query')")
public CommonResult<PageResult<SysNoticeRespVO>> pageNotices(@Validated SysNoticePageReqVO reqVO) { public CommonResult<PageResult<NoticeRespVO>> pageNotices(@Validated NoticePageReqVO reqVO) {
return success(SysNoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO))); return success(NoticeConvert.INSTANCE.convertPage(noticeService.pageNotices(reqVO)));
} }
@GetMapping("/get") @GetMapping("/get")
@ApiOperation("获得通知公告") @ApiOperation("获得通知公告")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
@PreAuthorize("@ss.hasPermission('system:notice:query')") @PreAuthorize("@ss.hasPermission('system:notice:query')")
public CommonResult<SysNoticeRespVO> getNotice(@RequestParam("id") Long id) { public CommonResult<NoticeRespVO> getNotice(@RequestParam("id") Long id) {
return success(SysNoticeConvert.INSTANCE.convert(noticeService.getNotice(id))); return success(NoticeConvert.INSTANCE.convert(noticeService.getNotice(id)));
} }
} }

View File

@ -1,4 +1,4 @@
package cn.iocoder.yudao.module.system.controller.notice.vo; package cn.iocoder.yudao.module.system.controller.admin.notice.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -12,7 +12,7 @@ import javax.validation.constraints.Size;
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成 * 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/ */
@Data @Data
public class SysNoticeBaseVO { public class NoticeBaseVO {
@ApiModelProperty(value = "公告标题", required = true, example = "小博主") @ApiModelProperty(value = "公告标题", required = true, example = "小博主")
@NotBlank(message = "公告标题不能为空") @NotBlank(message = "公告标题不能为空")

View File

@ -0,0 +1,11 @@
package cn.iocoder.yudao.module.system.controller.admin.notice.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ApiModel("管理后台 - 通知公告创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
public class NoticeCreateReqVO extends NoticeBaseVO {
}

Some files were not shown because too many files have changed in this diff Show More