Alice52 / project

This repository is muti language and tech integration project.
MIT License
0 stars 0 forks source link

[seckill] layer model convert #60

Closed Alice52 closed 4 years ago

Alice52 commented 4 years ago

layer model, such as PO, BO, DTO, VO convert

  1. test hutool performance

  2. use MapStruct

Alice52 commented 4 years ago

reference

  1. https://blog.csdn.net/vtnews/article/details/80678533
Alice52 commented 4 years ago

this project will use mass model as follow

  1. PO

  2. BO

  3. VO

so we should do follow convert

  1. PO to BO
  2. BO to VO
  3. VO to BO
  4. BO to PO

notice

  1. IRepository response should be BO
  2. VO just can appear in controller, and other place BO should be always used.

please follow the guild

  1. It is still allowed to do conversion between PO and VO, but should try to avoid it.
Alice52 commented 4 years ago

注意当前Integer属性使用expression进行处理后,mapStruct自动生成代码中所有的Integer类型属性都会经过同样表达式处理,所以上面hadLesson字段也进行了expression指定

http://www.kailing.pub/article/index/arcid/262.html