超市账单管理------之获取总记录数
生活随笔
收集整理的這篇文章主要介紹了
超市账单管理------之获取总记录数
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
根據(jù)以前寫(xiě)過(guò)的登錄,現(xiàn)在來(lái)寫(xiě)一下獲取總記錄數(shù)根據(jù)上一個(gè)繼續(xù)編寫(xiě)
1.在IUserInfoDAO中編寫(xiě)
1 //2.獲取總記錄數(shù) 2 public int getTotalCount(); View CodeIUserInfoDAO.xml
1 <!--2.獲取總記錄數(shù)--> 2 <select id="getTotalCount" resultType="int"> 3 select count(1) from smbms_user 4 </select> View Code 2.Service層IUserInfoService 1 //2.獲取總記錄數(shù) 2 public int getTotalCount(); View Code
Service層下的impl包中定義一個(gè)類實(shí)現(xiàn)接口IUserInfoServiceImpl
1 @Service("userService") 2 public class UserInfoServiceImpl implements IUserInfoService { 3 4 //植入dao對(duì)象 5 @Resource(name = "IUserInfoDAO") 6 IUserInfoDAO userInfoDAO; 7 //2.獲取總記錄數(shù) 8 public int getTotalCount() { 9 return userInfoDAO.getTotalCount(); 10 } View Code3.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 Code4.最后來(lái)修改jsp頁(yè)面
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>系統(tǒng)登錄 - 超市賬單管理系統(tǒng)</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>超市賬單管理系統(tǒng)</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="請(qǐng)輸入用戶名" required/> 19 </div> 20 <div class="inputbox"> 21 <label for="mima">密碼:</label> 22 <input id="mima" type="password" name="userPassword" placeholder="請(qǐng)輸入密碼" 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 Codewelcome.jsp
1 <%@ page pageEncoding="utf-8" isELIgnored="false" %> 2 <!DOCTYPE html> 3 <html> 4 <head lang="en"> 5 <meta charset="UTF-8"> 6 <title>超市賬單管理系統(tǒng)</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>超市賬單管理系統(tǒng)</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 <!--時(shí)間--> 22 <section class="publicTime"> 23 <span id="time">2015年1月1日 11:11 星期一</span> 24 <a href="#">溫馨提示:為了能正常瀏覽,請(qǐng)使用高版本瀏覽器!(IE10+)</a> 25 </section> 26 <!--主體內(nèi)容--> 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">供應(yīng)商管理</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">退出系統(tǒng)</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>歡迎來(lái)到超市賬單管理系統(tǒng)!</p> 45 </div> 46 </div> 47 </section> 48 <footer class="footer"> 49 版權(quán)歸北大青鳥(niǎo) 50 </footer> 51 <script src="${pageContext.request.contextPath}/jsp/js/time.js"></script> 52 </body> 53 </html> View CodeuserList.jsp
1 <%@ page pageEncoding="utf-8" isELIgnored="false" %> 2 <!DOCTYPE html> 3 <html> 4 <head lang="en"> 5 <meta charset="UTF-8"> 6 <title>超市賬單管理系統(tǒng)</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>超市賬單管理系統(tǒng)</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 <!--時(shí)間--> 22 <section class="publicTime"> 23 <span id="time">2015年1月1日 11:11 星期一</span> 24 <a href="#">溫馨提示:為了能正常瀏覽,請(qǐng)使用高版本瀏覽器!(IE10+)</a> 25 </section> 26 <!--主體內(nèi)容--> 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">供應(yīng)商管理</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">退出系統(tǒng)</a></li> 37 </ul> 38 </nav> 39 </div> 40 <div class="right"> 41 <div class="location"> 42 <strong>你現(xiàn)在所在的位置是:</strong> 43 <span>用戶管理頁(yè)面</span> 44 </div> 45 <div class="search"> 46 <span>用戶名:</span> 47 <input type="text" placeholder="請(qǐng)輸入用戶名"/> 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>經(jīng)理</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>測(cè)試供應(yīng)商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 <!--點(diǎn)擊刪除按鈕后彈出的頁(yè)面--> 100 <div class="zhezhao"></div> 101 <div class="remove" id="removeUse"> 102 <div class="removerChid"> 103 <h2>提示</h2> 104 <div class="removeMain"> 105 <p>你確定要?jiǎng)h除該用戶嗎?</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 版權(quán)歸北大青鳥(niǎo) 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?
轉(zhuǎn)載于:https://www.cnblogs.com/ruyan886621/p/7427382.html
總結(jié)
以上是生活随笔為你收集整理的超市账单管理------之获取总记录数的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 行内元素和块级元素
- 下一篇: USACO Section 1.5 Pr