File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
APIJSON-Java-Server/APIJSONORM/src/main/java/zuo/biao/apijson/server Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -502,13 +502,20 @@ public String getColumnString(boolean inSQLJoin) throws Exception {
502502 case HEAD :
503503 case HEADS : //StringUtil.isEmpty(column, true) || column.contains(",") 时SQL.count(column)会return "*"
504504 if (isPrepared () && column != null ) {
505+ String origin ;
506+ String alias ;
507+ int index ;
505508 for (String c : column ) {
506- if (StringUtil .isName (c ) == false ) {
507- throw new IllegalArgumentException ("HEAD请求: @column:value 中 value里面用 , 分割的每一项都必须是1个单词!" );
509+ index = c .lastIndexOf (":" ); //StringUtil.split返回数组中,子项不会有null
510+ origin = index < 0 ? c : c .substring (0 , index );
511+ alias = index < 0 ? null : c .substring (index + 1 );
512+ if (StringUtil .isName (origin ) == false || (alias != null && StringUtil .isName (alias ) == false )) {
513+ throw new IllegalArgumentException ("HEAD请求: 预编译模式下 @column:value 中 value里面用 , 分割的每一项"
514+ + " column:alias 中 column 必须是1个单词!如果有alias,则alias也必须为1个单词!并且不要有多余的空格!" );
508515 }
509516 }
510517 }
511- return SQL .count (column != null && column .size () == 1 ? getKey (column .get (0 )) : "*" );
518+ return SQL .count (column != null && column .size () == 1 ? getKey (Pair . parseEntry ( column .get (0 ), true ). getKey ( )) : "*" );
512519 case POST :
513520 if (column == null || column .isEmpty ()) {
514521 throw new IllegalArgumentException ("POST 请求必须在Table内设置要保存的 key:value !" );
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ public JSONObject execute(SQLConfig config) throws Exception {
218218 // viceColumnStart = i;
219219 // }
220220
221- // FIXME bugfix-修复非常规数据库字段,获取表名失败导致输出异常
221+ // bugfix-修复非常规数据库字段,获取表名失败导致输出异常
222222 if (hasJoin && viceColumnStart > length ) {
223223 List <String > column = config .getColumn ();
224224
@@ -242,11 +242,11 @@ else if (config.getSQLTable().equalsIgnoreCase(rsmd.getTableName(i)) == false) {
242242 rs .close ();
243243
244244
245- //TODO @ APP JOIN 查询副表并缓存到 childMap <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
245+ // @ APP JOIN 查询副表并缓存到 childMap <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
246246
247247 executeAppJoin (config , resultMap , childMap );
248248
249- //TODO @ APP JOIN 查询副表并缓存到 childMap >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
249+ // @ APP JOIN 查询副表并缓存到 childMap >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
250250
251251
252252
You can’t perform that action at this time.
0 commit comments