SalesAnalysisModel.m 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. //
  2. // SalesAnalysisModel
  3. // IBOSS
  4. //
  5. // Created by apple on 2017/5/15.
  6. // Copyright © 2017年 沈阳东科云信软件有限公司. All rights reserved.
  7. //
  8. // 功能描述:商品畅滞销分析Model
  9. #import "SalesAnalysisModel.h"
  10. @implementation SalesAnalysisModel
  11. /*!
  12. * 1.该方法是 `字典里的属性Key` 和 `要转化为模型里的属性名` 不一样 而重写的
  13. * 前:模型的属性 后:字典里的属性
  14. */
  15. + (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper{
  16. return @{@"commodityName":@"GoodsName",@"commodityCode":@"Code",
  17. @"onlyCode":@"OnlyCode",
  18. @"commodityBrand":@"BrandName",
  19. @"colorNumber":@"ColorNumber",
  20. @"specifications":@"Specification",
  21. @"commodityGrade":@"GradeName",
  22. @"CommodityCategory":@"KindName",
  23. @"number":@"SalesNumber",
  24. @"salesTimes":@"SalesTimes",
  25. };
  26. }
  27. /*!
  28. * 2. 下面的两个方法 `字典里值`与`模型的值`类型不一样`需要转换`而重写的方法
  29. * NSDate *time dic[@"t"]是double类型的的秒数
  30. */
  31. /// Dic -> model
  32. - (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
  33. self.salesAmount = [NSString stringWithFormat:@"%.2f",
  34. [[dic objectForKey:@"SalesAmount"] doubleValue]];
  35. return YES;
  36. }
  37. @end