Home > Back-end >  Consult: controller receives parameters of the object is vo or dtos?
Consult: controller receives parameters of the object is vo or dtos?

Time:09-21

The controller receives the parameters of the object is vo or dtos? , always don't know much about these concepts, a great god grant instruction

CodePudding user response:

I never understand, I use case, VO and DTO in actual development process can actually be the same, by definition they are differences in the use of layer, VO (view object) view object, DTO (Data Transfer object), Data Transfer objects; As for the parameters of the controller to receive you here to see is to receive the service parameters passed or page, if the page parameters passed is called VO, service parameters passed is called DTO,,
The above is my humble opinion, what is the wrong place welcome notes!

CodePudding user response:

Vo, because the controller itself is dealing with a view layer (view), to be more convenient and structure of data in the same page, dto is service and dao data persistence layer interaction, should be like this

CodePudding user response:

refer to the second floor Su Yong response:
vo, because the controller itself is dealing with a view layer (view), to be more convenient and structure of data in the same page, dto is service and dao data persistence layer interaction, should be
I want to ask, my novice ha, service and dao interaction with not DO? I am using SSM framework,

CodePudding user response:

Presentation layer objects and business processing objects, as far as possible don't be too deep coupling,
In general, the presentation layer to get the VO, do some simple check, then need to encapsulate business layer of object by using the Boolean calculation,

CodePudding user response:

reference weixin_42664210 reply: 3/f
Quote: refer to the second floor Su Yong response:

Vo, because the controller itself is dealing with a view layer (view), to be more convenient and the structure of data in the same page, dto is service and dao data persistence layer interaction, should be
I want to ask, my novice ha, service and dao interaction with not DO? I am using SSM framework,

Should pass is vo but according to the circumstances, especially before and after the separation, with a particular front-end developer, because dto tend to add a lot of additional data information, for example, new users, often front passed is account name, password, founder mark and so on very little information, but dtos as a transit data, add such as update, user status, etc. Other information, if the front is dto, so many additional information may cause a lot of problems to the front end, if it is a small project, front end is going on, a person that you can't have what it takes, the backend which don't need to know, pass dto doesn't matter, the general data transformation is, front end pass vo to interface, the interface will be vo to dtos passed to the service, the service will be dto decomposed to do, call the field service schedule, and then reverse into vo or other return result, passed to the front desk,

CodePudding user response:

Controller into the bo the refs and vo intermediate service layer dto dao entity

CodePudding user response:

Name of different scenarios,

CodePudding user response:

refer to 6th floor Valerie00 response:
controller into the bo the refs and vo intermediate service layer dto dao entity

Why is that? BO full name is what?

CodePudding user response:

reference 5 floor shanyan06 reply:
Quote: refer to the third floor weixin_42664210 response:

Quote: refer to the second floor Su Yong response:

Vo, because the controller itself is dealing with a view layer (view), to be more convenient and the structure of data in the same page, dto is service and dao data persistence layer interaction, should be
I want to ask, my novice ha, service and dao interaction with not DO? I am using SSM framework,

Should pass is vo but according to the circumstances, especially before and after the separation, with a particular front-end developer, because dto tend to add a lot of additional data information, for example, new users, often front passed is account name, password, founder mark and so on very little information, but dtos as a transit data, add such as update, user status, etc. Other information, if the front is dto, so many additional information may cause a lot of problems to the front end, if it is a small project, front end is going on, a person that you can't have what it takes, the backend which don't need to know, pass dto doesn't matter, the general data transformation is, front end pass vo to interface, the interface will be vo to dtos passed to the service, the service will be dto decomposed to do, call field service schedule, then reverse into vo or other return results and passed to the front desk,


There is a problem, to get their data and to return to the front of the data is not the same, that is about to define two VO, VO turn dtos once at the same time, turn DTO DO once, after the query the database DO turn dtos once, turn DTO VO, DTO may also define multiple, so isn't that a bit of trouble, what's the solution? thank you

CodePudding user response:

In fact you said VO and DTO is a thing, is used as a framework for different controller interact with the page object naming way, no other special meaning, just a specification, you don't so named don't affect the code development,

CodePudding user response:

Alibaba coding rules of model specification lists the following areas:
DO (Data Object) : with the database table structure one-to-one correspondence, through the DAO layer uplink Data source Object,
DTO (Data Transfer Object) : Data Transfer objects, Object of Service or Manager to transmission,
BO (Business Object) : Business Object that encapsulates the Business logic of the output by a Service layer objects,
AO (Application Object) : the Application Object, the Web layer and Service layer between the abstract reusable Object model, is very close to the presentation layer, reuse degree is not high,
VO (View Object) : display Object layer, layer is usually a Web template rendering engine to transfer objects,
Details refer to the original: https://cloud.tencent.com/developer/article/1176367

CodePudding user response:


Anyway, we are now in ginseng are dtos, returns are encapsulated BaseResult class

  • Related