2222 * @author Lemon
2323 */
2424public class Join {
25-
25+
2626 private String path ;
27-
27+
2828 private String originKey ;
2929 private String originValue ;
3030
@@ -37,7 +37,7 @@ public class Join {
3737 private String targetKey ; // userId
3838
3939 private JSONObject outter ;
40-
40+
4141 private SQLConfig joinConfig ;
4242 private SQLConfig cacheConfig ;
4343 private SQLConfig outterConfig ;
@@ -61,7 +61,7 @@ public String getOriginValue() {
6161 public void setOriginValue (String originValue ) {
6262 this .originValue = originValue ;
6363 }
64-
64+
6565 public String getJoinType () {
6666 return joinType ;
6767 }
@@ -125,23 +125,23 @@ public SQLConfig getCacheConfig() {
125125 public void setCacheConfig (SQLConfig cacheConfig ) {
126126 this .cacheConfig = cacheConfig ;
127127 }
128-
128+
129129 public SQLConfig getOutterConfig () {
130130 return outterConfig ;
131131 }
132132 public void setOutterConfig (SQLConfig outterConfig ) {
133133 this .outterConfig = outterConfig ;
134134 }
135135
136-
136+
137137 public void setKeyAndType (@ NotNull String originKey ) throws Exception { //id, id@, id{}@, contactIdList<>@ ...
138138 if (originKey .endsWith ("@" )) {
139139 originKey = originKey .substring (0 , originKey .length () - 1 );
140140 }
141141 else { //TODO 暂时只允许 User.id = Moment.userId 字段关联,不允许 User.id = 82001 这种
142142 throw new IllegalArgumentException (joinType + "/.../" + name + "/" + originKey + " 不合法!join:'.../refKey'" + " 中 refKey 必须以 @ 结尾!" );
143143 }
144-
144+
145145 if (originKey .endsWith ("{}" )) {
146146 setRelateType ("{}" );
147147 setKey (originKey .substring (0 , originKey .length () - 2 ));
@@ -155,25 +155,32 @@ else if (originKey.endsWith("<>")) {
155155 setKey (originKey );
156156 }
157157 }
158-
159-
160-
158+
159+
160+
161161 public boolean isSQLJoin () {
162162 return ! isAppJoin ();
163163 }
164-
164+
165165 public static boolean isSQLJoin (Join j ) {
166166 return j != null && j .isSQLJoin ();
167167 }
168-
168+
169169 public boolean isAppJoin () {
170170 return "@" .equals (getJoinType ());
171171 }
172-
172+
173173 public static boolean isAppJoin (Join j ) {
174174 return j != null && j .isAppJoin ();
175175 }
176-
176+
177+ public boolean isLeftOrRightJoin () {
178+ return "<" .equals (getJoinType ()) || ">" .equals (getJoinType ());
179+ }
180+
181+ public static boolean isLeftOrRightJoin (Join j ) {
182+ return j != null && j .isLeftOrRightJoin ();
183+ }
177184
178185
179186
0 commit comments