OOContactModel.swift 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. //
  2. // OOContactModel.swift
  3. // o2app
  4. //
  5. // Created by 刘振兴 on 2017/11/20.
  6. // Copyright © 2017年 zone. All rights reserved.
  7. //
  8. import Foundation
  9. import HandyJSON
  10. class OOControl : NSObject, NSCoding, DataModel{
  11. var allowDelete : Bool?
  12. var allowEdit : Bool?
  13. required override init() {
  14. }
  15. /**
  16. * NSCoding required initializer.
  17. * Fills the data from the passed decoder
  18. */
  19. @objc required init(coder aDecoder: NSCoder)
  20. {
  21. allowDelete = aDecoder.decodeObject(forKey: "allowDelete") as? Bool
  22. allowEdit = aDecoder.decodeObject(forKey: "allowEdit") as? Bool
  23. }
  24. /**
  25. * NSCoding required method.
  26. * Encodes mode properties into the decoder
  27. */
  28. @objc func encode(with aCoder: NSCoder)
  29. {
  30. if allowDelete != nil{
  31. aCoder.encode(allowDelete, forKey: "allowDelete")
  32. }
  33. if allowEdit != nil{
  34. aCoder.encode(allowEdit, forKey: "allowEdit")
  35. }
  36. }
  37. }
  38. // MARK: - Unit Model
  39. class OOUnitModel : NSObject, NSCoding, DataModel{
  40. var control : OOControl?
  41. var controllerList : [AnyObject]?
  42. var createTime : String?
  43. var desc : String?
  44. var descriptionField : String?
  45. var distinguishedName : String?
  46. var id : String?
  47. var inheritedControllerList : [AnyObject]?
  48. var level : Int?
  49. var levelName : String?
  50. var name : String?
  51. var orderNumber : Int?
  52. var pinyin : String?
  53. var pinyinInitial : String?
  54. var shortName : String?
  55. var subDirectIdentityCount : Int?
  56. var subDirectUnitCount : Int?
  57. var superior : String?
  58. var typeList : [String]?
  59. var unique : String?
  60. var updateTime : String?
  61. var woSubDirectIdentityList:[OOIdentityModel]?
  62. override required init(){}
  63. func mapping(mapper: HelpingMapper) {
  64. mapper <<< self.desc <-- "description"
  65. }
  66. /**
  67. * NSCoding required initializer.
  68. * Fills the data from the passed decoder
  69. */
  70. @objc required init(coder aDecoder: NSCoder)
  71. {
  72. control = aDecoder.decodeObject(forKey: "control") as? OOControl
  73. controllerList = aDecoder.decodeObject(forKey: "controllerList") as? [AnyObject]
  74. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  75. descriptionField = aDecoder.decodeObject(forKey: "description") as? String
  76. distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
  77. id = aDecoder.decodeObject(forKey: "id") as? String
  78. inheritedControllerList = aDecoder.decodeObject(forKey: "inheritedControllerList") as? [AnyObject]
  79. level = aDecoder.decodeObject(forKey: "level") as? Int
  80. levelName = aDecoder.decodeObject(forKey: "levelName") as? String
  81. name = aDecoder.decodeObject(forKey: "name") as? String
  82. orderNumber = aDecoder.decodeObject(forKey: "orderNumber") as? Int
  83. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  84. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  85. shortName = aDecoder.decodeObject(forKey: "shortName") as? String
  86. subDirectIdentityCount = aDecoder.decodeObject(forKey: "subDirectIdentityCount") as? Int
  87. subDirectUnitCount = aDecoder.decodeObject(forKey: "subDirectUnitCount") as? Int
  88. superior = aDecoder.decodeObject(forKey: "superior") as? String
  89. typeList = aDecoder.decodeObject(forKey: "typeList") as? [String]
  90. unique = aDecoder.decodeObject(forKey: "unique") as? String
  91. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  92. woSubDirectIdentityList = aDecoder.decodeObject(forKey: "woSubDirectIdentityList") as? [OOIdentityModel]
  93. }
  94. /**
  95. * NSCoding required method.
  96. * Encodes mode properties into the decoder
  97. */
  98. @objc func encode(with aCoder: NSCoder)
  99. {
  100. if control != nil{
  101. aCoder.encode(control, forKey: "control")
  102. }
  103. if controllerList != nil{
  104. aCoder.encode(controllerList, forKey: "controllerList")
  105. }
  106. if createTime != nil{
  107. aCoder.encode(createTime, forKey: "createTime")
  108. }
  109. if descriptionField != nil{
  110. aCoder.encode(descriptionField, forKey: "description")
  111. }
  112. if distinguishedName != nil{
  113. aCoder.encode(distinguishedName, forKey: "distinguishedName")
  114. }
  115. if id != nil{
  116. aCoder.encode(id, forKey: "id")
  117. }
  118. if inheritedControllerList != nil{
  119. aCoder.encode(inheritedControllerList, forKey: "inheritedControllerList")
  120. }
  121. if level != nil{
  122. aCoder.encode(level, forKey: "level")
  123. }
  124. if levelName != nil{
  125. aCoder.encode(levelName, forKey: "levelName")
  126. }
  127. if name != nil{
  128. aCoder.encode(name, forKey: "name")
  129. }
  130. if orderNumber != nil{
  131. aCoder.encode(orderNumber, forKey: "orderNumber")
  132. }
  133. if pinyin != nil{
  134. aCoder.encode(pinyin, forKey: "pinyin")
  135. }
  136. if pinyinInitial != nil{
  137. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  138. }
  139. if shortName != nil{
  140. aCoder.encode(shortName, forKey: "shortName")
  141. }
  142. if subDirectIdentityCount != nil{
  143. aCoder.encode(subDirectIdentityCount, forKey: "subDirectIdentityCount")
  144. }
  145. if subDirectUnitCount != nil{
  146. aCoder.encode(subDirectUnitCount, forKey: "subDirectUnitCount")
  147. }
  148. if superior != nil{
  149. aCoder.encode(superior, forKey: "superior")
  150. }
  151. if typeList != nil{
  152. aCoder.encode(typeList, forKey: "typeList")
  153. }
  154. if unique != nil{
  155. aCoder.encode(unique, forKey: "unique")
  156. }
  157. if updateTime != nil{
  158. aCoder.encode(updateTime, forKey: "updateTime")
  159. }
  160. if woSubDirectIdentityList != nil{
  161. aCoder.encode(woSubDirectIdentityList, forKey: "woSubDirectIdentityList")
  162. }
  163. }
  164. }
  165. // MARK: - OO Person Model
  166. class OOPersonModel : NSObject, NSCoding, DataModel{
  167. var age : Int?
  168. @objc var changePasswordTime : String?
  169. @objc var controllerList : [String]?
  170. @objc var createTime : String?
  171. @objc var descriptionField : String?
  172. @objc var distinguishedName : String?
  173. @objc var employee : String?
  174. @objc var genderType : String?
  175. @objc var id : String?
  176. @objc var mail : String?
  177. @objc var mobile : String?
  178. @objc var name : String?
  179. @objc var officePhone : String?
  180. var orderNumber : Int?
  181. @objc var pinyin : String?
  182. @objc var pinyinInitial : String?
  183. @objc var qq : String?
  184. @objc var signature : String?
  185. @objc var superior : String?
  186. @objc var unique : String?
  187. @objc var updateTime : String?
  188. @objc var weixin : String?
  189. @objc var woIdentityList:[OOIdentityModel]?
  190. @objc var woGroupList:[OOGroupModel]?
  191. @objc var desc : String?
  192. public override required init() {
  193. }
  194. func mapping(mapper: HelpingMapper) {
  195. mapper <<< self.desc <-- "description"
  196. }
  197. /**
  198. * NSCoding required initializer.
  199. * Fills the data from the passed decoder
  200. */
  201. @objc required init(coder aDecoder: NSCoder)
  202. {
  203. age = aDecoder.decodeObject(forKey: "age") as? Int
  204. changePasswordTime = aDecoder.decodeObject(forKey: "changePasswordTime") as? String
  205. controllerList = aDecoder.decodeObject(forKey: "controllerList") as? [String]
  206. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  207. descriptionField = aDecoder.decodeObject(forKey: "description") as? String
  208. distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
  209. employee = aDecoder.decodeObject(forKey: "employee") as? String
  210. genderType = aDecoder.decodeObject(forKey: "genderType") as? String
  211. id = aDecoder.decodeObject(forKey: "id") as? String
  212. mail = aDecoder.decodeObject(forKey: "mail") as? String
  213. mobile = aDecoder.decodeObject(forKey: "mobile") as? String
  214. name = aDecoder.decodeObject(forKey: "name") as? String
  215. officePhone = aDecoder.decodeObject(forKey: "officePhone") as? String
  216. orderNumber = aDecoder.decodeObject(forKey: "orderNumber") as? Int
  217. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  218. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  219. qq = aDecoder.decodeObject(forKey: "qq") as? String
  220. signature = aDecoder.decodeObject(forKey: "signature") as? String
  221. superior = aDecoder.decodeObject(forKey: "superior") as? String
  222. unique = aDecoder.decodeObject(forKey: "unique") as? String
  223. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  224. weixin = aDecoder.decodeObject(forKey: "weixin") as? String
  225. }
  226. /**
  227. * NSCoding required method.
  228. * Encodes mode properties into the decoder
  229. */
  230. @objc func encode(with aCoder: NSCoder)
  231. {
  232. if age != nil{
  233. aCoder.encode(age, forKey: "age")
  234. }
  235. if changePasswordTime != nil{
  236. aCoder.encode(changePasswordTime, forKey: "changePasswordTime")
  237. }
  238. if controllerList != nil{
  239. aCoder.encode(controllerList, forKey: "controllerList")
  240. }
  241. if createTime != nil{
  242. aCoder.encode(createTime, forKey: "createTime")
  243. }
  244. if descriptionField != nil{
  245. aCoder.encode(descriptionField, forKey: "description")
  246. }
  247. if distinguishedName != nil{
  248. aCoder.encode(distinguishedName, forKey: "distinguishedName")
  249. }
  250. if employee != nil{
  251. aCoder.encode(employee, forKey: "employee")
  252. }
  253. if genderType != nil{
  254. aCoder.encode(genderType, forKey: "genderType")
  255. }
  256. if id != nil{
  257. aCoder.encode(id, forKey: "id")
  258. }
  259. if mail != nil{
  260. aCoder.encode(mail, forKey: "mail")
  261. }
  262. if mobile != nil{
  263. aCoder.encode(mobile, forKey: "mobile")
  264. }
  265. if name != nil{
  266. aCoder.encode(name, forKey: "name")
  267. }
  268. if officePhone != nil{
  269. aCoder.encode(officePhone, forKey: "officePhone")
  270. }
  271. if orderNumber != nil{
  272. aCoder.encode(orderNumber, forKey: "orderNumber")
  273. }
  274. if pinyin != nil{
  275. aCoder.encode(pinyin, forKey: "pinyin")
  276. }
  277. if pinyinInitial != nil{
  278. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  279. }
  280. if qq != nil{
  281. aCoder.encode(qq, forKey: "qq")
  282. }
  283. if signature != nil{
  284. aCoder.encode(signature, forKey: "signature")
  285. }
  286. if superior != nil{
  287. aCoder.encode(superior, forKey: "superior")
  288. }
  289. if unique != nil{
  290. aCoder.encode(unique, forKey: "unique")
  291. }
  292. if updateTime != nil{
  293. aCoder.encode(updateTime, forKey: "updateTime")
  294. }
  295. if weixin != nil{
  296. aCoder.encode(weixin, forKey: "weixin")
  297. }
  298. }
  299. }
  300. // MARK: - OO Identity Model
  301. class OOIdentityModel : NSObject, NSCoding, DataModel{
  302. @objc var createTime : String?
  303. @objc var descriptionField : String?
  304. @objc var distinguishedName : String?
  305. @objc var id : String?
  306. @objc var name : String?
  307. var orderNumber : Int?
  308. @objc var person : String?
  309. @objc var pinyin : String?
  310. @objc var pinyinInitial : String?
  311. @objc var unique : String?
  312. @objc var unit : String?
  313. var unitLevel : Int?
  314. @objc var unitLevelName : String?
  315. @objc var unitName : String?
  316. @objc var updateTime : String?
  317. @objc var woPerson : OOPersonModel?
  318. @objc var woUnit:OOUnitModel?
  319. @objc var desc : String?
  320. public override required init() {
  321. }
  322. override var description: String {
  323. return "\(self.name!)(\(self.unitName!))"
  324. }
  325. func mapping(mapper: HelpingMapper) {
  326. mapper <<< self.desc <-- "description"
  327. }
  328. /**
  329. * NSCoding required initializer.
  330. * Fills the data from the passed decoder
  331. */
  332. @objc required init(coder aDecoder: NSCoder)
  333. {
  334. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  335. descriptionField = aDecoder.decodeObject(forKey: "description") as? String
  336. distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
  337. id = aDecoder.decodeObject(forKey: "id") as? String
  338. name = aDecoder.decodeObject(forKey: "name") as? String
  339. orderNumber = aDecoder.decodeObject(forKey: "orderNumber") as? Int
  340. person = aDecoder.decodeObject(forKey: "person") as? String
  341. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  342. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  343. unique = aDecoder.decodeObject(forKey: "unique") as? String
  344. unit = aDecoder.decodeObject(forKey: "unit") as? String
  345. unitLevel = aDecoder.decodeObject(forKey: "unitLevel") as? Int
  346. unitLevelName = aDecoder.decodeObject(forKey: "unitLevelName") as? String
  347. unitName = aDecoder.decodeObject(forKey: "unitName") as? String
  348. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  349. woPerson = aDecoder.decodeObject(forKey: "woPerson") as? OOPersonModel
  350. woUnit = aDecoder.decodeObject(forKey: "woUnit") as? OOUnitModel
  351. }
  352. /**
  353. * NSCoding required method.
  354. * Encodes mode properties into the decoder
  355. */
  356. @objc func encode(with aCoder: NSCoder)
  357. {
  358. if createTime != nil{
  359. aCoder.encode(createTime, forKey: "createTime")
  360. }
  361. if descriptionField != nil{
  362. aCoder.encode(descriptionField, forKey: "description")
  363. }
  364. if distinguishedName != nil{
  365. aCoder.encode(distinguishedName, forKey: "distinguishedName")
  366. }
  367. if id != nil{
  368. aCoder.encode(id, forKey: "id")
  369. }
  370. if name != nil{
  371. aCoder.encode(name, forKey: "name")
  372. }
  373. if orderNumber != nil{
  374. aCoder.encode(orderNumber, forKey: "orderNumber")
  375. }
  376. if person != nil{
  377. aCoder.encode(person, forKey: "person")
  378. }
  379. if pinyin != nil{
  380. aCoder.encode(pinyin, forKey: "pinyin")
  381. }
  382. if pinyinInitial != nil{
  383. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  384. }
  385. if unique != nil{
  386. aCoder.encode(unique, forKey: "unique")
  387. }
  388. if unit != nil{
  389. aCoder.encode(unit, forKey: "unit")
  390. }
  391. if unitLevel != nil{
  392. aCoder.encode(unitLevel, forKey: "unitLevel")
  393. }
  394. if unitLevelName != nil{
  395. aCoder.encode(unitLevelName, forKey: "unitLevelName")
  396. }
  397. if unitName != nil{
  398. aCoder.encode(unitName, forKey: "unitName")
  399. }
  400. if updateTime != nil{
  401. aCoder.encode(updateTime, forKey: "updateTime")
  402. }
  403. if woPerson != nil{
  404. aCoder.encode(woPerson, forKey: "woPerson")
  405. }
  406. if woUnit != nil{
  407. aCoder.encode(woUnit, forKey: "woUnit")
  408. }
  409. }
  410. }
  411. // MARK: - OO Group Model
  412. class OOGroupModel : NSObject, NSCoding, DataModel{
  413. @objc var control : OOControl?
  414. @objc var createTime : String?
  415. @objc var descriptionField : String?
  416. @objc var distinguishedName : String?
  417. @objc var groupList : [String]?
  418. @objc var id : String?
  419. @objc var name : String?
  420. @objc var personList : [String]?
  421. @objc var pinyin : String?
  422. @objc var pinyinInitial : String?
  423. @objc var unique : String?
  424. @objc var updateTime : String?
  425. @objc var woGroupList:[OOGroupModel]?
  426. @objc var woPersonList:[OOPersonModel]?
  427. @objc var desc : String?
  428. public override required init() {
  429. }
  430. func mapping(mapper: HelpingMapper) {
  431. mapper <<< self.desc <-- "description"
  432. }
  433. /**
  434. * NSCoding required initializer.
  435. * Fills the data from the passed decoder
  436. */
  437. @objc required init(coder aDecoder: NSCoder)
  438. {
  439. control = aDecoder.decodeObject(forKey: "control") as? OOControl
  440. createTime = aDecoder.decodeObject(forKey: "createTime") as? String
  441. descriptionField = aDecoder.decodeObject(forKey: "description") as? String
  442. distinguishedName = aDecoder.decodeObject(forKey: "distinguishedName") as? String
  443. groupList = aDecoder.decodeObject(forKey: "groupList") as? [String]
  444. id = aDecoder.decodeObject(forKey: "id") as? String
  445. name = aDecoder.decodeObject(forKey: "name") as? String
  446. personList = aDecoder.decodeObject(forKey: "personList") as? [String]
  447. pinyin = aDecoder.decodeObject(forKey: "pinyin") as? String
  448. pinyinInitial = aDecoder.decodeObject(forKey: "pinyinInitial") as? String
  449. unique = aDecoder.decodeObject(forKey: "unique") as? String
  450. updateTime = aDecoder.decodeObject(forKey: "updateTime") as? String
  451. }
  452. /**
  453. * NSCoding required method.
  454. * Encodes mode properties into the decoder
  455. */
  456. @objc func encode(with aCoder: NSCoder)
  457. {
  458. if control != nil{
  459. aCoder.encode(control, forKey: "control")
  460. }
  461. if createTime != nil{
  462. aCoder.encode(createTime, forKey: "createTime")
  463. }
  464. if descriptionField != nil{
  465. aCoder.encode(descriptionField, forKey: "description")
  466. }
  467. if distinguishedName != nil{
  468. aCoder.encode(distinguishedName, forKey: "distinguishedName")
  469. }
  470. if groupList != nil{
  471. aCoder.encode(groupList, forKey: "groupList")
  472. }
  473. if id != nil{
  474. aCoder.encode(id, forKey: "id")
  475. }
  476. if name != nil{
  477. aCoder.encode(name, forKey: "name")
  478. }
  479. if personList != nil{
  480. aCoder.encode(personList, forKey: "personList")
  481. }
  482. if pinyin != nil{
  483. aCoder.encode(pinyin, forKey: "pinyin")
  484. }
  485. if pinyinInitial != nil{
  486. aCoder.encode(pinyinInitial, forKey: "pinyinInitial")
  487. }
  488. if unique != nil{
  489. aCoder.encode(unique, forKey: "unique")
  490. }
  491. if updateTime != nil{
  492. aCoder.encode(updateTime, forKey: "updateTime")
  493. }
  494. }
  495. }