java - How to transfer values ​​​​between the controller layer and the service layer?
阿神
阿神 2017-05-17 09:57:48
0
4
1142

The current architecture controller layer and service layer use map<string, string> to transfer values. It feels that value conversion is very troublesome in many cases; but if bean objects are used to transfer values, many beans specifically used to transfer values ​​need to be built. . . . Please give me some advice from the architecture master

阿神
阿神

闭关修行中......

reply all(4)
某草草

This is a detailed code implementation issue, not the architecture. .

There is obviously a problem with using map to pass parameters. Using encapsulated model to pass values ​​is more semantically clear and easy to maintain. Having too many models is not a problem

If you feel that converting from map to model every time is cumbersome, you can use the BeanUtil tool or write a tool class yourself to do the conversion

黄舟

I agree with the above, many models can be layered using packages

Try to write code that is easy to maintain. Using map as return parameter will be a nightmare for future maintenance

漂亮男人

I agree with the first floor. It is recommended that if there are few parameters, directly pass the variable of the specified type. If there are many parameters, directly create a dto and pass the parameters to the object

仅有的幸福

It is recommended to use beans to pass values, which is safe, reliable and easy to maintain. If the business requires many beans, the beans must be subcontracted and managed hierarchically. A clear and hierarchical project file structure will help clarify development ideas.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!