Skip to content

Commit c93486b

Browse files
committed
Update
1 parent f71a764 commit c93486b

File tree

2 files changed

+45
-5
lines changed

2 files changed

+45
-5
lines changed

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,44 @@
22

33
pod 'SJDBMap' (Please perform " pod update --no-repo-update ")
44

5-
Automatically create tables based on the model. To achieve additions and deletions. When the class adds a new attribute, it will automatically update the relevant table field.
65
根据模型自动创建与该类相关的表(多个表), 可以进行增删改查. 当类添加了新的属性的时候, 会自动更新相关的表字段.
6+
Automatically create tables based on the model. To achieve additions and deletions. When the class adds a new attribute, it will automatically update the relevant table field.
7+
8+
9+
#### Use
10+
11+
实现协议方法.
12+
Imp <SJDBMapUseProtocol> Method.
13+
14+
```
15+
@interface SampleVideoModel : NSObject<SJDBMapUseProtocol>
16+
@property (nonatomic, assign) NSInteger videoId;
17+
@property (nonatomic, strong) NSArray<SampleVideoTag *> *tags;
18+
@property (nonatomic, strong) NSArray<SampleUser *> *likedUsers;
19+
@property (nonatomic, strong) SampleOrgan *organ;
20+
@end
21+
22+
@implementation SampleVideoModel
23+
+ (NSString *)primaryKey {
24+
return @"videoId";
25+
}
26+
27+
// model
28+
+ (NSDictionary<NSString *,NSString *> *)correspondingKeys {
29+
return @{
30+
@"organ":@"code",
31+
};
32+
}
33+
34+
// arr
35+
+ (NSDictionary<NSString *,Class> *)arrayCorrespondingKeys {
36+
return @{
37+
@"tags":[SampleVideoTag class],
38+
@"likedUsers":[SampleUser class],
39+
};
40+
}
41+
@end
42+
```
743

844
#### insertOrUpdate 插入数据或更新数据
945
Data before the table is inserted, it will detect whether the relevant table already exists. If it does not exist, it will first create a related table (may create multiple tables), and then update the data or insert.

SJDBMapProject.xcodeproj/project.pbxproj

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/* Begin PBXBuildFile section */
1010
1A7C21FAEDA989DF63569DE4 /* libPods-SJDBMapProject.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0D2DAC9C94365CD0165361DA /* libPods-SJDBMapProject.a */; };
11+
77307FA01F600C6300307CF8 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 77307F9F1F600C6300307CF8 /* README.md */; };
1112
7732A9981EE983D30037A195 /* Goods.m in Sources */ = {isa = PBXBuildFile; fileRef = 7732A9971EE983D30037A195 /* Goods.m */; };
1213
7745B21D1EE5D39B00EC4614 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 7745B21C1EE5D39B00EC4614 /* main.m */; };
1314
7745B2201EE5D39B00EC4614 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7745B21F1EE5D39B00EC4614 /* AppDelegate.m */; };
@@ -45,6 +46,7 @@
4546
/* Begin PBXFileReference section */
4647
0D2DAC9C94365CD0165361DA /* libPods-SJDBMapProject.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SJDBMapProject.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4748
6BDF88F9711C9429F86150C3 /* Pods-SJDBMapProject.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SJDBMapProject.release.xcconfig"; path = "Pods/Target Support Files/Pods-SJDBMapProject/Pods-SJDBMapProject.release.xcconfig"; sourceTree = "<group>"; };
49+
77307F9F1F600C6300307CF8 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
4850
7732A9961EE983D30037A195 /* Goods.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Goods.h; sourceTree = "<group>"; };
4951
7732A9971EE983D30037A195 /* Goods.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Goods.m; sourceTree = "<group>"; };
5052
7745B2181EE5D39B00EC4614 /* SJDBMapProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SJDBMapProject.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -159,10 +161,6 @@
159161
7782526D1F3D59AD006F5156 /* SJDBMap */,
160162
77BED2BD1F5EC8E00024D879 /* Sample */,
161163
7745B2321EE5D3A700EC4614 /* Model */,
162-
7745B2241EE5D39B00EC4614 /* Main.storyboard */,
163-
7745B2271EE5D39B00EC4614 /* Assets.xcassets */,
164-
7745B2291EE5D39B00EC4614 /* LaunchScreen.storyboard */,
165-
7745B22C1EE5D39B00EC4614 /* Info.plist */,
166164
7745B21B1EE5D39B00EC4614 /* Supporting Files */,
167165
);
168166
path = SJDBMapProject;
@@ -171,6 +169,11 @@
171169
7745B21B1EE5D39B00EC4614 /* Supporting Files */ = {
172170
isa = PBXGroup;
173171
children = (
172+
7745B2241EE5D39B00EC4614 /* Main.storyboard */,
173+
7745B2271EE5D39B00EC4614 /* Assets.xcassets */,
174+
7745B2291EE5D39B00EC4614 /* LaunchScreen.storyboard */,
175+
7745B22C1EE5D39B00EC4614 /* Info.plist */,
176+
77307F9F1F600C6300307CF8 /* README.md */,
174177
7745B21C1EE5D39B00EC4614 /* main.m */,
175178
);
176179
name = "Supporting Files";
@@ -436,6 +439,7 @@
436439
7745B2201EE5D39B00EC4614 /* AppDelegate.m in Sources */,
437440
7745B21D1EE5D39B00EC4614 /* main.m in Sources */,
438441
77BED2FA1F5FC7C20024D879 /* SampleVideoPlayViewController.m in Sources */,
442+
77307FA01F600C6300307CF8 /* README.md in Sources */,
439443
77BED2C91F5EC9560024D879 /* SampleVideoModel.m in Sources */,
440444
77BED2D71F5ED2C10024D879 /* SampleOrgan.m in Sources */,
441445
77BED2C31F5EC92B0024D879 /* SampleTableViewController.m in Sources */,

0 commit comments

Comments
 (0)