道路环境监测node后端和java后台代码
wangrong
2021-11-24 ac1a5f4542431c28b5865acbeb81985cefdbc2a8
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
package com.example.demo.model;
 
import com.example.demo.handler.OperationHandlerImpl;
import com.example.demo.handler.OperationHandlerImpl2;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.expr.ExprBool;
import xyz.erupt.annotation.sub_erupt.LinkTree;
import xyz.erupt.annotation.sub_erupt.RowOperation;
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.jpa.model.BaseModel;
import xyz.erupt.upms.handler.DictChoiceFetchHandler;
import xyz.erupt.upms.handler.SqlChoiceFetchHandler;
import xyz.erupt.upms.handler.ViaMenuValueCtrl;
 
import javax.persistence.*;
import java.util.Set;
 
/**
 * @author liyuepeng
 * @date 2021-01-02.
 */
@Erupt(
        name = "复杂示例",
        rowOperation = {
                @RowOperation(
                        operationHandler = OperationHandlerImpl2.class,
                        mode = RowOperation.Mode.SINGLE,
                        title = "单行操作"),
                @RowOperation(title = "多行操作",
                        show = @ExprBool(
                                exprHandler = ViaMenuValueCtrl.class,
                                params = "ComplexBtn"  //将ComplexBtn添加到菜单可控制该按钮的显示隐藏
                        ),
                        icon = "fa fa-check-square",
                        operationHandler = OperationHandlerImpl.class),
                @RowOperation(
                        eruptClass = ComplexOperator.class, //提交前需要填写该类中定义的表单
                        operationHandler = OperationHandlerImpl.class,
                        mode = RowOperation.Mode.BUTTON,
                        tip = "不依赖任何数据即可执行",
                        title = "按钮操作",
                        icon = "fa fa-google-wallet")
        },
        linkTree = @LinkTree(field = "tree")
)
@Table(name = "e_complex")
@Entity
public class Complex extends BaseModel {
 
    @EruptField(
            views = @View(title = "动态下拉列表"),
            edit = @Edit(
                    search = @Search,
                    title = "通过SQL获取下拉列表",
                    type = EditType.CHOICE,
                    desc = "动态下拉列表",
                    choiceType = @ChoiceType(
                            fetchHandler = SqlChoiceFetchHandler.class,
                            fetchHandlerParams = "select id,name from e_upms_menu"
                    ))
    )
    private String choice;
 
    @EruptField(
            views = @View(title = "字典值"),
            edit = @Edit(
                    search = @Search,
                    title = "字典值", type = EditType.CHOICE, desc = "动态获取字典项的值",
                    choiceType = @ChoiceType(
                            fetchHandler = DictChoiceFetchHandler.class,
                            fetchHandlerParams = "system" //字典编码,通过字典编码获取字典项列表
                    ))
    )
    private Long fromDict;
 
    @ManyToOne
    @EruptField(
            edit = @Edit(title = "多对一树", search = @Search, type = EditType.REFERENCE_TREE,
                    referenceTreeType = @ReferenceTreeType(id = "id", label = "name", pid = "parent.id"))
    )
    private TreeView tree;
 
    @ManyToOne
    @JoinColumn
    @EruptField(
            views = {
                    @View(title = "多对一表格", column = "title"),
            },
            edit = @Edit(title = "多对一表格", type = EditType.REFERENCE_TABLE, search = @Search,
                    referenceTableType = @ReferenceTableType(label = "title")
            )
    )
    private Article article;
 
    @Lob
    @EruptField(
            views = @View(title = "python代码", type = ViewType.CODE),
            edit = @Edit(title = "python代码编辑器", type = EditType.CODE_EDITOR, codeEditType = @CodeEditorType(language = "python"))
    )
    private String code;
 
    @OneToMany(cascade = CascadeType.ALL)
    @JoinColumn(name = "complex_id")
    @EruptField(
            edit = @Edit(title = "一对多新增", type = EditType.TAB_TABLE_ADD)
    )
    private Set<ComplexTab> complexTab;
 
    @ManyToMany
    @JoinTable(
            name = "e_complex_article",
            joinColumns = @JoinColumn(name = "complex_id", referencedColumnName = "id"),
            inverseJoinColumns = @JoinColumn(name = "article_id", referencedColumnName = "id"))
    @EruptField(
            edit = @Edit(title = "关联多篇文章", type = EditType.TAB_TABLE_REFER,
                    referenceTableType = @ReferenceTableType(label = "title"))
    )
    private Set<Article> articleTab;
 
}