package com.qqflow.engine.domain.system.dto; import com.qqflow.engine.domain.system.entity.SysRole; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.time.LocalDateTime; @Data @Schema(description = "角色DTO") public class RoleDTO { @Schema(description = "角色ID") private Long id; @Schema(description = "角色编码") private String roleCode; @Schema(description = "角色名称") private String roleName; @Schema(description = "登录账号") private String username; @Schema(description = "角色范围") private String roleScope; @Schema(description = "父角色ID") private Long parentId; @Schema(description = "所属部门ID") private Long deptId; @Schema(description = "所属部门名称") private String deptName; @Schema(description = "状态:0-禁用 1-正常") private Integer status; @Schema(description = "创建时间") private LocalDateTime createTime; public static RoleDTO of(SysRole role) { if (role == null) { return null; } RoleDTO dto = new RoleDTO(); dto.setId(role.getId()); dto.setRoleCode(role.getRoleCode()); dto.setRoleName(role.getRoleName()); dto.setUsername(role.getUsername()); dto.setRoleScope(role.getRoleScope()); dto.setParentId(role.getParentId()); dto.setDeptId(role.getDeptId()); dto.setStatus(role.getStatus()); dto.setCreateTime(role.getCreateTime()); return dto; } }