您的位置 首页 java

Java中controller,service,mode, dao层含义?它们有什么联系?

Model的意思是模型,Model承载的作用就是数据的抽象, Model其实就是一组数据的集合,通常为数据库实体层 ,即数据库中的一张表对应一个实体类。整个系统都可以看成是数据的流动,既然要流动,就一定是有流动的载体。

Service的意思是服务,即业务逻辑层,它的目的是 提供一个服务 。这个服务可能是一系列的数据处理,也可能是调用别的服务。

Dao(data access object)的意思是数据存储对象,它主要是负责和底层数据库通信,即对数据库进行增删改查等基础操作( 访问数据库,向数据库发送sql语句,完成数据的增删改查任务 )。

Controller的意思是控制器,即 把握全局 、控制流程,所有的指令都从这里发出。

它们之间的关系:

Controller 层调用Service interface去控制业务流程,最底层的即为model,model定义的为实体类,dao层中封装了很多常用的增删改查方法(例如:deleteByProperties、getByProerties、queryByProerties、updateByProper等方法),它会调用model层,从而对数据库进行操作;Service层建立在Dao层之上Controller层之下,建立了Dao层后才可以建立Service层,service层调用dao层接口,接收dao层返回的数据,完成项目的基本功能设计;而Controller层又建立在Service层之上,因而controller层接受前端请求,调用service层,接收service层返回的数据,最后返回具体的页面和数据到客户端,每个模型都有一个Service接口,每个接口分别封装各自的业务处理方法。

文章来源:智云一二三科技

文章标题:Java中controller,service,mode, dao层含义?它们有什么联系?

文章地址:https://www.zhihuclub.com/177163.shtml

关于作者: 智云科技

热门文章

评论已关闭

3条评论

  1. Hey,

    If you create content that lacks ranking on Top 10 result of Google then It’s Your fault.

    With the arrival ChatGPT lot’s of blogger & webmasters are jumping into the Free content that ChatGPT is generating for them

    BUT

    Most of them fail to rank their pages on Google.

    This Tool (Available as Life Time Deal at 1 Time price) have helped us optimizing our content that are now ranking and bragging us top 10 spots on google for most of our websites.

    Have a sneak peak how this thing works >>>

    I would definately recommend this deal because it’s #1 Swiss knife for onpage optmization for any content that ranks on top 3 spot.

    Cheers

    Willi B
    87 Rocky Street, MI
    97887
    =====
    Click here to Unsubscribe

  2. Hi,

    Everyone is using ChatGPT nowadays…
    It’s taking over the internet…

    But what if there is a way to capitalize on it and make a killing using it?

    Imagine if you let a powerful AI app, write, design and sell eBooks for you in any niche…
    All you have to do is pick the niche, and then collect the profit…
    Everything in between is done by This New System

    Click here to watch demo >>>

    And today, you have the chance to get access to it at an incredibly early-bird discount…

    Here, Let me show you how it works

    Step 1 Login: Login to Ink AI Cloud-Based Dashboard
    Step 2 Create: Enter One Keyword And Instantly Generate a Fully Designed eBook, Reports, Flipbook, PDF, Lead Magnet, And More…
    Step 3: Syndicate: With One Click, Let AI Syndicate Your eBook Across Millions Of Buyers In Any Niche…

    Step 4: Profit – Yup that’s it.

    I don’t think it gets easier than this…

    It’s just 1 Click away:

    ► No Writing
    ► No proofreading
    ► No designing
    ► No publishing
    ► No marketing

    All of that is done for you

    The technology behind this all IS rocket science..
    But setting this up is as easy as popping a meal in a microwave…
    You just press a few buttons and kapoosh, you’re done!

    To begin extracting profit from the 107 million users of ChatGPT, go here to get started while the one-time pricing is still available.

    Enjoy!

    Williams B
    Manhatten, OT
    46234
    ======
    Click here to unsubscribe

  3. Example of outer nuclear layer thinning noted within the white box DNA methylation, histone modifications, and nucleosome structure and changes in expression of noncoding RNAs i

网站地图