Bläddra i källkod

增加字段中文swagger说明

yaoyi 1 månad sedan
förälder
incheckning
767e459c95

+ 14 - 0
hr-api/hr-api-system/src/main/java/com/hr/system/api/domain/SysDept.java

@@ -6,6 +6,8 @@ import javax.validation.constraints.Email;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
+
+import io.swagger.v3.oas.annotations.media.Schema;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.hr.common.core.web.domain.BaseEntity;
@@ -15,44 +17,56 @@ import com.hr.common.core.web.domain.BaseEntity;
  * 
  * @author ruoyi
  */
+@Schema(description = "组织机构")
 public class SysDept extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
     /** 部门ID */
+    @Schema(description = "部门ID")
     private Long deptId;
 
     /**组织编码*/
 //    private String orgCode;
 
     /** 父部门ID */
+    @Schema(description = "父部门ID")
     private Long parentId;
 
     /** 祖级列表 */
+    @Schema(description = "祖级列表")
     private String ancestors;
 
     /** 部门名称 */
+    @Schema(description = "部门名称")
     private String deptName;
 
     /** 显示顺序 */
+    @Schema(description = "显示顺序")
     private Integer orderNum;
 
     /** 负责人 */
+    @Schema(description = "负责人")
     private String leader;
 
     /** 联系电话 */
+    @Schema(description = "联系电话")
     private String phone;
 
     /** 邮箱 */
+    @Schema(description = "邮箱")
     private String email;
 
     /** 部门状态:0正常,1停用 */
+    @Schema(description = "部门状态:0正常,1停用 ")
     private String status;
 
     /** 删除标志(0代表存在 2代表删除) */
+    @Schema(description = "删除标志(0代表存在 2代表删除)")
     private String delFlag;
 
     /** 父部门名称 */
+    @Schema(description = "父部门名称")
     private String parentName;
 
 

+ 12 - 0
hr-api/hr-api-system/src/main/java/com/hr/system/api/domain/SysDictData.java

@@ -2,6 +2,8 @@ package com.hr.system.api.domain;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
+
+import io.swagger.v3.oas.annotations.media.Schema;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.hr.common.core.annotation.Excel;
@@ -14,41 +16,51 @@ import com.hr.common.core.web.domain.BaseEntity;
  * 
  * @author ruoyi
  */
+@Schema(description = "字典")
 public class SysDictData extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
     /** 字典编码 */
+    @Schema(description = "字典编码")
     @Excel(name = "字典编码", cellType = ColumnType.NUMERIC)
     private Long dictCode;
 
     /** 字典排序 */
+    @Schema(description = "字典排序")
     @Excel(name = "字典排序", cellType = ColumnType.NUMERIC)
     private Long dictSort;
 
     /** 字典标签 */
+    @Schema(description = "字典标签")
     @Excel(name = "字典标签")
     private String dictLabel;
 
     /** 字典键值 */
+    @Schema(description = "字典键值")
     @Excel(name = "字典键值")
     private String dictValue;
 
     /** 字典类型 */
+    @Schema(description = "字典类型")
     @Excel(name = "字典类型")
     private String dictType;
 
     /** 样式属性(其他样式扩展) */
+    @Schema(description = "样式属性(其他样式扩展)")
     private String cssClass;
 
     /** 表格字典样式 */
+    @Schema(description = "表格字典样式")
     private String listClass;
 
     /** 是否默认(Y是 N否) */
+    @Schema(description = "是否默认(Y是 N否)")
     @Excel(name = "是否默认", readConverterExp = "Y=是,N=否")
     private String isDefault;
 
     /** 状态(0正常 1停用) */
+    @Schema(description = "状态(0正常 1停用)")
     @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
     private String status;
 

+ 7 - 0
hr-api/hr-api-system/src/main/java/com/hr/system/api/domain/SysDictType.java

@@ -3,6 +3,8 @@ package com.hr.system.api.domain;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
+
+import io.swagger.v3.oas.annotations.media.Schema;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.hr.common.core.annotation.Excel;
@@ -14,23 +16,28 @@ import com.hr.common.core.web.domain.BaseEntity;
  * 
  * @author ruoyi
  */
+@Schema(description = "字典类型")
 public class SysDictType extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
     /** 字典主键 */
+    @Schema(description = "字典主键")
     @Excel(name = "字典主键", cellType = ColumnType.NUMERIC)
     private Long dictId;
 
     /** 字典名称 */
+    @Schema(description = "字典名称")
     @Excel(name = "字典名称")
     private String dictName;
 
     /** 字典类型 */
+    @Schema(description = "字典类型")
     @Excel(name = "字典类型")
     private String dictType;
 
     /** 状态(0正常 1停用) */
+    @Schema(description = "状态(0正常 1停用)")
     @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
     private String status;
 

+ 19 - 0
hr-api/hr-api-system/src/main/java/com/hr/system/api/domain/SysRole.java

@@ -4,6 +4,8 @@ import java.util.Set;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
+
+import io.swagger.v3.oas.annotations.media.Schema;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.hr.common.core.annotation.Excel;
@@ -15,66 +17,83 @@ import com.hr.common.core.web.domain.BaseEntity;
  * 
  * @author ruoyi
  */
+@Schema(description = "角色")
 public class SysRole extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
     /** 角色ID */
     @Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
+    @Schema(description = "角色序号")
     private Long roleId;
 
     /** 角色名称 */
     @Excel(name = "角色名称")
+    @Schema(description = "角色名称")
     private String roleName;
 
     /** 角色权限 */
     @Excel(name = "角色权限")
+    @Schema(description = "角色权限")
     private String roleKey;
 
 
     @Excel(name = "角色url权限")
+    @Schema(description = "角色url权限")
     private String roleUrlmatchKey;
 
 
 
     @Excel(name = "角色业务组织类型")
+    @Schema(description = "角色业务组织类型")
     private String roleDeptType;
 //    @Excel(name = "角色业务组织类型")
 //    private String roleDeptType;
     @Excel(name = "所属部门Id")
+    @Schema(description = "所属部门Id")
     private Integer deptId;
 
     /** 角色排序 */
     @Excel(name = "角色排序")
+    @Schema(description = "角色排序")
     private Integer roleSort;
 
     /** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
+    @Schema(description = "数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限)")
     @Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
     private String dataScope;
 
     /** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */
+    @Schema(description = "菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示)")
     private boolean menuCheckStrictly;
 
     /** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */
+    @Schema(description = "部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 )")
     private boolean deptCheckStrictly;
 
     /** 角色状态(0正常 1停用) */
+    @Schema(description = "角色状态(0正常 1停用)")
     @Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
     private String status;
 
     /** 删除标志(0代表存在 2代表删除) */
+    @Schema(description = "删除标志(0代表存在 2代表删除")
     private String delFlag;
 
     /** 用户是否存在此角色标识 默认不存在 */
+    @Schema(description = "用户是否存在此角色标识 默认不存在")
     private boolean flag = false;
 
     /** 菜单组 */
+    @Schema(description = "菜单组")
     private Long[] menuIds;
 
     /** 部门组(数据权限) */
+    @Schema(description = "部门组(数据权限)")
     private Long[] deptIds;
 
     /** 角色菜单权限 */
+    @Schema(description = "角色菜单权限")
     private Set<String> permissions;
 
     public SysRole()

+ 5 - 1
hr-modules/hr-system/src/main/java/com/hr/system/controller/SysMenuController.java

@@ -3,6 +3,7 @@ package com.hr.system.controller;
 import java.util.List;
 
 import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -186,7 +187,10 @@ public class SysMenuController extends BaseController
             summary = "获取路由信息"
     )
     @GetMapping("getRouters/{systemcode}")
-    public AjaxResult getRouters(@PathVariable("systemcode") String systemcode)
+    public AjaxResult getRouters(@Parameter(
+            description = "系统编码",
+            example = "authPerm")
+    @PathVariable("systemcode") String systemcode)
     {
         Long userId = SecurityUtils.getUserId();
         List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId,systemcode);

+ 1 - 1
hr-modules/hr-system/src/main/java/com/hr/system/controller/SysSystemController.java

@@ -39,7 +39,7 @@ public class SysSystemController extends BaseController{
             summary = "系统列表"
     )
     @GetMapping("/list")
-    public AjaxResult list(SysDept dept)
+    public AjaxResult list()
     {
         List<SysBusinessSystem> sysBusinessSyslist = iSysSystemService.selectBusinessSystemList();
         return success(sysBusinessSyslist);

+ 3 - 0
hr-modules/hr-system/src/main/java/com/hr/system/controller/SysUserController.java

@@ -325,6 +325,9 @@ public class SysUserController extends BaseController
     /**
      * 获取当前用户信息
      */
+    @Operation(
+            summary = "登录远程调用获取用户信息"
+    )
     @InnerAuth
     @GetMapping("/info/{username}")
     public R<LoginUser> info(@PathVariable("username") String username)

+ 6 - 1
hr-modules/hr-system/src/main/java/com/hr/system/domain/SysBusinessSystem.java

@@ -2,6 +2,7 @@ package com.hr.system.domain;
 
 import com.hr.common.core.annotation.Excel;
 import com.hr.common.core.web.domain.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
@@ -15,16 +16,20 @@ import java.util.List;
  * @author yaoy
  * @createTime 2025/9/26 10:43
  **/
+@Schema(description = "系统")
 public class SysBusinessSystem
     extends BaseEntity
     {
         /** 菜单ID */
+        @Schema(description = "系统Id")
         private Long sysId;
 
-        /** 菜单名称 */
+        /** 系统名称 */
+        @Schema(description = "系统名称")
         private String sysName;
 
         /** 系统编码 */
+        @Schema(description = "系统编码")
         private String sysCode;
 
         public Long getSysId() {

+ 23 - 2
hr-modules/hr-system/src/main/java/com/hr/system/domain/SysMenu.java

@@ -5,6 +5,8 @@ import java.util.List;
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
 import javax.validation.constraints.Size;
+
+import io.swagger.v3.oas.annotations.media.Schema;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.hr.common.core.web.domain.BaseEntity;
@@ -14,65 +16,84 @@ import com.hr.common.core.web.domain.BaseEntity;
  * 
  * @author ruoyi
  */
+@Schema(description = "菜单")
 public class SysMenu extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
     /** 菜单ID */
+    @Schema(description = "菜单ID")
     private Long menuId;
 
     /** 菜单名称 */
+    @Schema(description = "菜单名称")
     private String menuName;
 
     /** 父菜单名称 */
+    @Schema(description = "父菜单名称")
     private String parentName;
 
     /** 父菜单ID */
+    @Schema(description = "父菜单ID")
     private Long parentId;
 
     /** 显示顺序 */
+    @Schema(description = "显示顺序")
     private Integer orderNum;
 
     /** 路由地址 */
+    @Schema(description = "路由地址")
     private String path;
 
     /** 组件路径 */
+    @Schema(description = "组件路径")
     private String component;
 
     /** 路由参数 */
+    @Schema(description = "路由参数")
     private String query;
 
     /** 路由名称,默认和路由地址相同的驼峰格式(注意:因为vue3版本的router会删除名称相同路由,为避免名字的冲突,特殊情况可以自定义) */
+    @Schema(description = "路由名称,默认和路由地址相同的驼峰格式(注意:因为vue3版本的router会删除名称相同路由,为避免名字的冲突,特殊情况可以自定义)")
     private String routeName;
 
     /** 是否为外链(0是 1否) */
+    @Schema(description = "是否为外链(0是 1否)")
     private String isFrame;
 
     /** 是否缓存(0缓存 1不缓存) */
+    @Schema(description = "是否缓存(0缓存 1不缓存))")
     private String isCache;
 
     /** 类型(M目录 C菜单 F按钮) */
+    @Schema(description = "类型(M目录 C菜单 F按钮)")
     private String menuType;
 
     /** 显示状态(0显示 1隐藏) */
+    @Schema(description = "显示状态(0显示 1隐藏)")
     private String visible;
     
     /** 菜单状态(0正常 1停用) */
+    @Schema(description = "菜单状态(0正常 1停用)")
     private String status;
 
+    @Schema(description = "网关访问地址")
     private String url;
-
+    @Schema(description = "网关权限")
     private String urlmatch;
-
+    @Schema(description = "系统编码")
     private String systemCode;
 
     /** 权限字符串 */
+    @Schema(description = "权限字符串")
     private String perms;
 
     /** 菜单图标 */
+    @Schema(description = "菜单图标")
     private String icon;
 
     /** 子菜单 */
+    @Schema(description = "子菜单")
     private List<SysMenu> children = new ArrayList<SysMenu>();
 
     public Long getMenuId()

+ 4 - 0
hr-modules/hr-system/src/main/java/com/hr/system/domain/SysUserRole.java

@@ -1,5 +1,6 @@
 package com.hr.system.domain;
 
+import io.swagger.v3.oas.annotations.media.Schema;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
@@ -8,12 +9,15 @@ import org.apache.commons.lang3.builder.ToStringStyle;
  * 
  * @author ruoyi
  */
+@Schema(description = "角色")
 public class SysUserRole
 {
     /** 用户ID */
+    @Schema(description = "用户ID")
     private Long userId;
     
     /** 角色ID */
+    @Schema(description = "角色ID")
     private Long roleId;
 
     public Long getUserId()