shichongfu
2023-04-25 ce0b49552668d3331055e2b1a1447a743dc54939
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
package com.product.admin.entity;
 
import com.beust.jcommander.internal.Sets;
import com.google.common.collect.Maps;
import com.product.admin.config.CmnConst;
import com.product.common.lang.StringUtils;
import com.product.core.entity.FieldSetEntity;
 
import java.io.Serializable;
import java.util.*;
 
/**
 * @author cheng
 * @desc 菜单详情
 * @Date 2021年11月15日18:20:20
 */
public class MenuEntity implements Serializable, Cloneable, Comparable {
 
    public static final long serialVersionUID = 1L;
 
    private MenuTreeEntity.MenuArray children;
 
    /**
     * 菜单名称
     */
    private String menu_name;
    /**
     * 门户uuid
     */
    private String portal_uuid;
    /**
     * 功能uuid
     */
    private String function_uuid;
    /**
     * 菜单描述
     */
    private String menu_description;
    /**
     * 菜单颜色
     */
    private String menu_color;
 
//    private String menu_route_component;
    /**
     * 菜单编码
     */
    private String tricode;
    /**
     * 菜单上级编码
     */
    private String tricode_parent;
    /**
     * 菜单图标
     */
    private String menu_icon;
    /**
     * 是否显示
     */
    private boolean show;
    /**
     * 菜单排序
     */
    private Integer sequence;
    /**
     * 功能类型
     */
    private String function_type;
    /**
     * 功能名称
     */
    private String function_name;
    /**
     * 表uuid
     */
    private String table_uuid;
    /**
     * 按钮uuid
     */
    private String button_uuid;
    /**
     * 路由名称
     */
    private String route_name;
    /**
     * 页面类型
     */
    private Integer page_type;
    /**
     * mvc页面表uuid
     */
    private String mvc_page_uuid;
    /**
     * 页面地址
     */
    private String page_url;
    /**
     * 菜单uuid
     */
    private String menu_uuid;
 
 
    private Set<String> roleUuids;
 
    private boolean alwaysShow;
 
    private String redirect;
 
    private String component;
 
    private boolean hidden;
 
    private String name;
 
    private String path;
 
 
    private Map<String, Object> meta = Maps.newHashMap();
 
 
    public void setMenu_name(String menu_name) {
        this.menu_name = menu_name;
    }
 
    public void setPortal_uuid(String portal_uuid) {
        this.portal_uuid = portal_uuid;
    }
 
    public void setFunction_uuid(String function_uuid) {
        this.function_uuid = function_uuid;
    }
 
    public void setMenu_description(String menu_description) {
        this.menu_description = menu_description;
    }
 
    public void setMenu_color(String menu_color) {
        this.menu_color = menu_color;
    }
 
    public void setTricode(String tricode) {
        this.tricode = tricode;
    }
 
    public void setTricode_parent(String tricode_parent) {
        this.tricode_parent = tricode_parent;
    }
 
    public void setMenu_icon(String menu_icon) {
        this.menu_icon = menu_icon;
    }
 
    public void setShow(boolean show) {
        this.show = show;
    }
 
    public void setSequence(Integer sequence) {
        this.sequence = sequence;
    }
 
    public void setFunction_type(String function_type) {
        this.function_type = function_type;
    }
 
    public void setFunction_name(String function_name) {
        this.function_name = function_name;
    }
 
    public void setTable_uuid(String table_uuid) {
        this.table_uuid = table_uuid;
    }
 
    public void setButton_uuid(String button_uuid) {
        this.button_uuid = button_uuid;
    }
 
    public void setRoute_name(String route_name) {
        this.route_name = route_name;
    }
 
    public void setPage_type(Integer page_type) {
        this.page_type = page_type;
    }
 
    public void setMvc_page_uuid(String mvc_page_uuid) {
        this.mvc_page_uuid = mvc_page_uuid;
    }
 
    public void setPage_url(String page_url) {
        this.page_url = page_url;
    }
 
    public void setMenu_uuid(String menu_uuid) {
        this.menu_uuid = menu_uuid;
    }
 
    public void setRoleUuids(Set<String> roleUuids) {
        this.roleUuids = roleUuids;
    }
 
    public void setAlwaysShow(boolean alwaysShow) {
        this.alwaysShow = alwaysShow;
    }
 
    public void setRedirect(String redirect) {
        this.redirect = redirect;
    }
 
    public void setComponent(String component) {
        this.component = component;
    }
 
    public void setHidden(boolean hidden) {
        this.hidden = hidden;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public void setPath(String path) {
        this.path = path;
    }
 
    public void setMeta(Map<String, Object> meta) {
        this.meta = meta;
    }
 
    @Override
    public MenuEntity clone() {
        try {
            return (MenuEntity) super.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            return null;
        }
    }
 
    public MenuEntity(FieldSetEntity fse) {
        reload(fse);
    }
 
 
    public void reload(FieldSetEntity fse) {
        this.page_type = fse.getInteger("page_type");
        this.page_url = fse.getString("page_url");
        this.button_uuid = fse.getString("button_uuid");
        this.function_name = fse.getString("function_name");
        this.function_uuid = fse.getString("function_uuid");
        this.menu_color = fse.getString("menu_color");
        this.menu_description = fse.getString("menu_description");
        this.menu_icon = fse.getString("menu_icon");
        this.menu_name = fse.getString("menu_name");
        this.mvc_page_uuid = fse.getString("mvc_page_type");
        this.portal_uuid = fse.getString("portal_uuid");
        this.route_name = fse.getString("route_name");
        this.sequence = fse.getInteger("sequence");
        this.show = fse.getBoolean("is_show");
        this.table_uuid = fse.getString("table_uuid");
        this.tricode = fse.getString("tricode");
        this.tricode_parent = fse.getString("tricode_parent");
        this.menu_uuid = fse.getString("menu_uuid");
        this.function_type = fse.getString("function_type");
        if (!StringUtils.isEmpty(fse.getString("role_uuid"))) {
            if (this.roleUuids == null) {
                this.roleUuids = Sets.newHashSet();
            }
            this.roleUuids.addAll(Arrays.asList(fse.getString("role_uuid").split(",")));
        }
        String function_uuid = this.getFunction_uuid();
        String path = "";
        String name = "";
        String component = "";
        if (this.IsCatalogue()) {
            // 目录
            this.alwaysShow = this.IsCatalogue();
            this.redirect = "noRedirect";
            path += "/" + getTricode();
            if (StringUtils.isEmpty(getTricode_parent())) {
                component = "Layout";
            }
        } else {
            String button_uuid = getButton_uuid();
            path = "/" + button_uuid;
            name = getRoute_name();
            component = getPage_url();
 
        }
        this.hidden = false;
        this.name = name;
        this.path = path;
        this.component = component;
        Integer page_type = getPage_type();
        meta.put("title", getMenu_name());
        meta.put(CmnConst.ICON, getMenu_icon());
        meta.put("noCache", page_type != null && page_type == 1);
        meta.put("group", function_uuid);
    }
 
    public void addChildrenMenu(MenuEntity menuEntity) {
        if (children == null) {
            children = MenuTreeEntity.newArrayList();
        }
        children.add(menuEntity);
    }
 
    /**
     * 是否目录
     *
     * @return
     */
    public boolean IsCatalogue() {
        return StringUtils.isEmpty(this.function_uuid);
    }
 
    public MenuTreeEntity.MenuArray getChildren() {
        return children;
    }
 
    public void setChildren(MenuTreeEntity.MenuArray children) {
        this.children = children;
    }
 
    public String getMenu_name() {
        return menu_name;
    }
 
    public String getPortal_uuid() {
        return portal_uuid;
    }
 
    public String getFunction_uuid() {
        return function_uuid;
    }
 
    public String getMenu_description() {
        return menu_description;
    }
 
    public String getMenu_color() {
        return menu_color;
    }
 
    public String getTricode() {
        return tricode;
    }
 
    public String getTricode_parent() {
        return tricode_parent;
    }
 
    public String getMenu_icon() {
        return menu_icon;
    }
 
    public boolean isShow() {
        return show;
    }
 
    public Integer getSequence() {
        return sequence;
    }
 
    public String getFunction_type() {
        return function_type;
    }
 
    public String getFunction_name() {
        return function_name;
    }
 
    public String getTable_uuid() {
        return table_uuid;
    }
 
    public String getButton_uuid() {
        return button_uuid;
    }
 
    public String getRoute_name() {
        return route_name;
    }
 
    public Integer getPage_type() {
        return page_type;
    }
 
    public String getMvc_page_uuid() {
        return mvc_page_uuid;
    }
 
    public String getPage_url() {
        return page_url;
    }
 
    public String getMenu_uuid() {
        return menu_uuid;
    }
 
    public Set<String> getRoleUuids() {
        return roleUuids;
    }
 
    public boolean isAlwaysShow() {
        return alwaysShow;
    }
 
    public String getRedirect() {
        return redirect;
    }
 
    public String getComponent() {
        return component;
    }
 
    public boolean isHidden() {
        return hidden;
    }
 
    public String getName() {
        return name;
    }
 
    public String getPath() {
        return path;
    }
 
    public Map<String, Object> getMeta() {
        return meta;
    }
 
    @Override
    public int compareTo(Object o) {
        MenuEntity a = (MenuEntity) o;
        MenuEntity b = this;
        return a.getTricode().length() == b.getTricode().length() ?
                (a.getSequence() == b.getSequence() ?
                        a.getTricode().compareTo(b.getTricode()) : a.getSequence() - b.getSequence()) :
                a.getTricode().length() - b.getTricode().length();
    }
}