@@ -179,12 +179,16 @@ var CodeUtil = {
179
179
180
180
const count = isSmart ? ( value . count || 0 ) : 0 ;
181
181
const page = isSmart ? ( value . page || 0 ) : 0 ;
182
+ const query = isSmart ? ( value . query || 0 ) : 0 ;
183
+ const join = isSmart ? value . join : null ;
182
184
183
185
log ( CodeUtil . TAG , 'parseJava for count = ' + count + '; page = ' + page ) ;
184
186
185
187
if ( isSmart ) {
186
188
delete value . count ;
187
189
delete value . page ;
190
+ delete value . query ;
191
+ delete value . join ;
188
192
}
189
193
190
194
s += CodeUtil . parseJava ( key , value , depth + 1 , isSmart ) ;
@@ -196,6 +200,8 @@ var CodeUtil = {
196
200
if ( isSmart ) {
197
201
var prefix = key . substring ( 0 , key . length - 2 ) ;
198
202
s += '\n\n'
203
+ + name + '.setQuery(' + CodeUtil . QUERY_TYPE_CONSTS [ query ] + ');\n'
204
+ + name + '.setJoin("' + join + '");\n'
199
205
+ parentKey + '.putAll(' + name + '.toArray('
200
206
+ count + ', ' + page + ( prefix . length <= 0 ? '' : ', "' + prefix + '"' ) + '));' ;
201
207
} else {
@@ -216,6 +222,7 @@ var CodeUtil = {
216
222
const order = isTable ? value [ '@order' ] : null ;
217
223
const group = isTable ? value [ '@group' ] : null ;
218
224
const having = isTable ? value [ '@having' ] : null ;
225
+ const combine = isTable ? value [ '@combine' ] : null ;
219
226
const schema = isTable ? value [ '@schema' ] : null ;
220
227
const role = isTable ? value [ '@role' ] : null ;
221
228
@@ -224,6 +231,7 @@ var CodeUtil = {
224
231
delete value [ '@order' ] ;
225
232
delete value [ '@group' ] ;
226
233
delete value [ '@having' ] ;
234
+ delete value [ '@combine' ] ;
227
235
delete value [ '@schema' ] ;
228
236
delete value [ '@role' ] ;
229
237
}
@@ -236,6 +244,7 @@ var CodeUtil = {
236
244
s = order == null ? s : s + '\n' + name + '.setOrder(' + CodeUtil . getJavaValue ( name , key , order ) + ');' ;
237
245
s = group == null ? s : s + '\n' + name + '.setGroup(' + CodeUtil . getJavaValue ( name , key , group ) + ');' ;
238
246
s = having == null ? s : s + '\n' + name + '.setHaving(' + CodeUtil . getJavaValue ( name , key , having ) + ');' ;
247
+ s = combine == null ? s : s + '\n' + name + '.setCombine(' + CodeUtil . getJavaValue ( name , key , combine ) + ');' ;
239
248
s = schema == null ? s : s + '\n' + name + '.setSchema(' + CodeUtil . getJavaValue ( name , key , schema ) + ');' ;
240
249
s = role == null ? s : s + '\n' + name + '.setRole(' + CodeUtil . getJavaValue ( name , key , role ) + ');' ;
241
250
}
@@ -802,6 +811,7 @@ var CodeUtil = {
802
811
803
812
QUERY_TYPES : [ '数据' , '数量' , '全部' ] ,
804
813
QUERY_TYPE_KEYS : [ 0 , 1 , 2 ] ,
814
+ QUERY_TYPE_CONSTS : [ "JSONRequest.QUERY_TABLE" , "JSONRequest.QUERY_TOTAL" , "JSONRequest.QUERY_ALL" ] ,
805
815
REQUEST_ROLE_KEYS : [ 'UNKNOWN' , 'LOGIN' , 'CONTACT' , 'CIRCLE' , 'OWNER' , 'ADMIN' ] ,
806
816
REQUEST_ROLE : {
807
817
UNKNOWN : '未登录' ,
@@ -867,7 +877,9 @@ var CodeUtil = {
867
877
return value < 0 ? ' ! 必须 >= 0 !' : CodeUtil . getComment ( '分页页码' , false , ' ' ) ;
868
878
case 'query' :
869
879
var query = CodeUtil . QUERY_TYPES [ value ] ;
870
- return StringUtil . isEmpty ( query ) ? ' ! value必须是[' + CodeUtil . QUERY_TYPE_KEYS . join ( ) + ']中的一种!' : CodeUtil . getComment ( '查询内容:' + query , false , ' ' ) ;
880
+ return StringUtil . isEmpty ( query ) ? ' ! value必须是[' + CodeUtil . QUERY_TYPE_KEYS . join ( ) + ']中的一种!' : CodeUtil . getComment ( '查询内容:0-数据 1-总数 2-全部' , false , ' ' ) ;
881
+ case 'join' :
882
+ return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '多表连接:LEFT JOIN < ,RIGHT JOIN > ,INNER JOIN & | ! ' , false , ' ' ) ;
871
883
}
872
884
return '' ;
873
885
}
0 commit comments