zoukankan      html  css  js  c++  java
  • 超市账单管理------之获取总记录数

    根据以前写过的登录,现在来写一下获取总记录数根据上一个继续编写

    1.在IUserInfoDAO中编写

    1 //2.获取总记录数
    2     public int getTotalCount();
    View Code

    IUserInfoDAO.xml

    1  <!--2.获取总记录数-->
    2     <select id="getTotalCount" resultType="int">
    3         select count(1) from smbms_user
    4     </select>
    View Code
    2.Service层
    IUserInfoService
    1 //2.获取总记录数
    2     public int getTotalCount();
    View Code

    Service层下的impl包中定义一个类实现接口IUserInfoServiceImpl

     1 @Service("userService")
     2 public class UserInfoServiceImpl implements IUserInfoService {
     3 
     4     //植入dao对象
     5     @Resource(name = "IUserInfoDAO")
     6     IUserInfoDAO userInfoDAO;
     7  //2.获取总记录数
     8     public int getTotalCount() {
     9         return userInfoDAO.getTotalCount();
    10     }
    View Code

    3.controller包下定义的类UserInfoController

     1 @Controller
     2 public class  UserInfoController {
     3     //空指针
     4     //DI
     5     @Resource(name = "userService")
     6     IUserInfoService userInfoService;
     7 
     8     @RequestMapping("/isLogin")
     9     public String isLogin(UserInfo info){
    10         //引用service
    11         UserInfo user = userInfoService.isLogin(info);
    12         if (user!=null&&user.getUserName()!=null){
    13             //login success
    14             return "welcome";
    15         }else{
    16             return "login";
    17         }
    18     }
    19     /*让用户看到该视图*/
    20     @RequestMapping("/showUserList")
    21     public String showUserList(){
    22         return "userList";
    23     }
    View Code

    4.最后来修改jsp页面

    login.jsp

     1 <%@ page pageEncoding="utf-8" isELIgnored="false" %>
     2 <!DOCTYPE html>
     3 <html>
     4 <head lang="en">
     5     <meta charset="UTF-8">
     6     <title>系统登录 - 超市账单管理系统</title>
     7     <link rel="stylesheet" href="css/style.css"/>
     8 </head>
     9 <body class="login_bg">
    10     <section class="loginBox">
    11         <header class="loginHeader">
    12             <h1>超市账单管理系统</h1>
    13         </header>
    14         <section class="loginCont">
    15             <form class="loginForm" action="${pageContext.request.contextPath}/isLogin" method="post">
    16                 <div class="inputbox">
    17                     <label for="user">用户名:</label>
    18                     <input id="user" type="text" name="userCode" placeholder="请输入用户名" required/>
    19                 </div>
    20                 <div class="inputbox">
    21                     <label for="mima">密码:</label>
    22                     <input id="mima" type="password" name="userPassword" placeholder="请输入密码" required/>
    23                 </div>
    24                 <div class="subBtn">
    25                     <input type="submit" value="登录" />
    26                     <input type="reset" value="重置"/>
    27                 </div>
    28 
    29             </form>
    30         </section>
    31     </section>
    32 
    33 </body>
    34 </html>
    View Code

    welcome.jsp

     1 <%@ page pageEncoding="utf-8" isELIgnored="false" %>
     2 <!DOCTYPE html>
     3 <html>
     4 <head lang="en">
     5     <meta charset="UTF-8">
     6     <title>超市账单管理系统</title>
     7     <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/public.css"/>
     8     <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/style.css"/>
     9 
    10 </head>
    11 <body>
    12 <!--头部-->
    13 <header class="publicHeader">
    14     <h1>超市账单管理系统</h1>
    15 
    16     <div class="publicHeaderR">
    17         <p><span>下午好!</span><span style="color: #fff21b"> Admin</span> , 欢迎你!</p>
    18         <a href="login.html">退出</a>
    19     </div>
    20 </header>
    21 <!--时间-->
    22 <section class="publicTime">
    23     <span id="time">2015年1月1日 11:11  星期一</span>
    24     <a href="#">温馨提示:为了能正常浏览,请使用高版本浏览器!(IE10+)</a>
    25 </section>
    26 <!--主体内容-->
    27 <section class="publicMian">
    28     <div class="left">
    29         <h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2>
    30         <nav>
    31             <ul class="list">
    32                 <li ><a href="billList.html">账单管理</a></li>
    33                 <li><a href="providerList.html">供应商管理</a></li>
    34                 <li><a href="${pageContext.request.contextPath}/showUserList">用户管理</a></li>
    35                 <li><a href="password.html">密码修改</a></li>
    36                 <li><a href="/login.html">退出系统</a></li>
    37             </ul>
    38         </nav>
    39     </div>
    40     <div class="right">
    41         <img class="wColck" src="${pageContext.request.contextPath}/jsp/img/clock.jpg" alt=""/>
    42         <div class="wFont">
    43             <h2>Admin</h2>
    44             <p>欢迎来到超市账单管理系统!</p>
    45         </div>
    46     </div>
    47 </section>
    48 <footer class="footer">
    49     版权归北大青鸟
    50 </footer>
    51 <script src="${pageContext.request.contextPath}/jsp/js/time.js"></script>
    52 </body>
    53 </html>
    View Code

    userList.jsp

      1 <%@ page pageEncoding="utf-8" isELIgnored="false" %>
      2 <!DOCTYPE html>
      3 <html>
      4 <head lang="en">
      5     <meta charset="UTF-8">
      6     <title>超市账单管理系统</title>
      7     <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/public.css"/>
      8     <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/style.css"/>
      9     <link rel="stylesheet" href="${pageContext.request.contextPath}/js/bootstrap/css/bootstrap.min.css"/>
     10     <script type="text/javascript" src="${pageContext.request.contextPath}/js/jQuery1.11.1.js"></script>
     11 </head>
     12 <body>
     13 <!--头部-->
     14     <header class="publicHeader">
     15         <h1>超市账单管理系统</h1>
     16         <div class="publicHeaderR">
     17             <p><span>下午好!</span><span style="color: #fff21b"> Admin</span> , 欢迎你!</p>
     18             <a href="login.html">退出</a>
     19         </div>
     20     </header>
     21 <!--时间-->
     22     <section class="publicTime">
     23         <span id="time">2015年1月1日 11:11  星期一</span>
     24         <a href="#">温馨提示:为了能正常浏览,请使用高版本浏览器!(IE10+)</a>
     25     </section>
     26 <!--主体内容-->
     27     <section class="publicMian ">
     28         <div class="left">
     29             <h2 class="leftH2"><span class="span1"></span>功能列表 <span></span></h2>
     30             <nav>
     31                 <ul class="list">
     32                     <li><a href="billList.html">账单管理</a></li>
     33                     <li><a href="providerList.html">供应商管理</a></li>
     34                     <li  id="active"><a href="${pageContext.request.contextPath}/jsp/userList.jsp">用户管理</a></li>
     35                     <li><a href="password.html">密码修改</a></li>
     36                     <li><a href="login.html">退出系统</a></li>
     37                 </ul>
     38             </nav>
     39         </div>
     40         <div class="right">
     41             <div class="location">
     42                 <strong>你现在所在的位置是:</strong>
     43                 <span>用户管理页面</span>
     44             </div>
     45             <div class="search">
     46                 <span>用户名:</span>
     47                 <input type="text" placeholder="请输入用户名"/>
     48                 <input type="button" value="查询"/>
     49                 <a href="userAdd.html">添加用户</a>
     50             </div>
     51             <!--用户-->
     52             <table class="providerTable" cellpadding="0" cellspacing="0">
     53                 <tr class="firstTr">
     54                     <th width="10%">用户编码</th>
     55                     <th width="20%">用户名称</th>
     56                     <th width="10%">性别</th>
     57                     <th width="10%">年龄</th>
     58                     <th width="10%">电话</th>
     59                     <th width="10%">用户类型</th>
     60                     <th width="30%">操作</th>
     61                 </tr>
     62                 <tbody id="list-content"></tbody>
     63                 <%--<tr>
     64                     <td>hanlu</td>
     65                     <td>韩露</td>
     66                     <td>女</td>
     67                     <td>20</td>
     68                     <td>15918230478</td>
     69                     <td>经理</td>
     70                     <td>
     71                         <a href="userView.html"><img src="img/read.png" alt="查看" title="查看"/></a>
     72                         <a href="userUpdate.html"><img src="img/xiugai.png" alt="修改" title="修改"/></a>
     73                         <a href="#" class="removeUser"><img src="img/schu.png" alt="删除" title="删除"/></a>
     74                     </td>
     75                 </tr>
     76                 <tr>
     77                     <td>PRO-CODE—001</td>
     78                     <td>测试供应商001</td>
     79                     <td>韩露</td>
     80                     <td>15918230478</td>
     81                     <td>15918230478</td>
     82                     <td>2015-11-12</td>
     83                     <td>
     84                         <a href="userView.html"><img src="img/read.png" alt="查看" title="查看"/></a>
     85                         <a href="userUpdate.html"><img src="img/xiugai.png" alt="修改" title="修改"/></a>
     86                         <a href="#" class="removeUser"><img src="img/schu.png" alt="删除" title="删除"/></a>
     87                     </td>
     88                 </tr>--%>
     89                 <tr>
     90 
     91                 </tr>
     92             </table>
     93 
     94                 <div class="pagination" id="pagination" style="margin:4px 0 0 0"></div>
     95 
     96         </div>
     97     </section>
     98 
     99 <!--点击删除按钮后弹出的页面-->
    100 <div class="zhezhao"></div>
    101 <div class="remove" id="removeUse">
    102     <div class="removerChid">
    103         <h2>提示</h2>
    104         <div class="removeMain">
    105             <p>你确定要删除该用户吗?</p>
    106             <a href="#" id="yes">确定</a>
    107             <a href="#" id="no">取消</a>
    108         </div>
    109     </div>
    110 </div>
    111 
    112     <footer class="footer">
    113         版权归北大青鸟
    114     </footer>
    115 
    116 <script src="js/jquery.js"></script>
    117 <script src="js/js.js"></script>
    118 <script src="js/time.js"></script>
    119 
    120 </body>
    121 </html>
    View Code
  • 相关阅读:
    第一课:js命名空间的介绍,js对象的扩展以及js数组化
    浏览器缓存机制-社招必问知识
    2013年前端校园招聘经历
    GBDT(MART) 迭代决策树简介
    coursera 公开课 文本挖掘和分析(text mining and analytics) week 1 笔记
    Predicting purchase behavior from social media-www2013
    Recommending branded products from social media -RecSys 2013-20160422
    2016年数据挖掘,机器学习可投会议
    java 中遍历hashmap 和hashset 的方法
    NLPIR分词工具的使用(java环境下)
  • 原文地址:https://www.cnblogs.com/ruyan886621/p/7427382.html
Copyright © 2011-2022 走看看