zoukankan      html  css  js  c++  java
  • DAO层,Service层,Controller层、View层

    参考文档:http://blog.csdn.net/zdwzzu2006/article/details/6053006

    对于我这种小菜鸟来说,觉得写得很好

    想的时候是:前端---action---service(业务逻辑)---dao(数据访问)---database

    写代码的时候是:database---dao---service---action/前端

    其中,action就是代表了controller ?

    例子:

    (只看流程就可以了,不要管代码什么含义)

    (1)在一个JSP页面看到

    <c:forEach items="${lstDate}" var="lstDate" varStatus="status">
                            <tr>
                                <td>${status.index+1}</td>
                                <td>项目:</td>
                                <td class="lineSty3">${lstDate.xmmc}</td>
                                <td>阶段:</td>
                                <td class="lineSty3">${lstDate.xmjd}</td>
                               
                            </tr>
                        </c:forEach>

    它是要列举出来所有的lstDate集合里的xmmc、xmjd

    (2)那么,lstDate是什么呢,接下来找到controller

    List<Map<String, Object>> lstDate=proPeriodPlanService.findById();
            
    model.addAttribute("lstDate",lstDate);

    (3)接下来要去找service的findById()

    public List<ProPeriodplan>  findById(String id) throws Exception;

    (4)在service的Impl里实现

        @Override
        public List<ProPeriodplan> findById(String id) throws Exception {
            // TODO Auto-generated method stub
            return proPeriodPlanDao.findById(id);
        }

    (5)看到它接着去找Dao

    @Query(value = "From ProPeriodplan f where f.objProInfo.proId = ?1 order by f.objDicPeriod.perId asc")
        public List<ProPeriodplan> getPeriodplanById(String proId);
  • 相关阅读:
    化DataSet对象并压缩
    数据库连接
    触发器
    事务
    关于C语言的宏
    GCC中的一些参数
    《tkinter实用教程六》tkinter ttk.Label 控件
    《tkinter实用教程三》ttk.Button 控件
    5. 替换空格
    《tkinter实用教程二》ttk 子模块
  • 原文地址:https://www.cnblogs.com/Donnnnnn/p/5830441.html
Copyright © 2011-2022 走看看