3
3
4
4
import android .database .Cursor ;
5
5
import android .database .sqlite .SQLiteDatabase ;
6
- import com .litesuits .orm .log .OrmLog ;
7
6
import com .litesuits .orm .db .annotation .Column ;
8
7
import com .litesuits .orm .db .annotation .Mapping ;
9
8
import com .litesuits .orm .db .annotation .PrimaryKey ;
12
11
import com .litesuits .orm .db .assit .Querier ;
13
12
import com .litesuits .orm .db .assit .SQLBuilder ;
14
13
import com .litesuits .orm .db .assit .Transaction ;
14
+ import com .litesuits .orm .db .enums .AssignType ;
15
15
import com .litesuits .orm .db .impl .SQLStatement ;
16
16
import com .litesuits .orm .db .model .*;
17
17
import com .litesuits .orm .db .utils .DataUtil ;
18
18
import com .litesuits .orm .db .utils .FieldUtil ;
19
+ import com .litesuits .orm .log .OrmLog ;
19
20
20
21
import java .lang .reflect .Field ;
21
22
import java .util .ArrayList ;
@@ -428,12 +429,12 @@ public static synchronized EntityTable getTable(Class<?> claxx, boolean needPK)
428
429
if (p .field .getType () == String .class ) {
429
430
// 主键移除属性Map
430
431
table .pmap .remove (col );
431
- table .key = new Primarykey (p , PrimaryKey . AssignType .BY_MYSELF );
432
+ table .key = new Primarykey (p , AssignType .BY_MYSELF );
432
433
break ;
433
434
} else if (FieldUtil .isNumber (p .field .getType ())) {
434
435
// 主键移除属性Map
435
436
table .pmap .remove (col );
436
- table .key = new Primarykey (p , PrimaryKey . AssignType .AUTO_INCREMENT );
437
+ table .key = new Primarykey (p , AssignType .AUTO_INCREMENT );
437
438
break ;
438
439
}
439
440
@@ -458,14 +459,14 @@ private static void checkPrimaryKey(Primarykey key) {
458
459
if (key .isAssignedBySystem ()) {
459
460
if (!FieldUtil .isNumber (key .field .getType ())) {
460
461
throw new RuntimeException (
461
- PrimaryKey . AssignType .AUTO_INCREMENT
462
+ AssignType .AUTO_INCREMENT
462
463
+ " Auto increment primary key must be a number ...\n " +
463
464
"错误提示:自增主键必须设置为数字类型" );
464
465
}
465
466
} else if (key .isAssignedByMyself ()) {
466
467
if (String .class != key .field .getType () && !FieldUtil .isNumber (key .field .getType ())) {
467
468
throw new RuntimeException (
468
- PrimaryKey . AssignType .BY_MYSELF
469
+ AssignType .BY_MYSELF
469
470
+ " Custom primary key must be string or number ...\n " +
470
471
"错误提示:自定义主键值必须为String或者Number类型" );
471
472
}
0 commit comments