Skip to content

Commit 1c7fc13

Browse files
code clean & fix li6185377#106
1 parent 728e46d commit 1c7fc13

File tree

9 files changed

+199
-320
lines changed

9 files changed

+199
-320
lines changed

LKDBHelper/Helper/LKDB+Mapping.m

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ + (void)setUserCalculateForCN:(NSString *)columnName
7474
LKDBProperty *property = [infos objectWithSqlColumnName:columnName];
7575
if (property) {
7676
[property enableUserCalculate];
77-
}
78-
else {
77+
} else {
7978
[infos addDBPropertyWithType:LKSQL_Mapping_UserCalculate cname:columnName ctype:LKSQL_Type_Text pname:columnName ptype:@"NSString"];
8079
}
8180
}
@@ -115,11 +114,9 @@ + (void)setTableColumnName:(NSString *)columnName bindingPropertyName:(NSString
115114
if (column) {
116115
[infos updateProperty:column propertyName:propertyName];
117116
column.propertyType = property.propertyType;
118-
}
119-
else if ([property.sqlColumnName isEqualToString:property.propertyName]) {
117+
} else if ([property.sqlColumnName isEqualToString:property.propertyName]) {
120118
[infos updateProperty:property sqlColumnName:columnName];
121-
}
122-
else {
119+
} else {
123120
[infos addDBPropertyWithType:LKSQL_Mapping_Binding cname:columnName ctype:LKSQL_Type_Text pname:propertyName ptype:property.propertyType];
124121
}
125122
}
@@ -169,14 +166,12 @@ - (id)initWithKeyMapping:(NSDictionary *)keyMapping propertyNames:(NSArray *)pro
169166
if ([mappingValue isEqualToString:LKSQL_Mapping_UserCalculate]) {
170167
type = LKSQL_Mapping_UserCalculate;
171168
column_type = LKSQL_Type_Text;
172-
}
173-
else {
169+
} else {
174170

175171
if ([mappingValue isEqualToString:LKSQL_Mapping_Inherit] || [mappingValue isEqualToString:LKSQL_Mapping_Binding]) {
176172
type = LKSQL_Mapping_Inherit;
177173
property_name = column_name;
178-
}
179-
else {
174+
} else {
180175
type = LKSQL_Mapping_Binding;
181176
property_name = mappingValue;
182177
}
@@ -191,8 +186,7 @@ - (id)initWithKeyMapping:(NSDictionary *)keyMapping propertyNames:(NSArray *)pro
191186

192187
[self addDBPropertyWithType:type cname:column_name ctype:column_type pname:property_name ptype:property_type];
193188
}
194-
}
195-
else {
189+
} else {
196190
for (NSInteger i = 0; i < propertyNames.count; i++) {
197191

198192
type = LKSQL_Mapping_Inherit;

LKDBHelper/Helper/LKDBHelper.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
// Copyright (c) 2012年 LJH. All rights reserved.
77
//
88

9-
#import <Foundation/Foundation.h>
10-
#import <FMDB/FMDB.h>
11-
#import "LKDBUtils.h"
129
#import "LKDB+Mapping.h"
10+
#import "LKDBUtils.h"
1311
#import "NSObject+LKDBHelper.h"
1412
#import "NSObject+LKModel.h"
13+
#import <FMDB/FMDB.h>
14+
#import <Foundation/Foundation.h>
1515

1616
NS_ASSUME_NONNULL_BEGIN
1717

@@ -176,7 +176,7 @@ NS_ASSUME_NONNULL_BEGIN
176176
orderBy:(nullable NSString *)orderBy
177177
offset:(NSInteger)offset
178178
count:(NSInteger)count
179-
callback:(void (^)(NSMutableArray * _Nullable array))block;
179+
callback:(void (^)(NSMutableArray *_Nullable array))block;
180180

181181
///return first model or nil
182182
- (nullable id)searchSingle:(Class)modelClass where:(nullable id)where orderBy:(nullable NSString *)orderBy;

0 commit comments

Comments
 (0)