@@ -890,31 +890,36 @@ var CodeUtil = {
890
890
return '' ;
891
891
}
892
892
893
- if ( JSONObject . isTableKey ( name ) ) {
893
+ var aliaIndex = name . indexOf ( ':' ) ;
894
+ var objName = aliaIndex < 0 ? name : name . substring ( 0 , aliaIndex ) ;
895
+
896
+ if ( JSONObject . isTableKey ( objName ) ) {
894
897
if ( key . startsWith ( '@' ) ) {
895
898
switch ( key ) {
896
899
case '@column' :
897
- return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '返回字段' , false , ' ' ) ;
900
+ return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '返回字段:例如 id,name,json_length(contactIdList):contactCount... ' , false , ' ' ) ;
898
901
case '@order' :
899
- return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '排序方式, +升序,-降序' , false , ' ' ) ;
902
+ return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '排序方式: +升序,-降序,例如 name+,date-,... ' , false , ' ' ) ;
900
903
case '@group' :
901
- return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '分组方式' , false , ' ' ) ;
904
+ return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '分组方式:例如 userId ' , false , ' ' ) ;
902
905
case '@having' :
903
- return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( 'SQL函数' , false , ' ' ) ;
906
+ return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( 'SQL函数:例如 max(id)>100,sum(balance)<=10000,...' , false , ' ' ) ;
907
+ case '@combine' :
908
+ return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '条件组合:例如 name?,|tag?,&id{},!id,...' , false , ' ' ) ;
904
909
case '@schema' :
905
- return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '数据库' , false , ' ' ) ;
910
+ return CodeUtil . getType4Request ( value ) != 'string' ? ' ! value必须是String类型!' : CodeUtil . getComment ( '数据库:例如 sys ' , false , ' ' ) ;
906
911
case '@correct' :
907
912
return value != null ? ' ! value必须是Object类型!' : CodeUtil . getComment ( '字段校正' , false , ' ' ) ;
908
913
case '@role' :
909
914
try {
910
915
value = value . substring ( 1 , value . length - 1 ) . toUpperCase ( ) ;
911
916
} catch ( e ) { }
912
917
var role = CodeUtil . REQUEST_ROLE [ value ] ;
913
- return StringUtil . isEmpty ( role ) ? ' ! value必须是[' + CodeUtil . REQUEST_ROLE_KEYS . join ( ) + ']中的一种!' : CodeUtil . getComment ( '登录角色 :' + role , false , ' ' ) ;
918
+ return StringUtil . isEmpty ( role ) ? ' ! value必须是[' + CodeUtil . REQUEST_ROLE_KEYS . join ( ) + ']中的一种!' : CodeUtil . getComment ( '来访角色 :' + role , false , ' ' ) ;
914
919
}
915
920
return '' ;
916
921
}
917
- var c = CodeUtil . getCommentFromDoc ( tableList , name , key , method ) ;
922
+ var c = CodeUtil . getCommentFromDoc ( tableList , objName , key , method ) ;
918
923
return StringUtil . isEmpty ( c ) ? ' ! 字段不存在!' : CodeUtil . getComment ( c , false , ' ' ) ;
919
924
}
920
925
0 commit comments