Many2One\350\267\250App\345\256\211\350\243\205.md
... ...
@@ -64,31 +64,6 @@ public class TestLog extends BaseModel {
64 64
```
65 65
66 66
67
-
68
-## 3.ManyToOne关联非ID字段,比如关联code字段
69
-
70
-之前的ManyToOne默认只能是关联ID字段,现在可以关联code等非ID字段
71
-示例
72
-
73
-**通过注解referencedProperty指定任意字段:**
74
-
75
-```java
76
- @ManyToOne(displayName = "2单选异步获取Many2one", cascade = {CascadeType.DEL_SET_NULL})
77
- @JoinColumn(name = "org_id", referencedProperty = "orgCode")
78
- private TestOrg org;
79
-
80
- //引擎内置的base app的模型可以不指定app
81
- @ManyToOne(displayName = "组织", targetModel = "rbac_organization")
82
- @JoinColumn(name = "org_code", referencedProperty = "code")
83
- private Map<String, Object> organization;
84
-
85
- //如果明确知道是跨app安装,需要指定app.modelname,
86
- @ManyToOne(displayName = "组织", targetModel = "mbm-main.res_enterprise")
87
- @JoinColumn(name = "org_code", referencedProperty = "code")
88
- private Map<String, Object> enterprise;
89
-
90
-```
91
-
92 67
## 3.ManyToOne关联非ID字段,比如关联code字段
93 68
94 69
之前的ManyToOne默认只能是关联ID字段,现在可以关联code等非ID字段
... ...
@@ -117,7 +92,7 @@ public class TestLog extends BaseModel {
117 92
118 93
119 94
```java
120
- 1.Many2one的用法 ,不需要使用select属性
95
+ 4.1.Many2one的用法 ,不需要使用select属性
121 96
122 97
123 98
@@Model(name = "TestUser", description = "用户")
... ...
@@ -150,7 +125,7 @@ public class TestOrg extends BaseModel<TestOrg> {
150 125
151 126
152 127
153
-2.ManyToMany
128
+4.2.ManyToMany
154 129
155 130
@ManyToMany
156 131
@JoinTable(name = "role_user", joinColumns = @JoinColumn(name = "user_id", nullable = false),