wangrong
2021-11-24 130b72d6c5734f8acaac0214b6dfe5c8bfa319c3
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
package com.example.demo.model.blog;
 
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_erupt.LinkTree;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.ViewType;
import xyz.erupt.annotation.sub_field.sub_edit.*;
import xyz.erupt.upms.model.base.HyperModel;
 
import javax.persistence.Entity;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
 
/**
 * @author YuePeng
 * date 2020/12/15 12:06
 */
@Erupt(
        name = "博客管理",
        linkTree = @LinkTree(field = "blogCategory")
)
@Table(name = "blog_article")
@Entity
public class Blog extends HyperModel {
 
    @EruptField(
            views = {
                    @View(title = "标题图", type = ViewType.IMAGE)
            },
            edit = @Edit(title = "标题图", notNull = true, type = EditType.ATTACHMENT,
                    attachmentType = @AttachmentType(type = AttachmentType.Type.IMAGE))
    )
    private String image;
 
    @EruptField(
            views = @View(title = "标题"),
            edit = @Edit(title = "标题", notNull = true, search = @Search(vague = true), inputType = @InputType(fullSpan = true))
    )
    private String name;
 
//    @EruptField(
//            views = @View(title = "简介", type = ViewType.HTML),
//            edit = @Edit(title = "简介", notNull = true, search = @Search(vague = true), inputType = @InputType(fullSpan = true))
//    )
//    private String intro;
 
    @EruptField(
            views = @View(title = "是否原创"),
            edit = @Edit(title = "是否原创", notNull = true)
    )
    private Boolean original;
 
    @EruptField(
            views = @View(title = "是否发布"),
            edit = @Edit(title = "是否发布", notNull = true)
    )
    private Boolean publish;
 
    @EruptField(
            views = @View(title = "推荐等级"),
            edit = @Edit(title = "推荐等级", notNull = true, type = EditType.CHOICE,
                    choiceType = @ChoiceType(vl = {
                            @VL(value = "0", label = "正常"),
                            @VL(value = "10", label = "一级推荐"),
                            @VL(value = "20", label = "二级推荐"),
                            @VL(value = "30", label = "三级推荐")
                    }))
    )
    private Integer recommendedLevel;
 
    @ManyToOne
    @EruptField(
            views = @View(title = "分类", column = "name"),
            edit = @Edit(title = "分类", notNull = true, type = EditType.REFERENCE_TREE)
    )
    private BlogCategory blogCategory;
 
    @EruptField(
            views = @View(title = "标签", template = "value&&value.replace(/\\|/g,'<span class=\"text-red\"> | </span>')"),
            edit = @Edit(title = "标签", notNull = true, type = EditType.TAGS,
                    tagsType = @TagsType(fetchHandler = BlogTagHandler.class)
            )
    )
    private String tag;
 
    @Lob //文章内容较多定义为大文本类型
    @EruptField(
            views = @View(title = "内容", type = ViewType.HTML),
            edit = @Edit(title = "内容", notNull = true, type = EditType.HTML_EDITOR)
    )
    private String content;
 
    @EruptField(
            views = @View(title = "备注"),
            edit = @Edit(title = "备注", type = EditType.TEXTAREA)
    )
    private String remark;
 
    @EruptField(
            views = @View(title = "点击数")
    )
    private Integer clickNum = 0; //需要通过前端接口向数据库写入!
 
}