zjj
2024-05-29 e768d9f666e139cea2c40e542f6e6b50ea7fc453
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
package com.zy.asrs.common.wms.entity;
 
 
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zy.asrs.common.sys.entity.Resource;
import com.zy.asrs.common.sys.service.ResourceService;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.zy.asrs.framework.common.Cools;
import com.zy.asrs.framework.common.SpringUtils;
import com.zy.asrs.common.sys.entity.User;
import com.zy.asrs.common.sys.entity.Host;
import com.zy.asrs.common.sys.service.UserService;
import com.zy.asrs.common.sys.service.HostService;
 
import java.io.Serializable;
import java.util.Date;
 
@Data
@TableName("sys_permission")
public class Permission implements Serializable {
 
    private static final long serialVersionUID = 1L;
 
    /**
     * 编号
     */
    @ApiModelProperty(value= "编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
 
    /**
     * 权限名称
     */
    @ApiModelProperty(value= "权限名称")
    private String name;
 
    /**
     * 接口地址
     */
    @ApiModelProperty(value= "接口地址")
    private String action;
 
    /**
     * 所属菜单
     */
    @ApiModelProperty(value= "所属菜单")
    private Long resourceId;
 
    /**
     * 状态 1: 正常  0: 禁用  
     */
    @ApiModelProperty(value= "状态 1: 正常  0: 禁用  ")
    private Short status;
 
    public Permission() {}
 
    public Permission(String name,String action,Long resourceId,Short status) {
        this.name = name;
        this.action = action;
        this.resourceId = resourceId;
        this.status = status;
    }
 
//    Permission permission = new Permission(
//            null,    // 权限名称[非空]
//            null,    // 接口地址[非空]
//            null,    // 所属菜单
//            null    // 状态[非空]
//    );
 
    public String getResourceId$(){
        ResourceService service = SpringUtils.getBean(ResourceService.class);
        Resource resource = service.getById(this.resourceId);
        if (!Cools.isEmpty(resource)){
            return String.valueOf(resource.getName());
        }
        return null;
    }
 
    public String getStatus$(){
        if (null == this.status){ return null; }
        switch (this.status){
            case 1:
                return "正常";
            case 0:
                return "禁用";
            default:
                return String.valueOf(this.status);
        }
    }
 
 
}