你的位置:首页 > 软件开发 > Java > 超市账单管理系统

超市账单管理系统

发布时间:2017-08-23 09:00:08
1.先把架构搭好 . 2.实体类 1 private Integer id; 2 private String userCode; 3 private String userName; 4 private String userPassword; 5 privat ...

超市账单管理系统

 

1.先把架构搭好

超市账单管理系统

 

.超市账单管理系统

 

2.实体类

超市账单管理系统超市账单管理系统
 1 private Integer id; 2  private String userCode; 3  private String userName; 4  private String userPassword; 5  private Integer gender; 6  private Date birthday; 7  private String phone; 8  private String address; 9  private Integer userType;10  private Integer createdBy;11  private Date creationDate;12  private Integer modifyBy;13  private Date modifyDate;
View Code

3.dao层

超市账单管理系统超市账单管理系统
1 public UserInfo login(UserInfo info);//用户登录
View Code

dao层  超市账单管理系统超市账单管理系统

1 <?"1.0" encoding="UTF-8" ?>2 <!DOCTYPE mapper3   PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"4   "">5 <mapper namespace="cn.happy.dao.UserInfoDAO">6  <select id="login" parameterType="UserInfo" resultType="UserInfo">7  select userName,userPassword from smbms_user where userName=#{userName} and userPassword=#{userPassword}8  </select>9 </mapper>
View Code

4.controller层

超市账单管理系统超市账单管理系统
 1 @Controller 2 @RequestMapping("/user") 3 public class UserInfoController { 4  //植入service 5  @Resource(name = "useService") 6  UserInfoService userInfoService; 7  //登录方法 8  @RequestMapping("/doLogin") 9 public String doLogin(HttpSession session, UserInfo info) {10   UserInfo user = userInfoService.login(info);11   if (user != null && user.getUserName() != null) {12    session.setAttribute("userinfo", user.getUserName());13    return "welcome";14 15   } else {16    return "login";17   }18 19  }20 }
View Code

5.service层

超市账单管理系统超市账单管理系统
1 public UserInfo login(UserInfo info);//用户登录
View Code

service层impl包下的类

超市账单管理系统超市账单管理系统
 1 @Service("useService") 2 public class UserInfoServiceImpl implements UserInfoService { 3  @Resource(name = "UserInfoDAO") 4  UserInfoDAO userInfoDAO; 5  6  public UserInfo login(UserInfo info) { 7   return userInfoDAO.login(info); 8  } 9 10 }
View Code

6.applicatioContext.超市账单管理系统超市账单管理系统

 1 <?"1.0" encoding="UTF-8"?> 2 <beans "" 3  "" 4  "" 5  "" 6  "" 7  "" 8  xsi:schemaLocation=" 9  http://www.springframework.org/schema/context 10  http://www.springframework.org/schema/aop 11  http://www.springframework.org/schema/mvc 12  http://www.springframework.org/schema/tx 13 ">14  <!--包扫描器-->15  <context:component-scan base-package="cn.happy"></context:component-scan>16  <!--mvc注解驱动 作用:创建7个HttpMessaeingConvert-->17  <mvc:annotation-driven></mvc:annotation-driven>18  <!--视图解析器-->19  <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">20   <property name="prefix" value="/jsp/"></property>21   <property name="suffix" value=".jsp"></property>22  </bean>23 24  <!--识别到jdbc.properties-->25  <context:property-placeholder location="classpath:jdbc.properties"/>26  <!--1.数据源-->27  <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">28   <property name="driverClass" value="${jdbc.driverClassName}"></property>29   <property name="jdbcUrl" value="${jdbc.url}"></property>30   <property name="user" value="${jdbc.user}"></property>31   <property name="password" value="${jdbc.password}"></property>32  </bean>33 34  <!--2.sqlSessionFactory-->35  <bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">36   <property name="dataSource" ref="dataSource"></property>37   <property name="configLocation" value="classpath:MyBatis-config."></property>38  </bean>39 40  <!--3.dao 认识到Mapper-->41  <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">42   <property name="basePackage" value="cn.happy.dao"></property>43  </bean>44 45  <!--5.事务管理器-->46  <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">47   <property name="dataSource" ref="dataSource"></property>48  </bean>49  <!--6.事务-->50  <tx:annotation-driven transaction-manager="transactionManager"></tx:annotation-driven>51 </beans>
View Code

7.连接到数据库   jdbc.properties   用的是MSQ数据库

超市账单管理系统超市账单管理系统
1 jdbc.driverClassName=com.mysql.jdbc.Driver2 jdbc.url=jdbc:mysql:///smbms3 jdbc.user=root4 jdbc.password=root
View Code

8.MyBatis-config.超市账单管理系统超市账单管理系统

 1 <?"1.0" encoding="UTF-8" ?> 2 <!DOCTYPE configuration 3   PUBLIC "-//mybatis.org//DTD Config 3.0//EN" 4   ""> 5 <configuration> 6  <!--别名--> 7  <typeAliases> 8   <package name="cn.happy.entity"></package> 9  </typeAliases>10  <!-- &lt;!&ndash;关联小配置&ndash;&gt;11  <mappers>12   <mapper resource="cn/sale/dao/IUserDAO."/>13  </mappers>-->14 </configuration>
View Code

 

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

 

最后会登录成功。。。。。。下面会继续更新实现的功能块。。。。尽情期待吧!

原标题:超市账单管理系统

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

可能感兴趣文章

我的浏览记录