Merge remote-tracking branch 'remotes/origin/xhy_branch' into develop

develop
IE-WEB 8 months ago
commit 260825a5e3

@ -0,0 +1,113 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function orderDetail(order_id)//订单明细函数
{
var strUrl="<%=path %>/buy?type=orderDetail&order_id="+order_id;//传入参数
var ret = window.open(strUrl,"","dialogWidth:800px; dialogHeight:500px; dialogLeft: status:no; directories:yes;scrollbars:yes;Resizable=no;");
//点击订单明细弹出窗口宽800px高500px无状态栏目录栏可见有滚动栏不可改变大小
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 我的订单页面的头部菜单栏daohang.jsp -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 我的订单页面的头部菜单栏daohang.jsp -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">我的订单</a></h2>
<div class="entry">
<c:forEach items="${requestScope.orderList}" var="order">
<fieldset style="width:95%; margin-left:5px;"><legend class="fieldtitle"></legend>
<table class="bill" width="97%" cellpadding="4" cellspacing="4">
<tr>
<td>订单编号:${order.bianhao}</td>
</tr>
<tr>
<td>下单时间:${order.shijian}</td>
</tr>
<tr>
<td>
订单状态:
<c:if test="${order.zhuangtai=='no'}"> <!-- if的插入 -->
未受理
</c:if>
<c:if test="${order.zhuangtai=='yes'}">
已受理
</c:if>
</td>
</tr>
<tr>
<td>排队计时:${order.huifu}</td>
</tr>
<tr>
<td>送货地址:${order.songhuodizhi}</td>
</tr>
<tr>
<td>付款方式:${order.fukuanfangshi}</td>
</tr>
<tr>
<td>总金额:${order.jine}&nbsp;
<a href="#" onclick="orderDetail(${order.id})"/>订单明细</a>
</td>
</tr>
</table>
</fieldset>
<br/>
</c:forEach>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧菜品类别 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧菜品类别 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p> <a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -0,0 +1,180 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'orderDetail.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<style type="text/css">
a:link { color: #000000; text-decoration: none } //链接平常的状态,超链接无下划线
a:visited { color: #000000; text-decoration: none } //链接被访问之后,超链接无下划线
a:active { color: #000000; text-decoration: none } //鼠标放到连接上的时候,超链接无下划线
a:hover { color: #ff0000; text-decoration: none; position: relative; right: 0px; top: 1px } //连接被按下的时候,超链接无下划线,相对定位(随窗口大小变化而变化)
.C_Font{ font-weight:bold;}
.Red{ color:#FF0000; font-weight:bold;}
.Sell_Title{ text-align:center;background:url(<%=path %>/images/icon_sell.gif) top no-repeat left;
font-weight:bold; font-size:14px; color:#FFFFFF; height:30px;}
.UserName{ padding:4px 0;}
.UserName input{ width:100px; border:1px solid #666;}
.UserRegster{ padding:5px 8px 5px 0;}
.UserRegster a,.UserRegster a:link,.UserRegster a:visited{ color:#f50;}
.UserRegster input{ background:url(<%=path %>/images/button.gif) no-repeat; width:73px; height:23px; border:0px; cursor:hand;}
.LoginTitle{text-align:center;background:url(<%=path %>/images/icon_login.gif) top no-repeat left;font-weight:bold; font-size:14px; color:#FFFFFF; height:30px;}
.Logo{ text-align:center; vertical-align:top; margin:8px 0;}
.Item01Menu{ text-align:right; vertical-align:top;}
.Item01Menu a{ padding:2px 10px; background:url(<%=path %>/images/dot_main01.gif) no-repeat left;}
.C_Item_Title{ background:url(<%=path %>/images/icon05.gif) no-repeat center;font-weight:bold; text-align:center; color:#fff; height:34px;}
.C_Item_Title a,.C_Item_Title a:link,.C_Item_Title a:visited{font-weight:bold; text-align:center; color:#fff;}
.C_login_Title{ background:url(<%=path %>/images/heng.gif) no-repeat center;font-weight:bold;font-size:12px; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_Sell_Title{ background:url(<%=path %>/images/icon03.gif) no-repeat center;font-weight:bold; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_DC_Title{ background:url(<%=path %>/images/DC.gif) no-repeat center;font-weight:bold; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_Sort_Title{ background:url(<%=path %>/images/heng.gif) no-repeat center;font-weight:bold;font-size:12px; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_Sort_Title a,.C_Sort_Title a:link,.C_Sort_Title a:visited{ color:#fff;}
.C_Search_Title{ background:url(<%=path %>/images/Recomm_05.gif) no-repeat center;font-weight:bold; text-align:center; color:#fff; height:34px; padding-top:10px;}
.C_Help_Title{ padding:4px 0;}
.C_Help_Title a{ background:url(<%=path %>/images/icon_sell.gif) no-repeat center;font-weight:bold; color:#fff; height:24px; padding-left:15px; width:175px; padding-top:5px;}
.C_Help_Title a,.C_Help_Title a:link,.C_Help_Title a:visited{ color:#fff;}
.C_Goods_Title{ border:1px solid #ccc; background:url(<%=path %>/images/Bule_46.gif) repeat-x; margin-bottom:5px; height:32px;}
.C_Goods_Border{ border-top:4px solid #4380CC; padding-top:10px;}
.C_Item_bg{ background:url(<%=path %>/images/Bule_56.gif) repeat-y; padding:3px 8px;}
.C_pages{ padding:5px 10px; text-align:center;}
.C_Input{ background:url(<%=path %>/images/button2.gif) no-repeat; width:73px; height:23px; border:0px; cursor:hand; color:#333;}
.input{ color:#f50;height:18px; }
.C_Input02{background:url(<%=path %>/images/button.gif) no-repeat; width:73px; height:23px; border:0px; cursor:hand; color:#333;}
.C_Input03{background:url(<%=path %>/images/btn_2.png) no-repeat; width:69px; height:28px; border:0px; cursor:hand; color:#fff;}
.Register{background:url(<%=path %>/images/btn_1.png) no-repeat; width:105px; height:28px; border:0px; cursor:hand; text-align:center; padding-top:6px;}
//no-repeat不平铺
.Order_Table{ margin:15px 0;}
.Order_Table td{ font-size:14px;}
.Order_Font{ color:#FF0000; font-weight:bold;}
.Order_Title{ font-size:14px; font-weight:bold; padding:4px 5px;}
.Order_Total{ font-weight:bold; padding:5px 10px 0 10px; color:#FF0000; text-align:center; font-size:14px;}
.Car_Leftbg{ background:url(<%=path %>/images/Car_05.gif) repeat-y left; width:8px;}
.Car_Rightbg{ background:url(<%=path %>/images/Car_13.gif) repeat-y right; width:8px;}
.C_Carbg_Default{ background:url(<%=path %>/images/Car_21.gif) no-repeat center;font-size:12px; text-align:center; width:150px;}
.C_Carbg_Current{ background:url(<%=path %>/images/Car_18.gif) no-repeat center;font-size:12px; text-align:center; color:#fff; width:150px;}
.Onlinpay{
}
.Onlinpay input{ background:url(<%=path %>/images/Car_icon_07.gif) no-repeat center; width:115px; height:30px; border:0px; cursor:hand; padding-bottom:8px; padding-right:8px;}
.textBox{
border-bottom:1px;
border-left:1px;
border-right:1px;
border-top:1px;
border-color:#666666;
border-style:solid;
}
.itemTitle {
font-family: "黑体", "Arial Black";
font-size: 16px;
line-height: 40px;
font-weight: 200;
color: #000000;
text-decoration: none;
letter-spacing: 5px;
} //字母间距5px
.blueText {
font-family: "宋体", System;
font-size: 12px;
line-height: 20px;
color: #0033CC;
text-decoration: none;
}
.redText {
font-family: "宋体", System;
font-size: 12px;
line-height: 20px;
color: #FF0000;
text-decoration: none;
}
.text {
font-family: "宋体", System;
font-size: 12px;
line-height: 20px;
color: #000000;
text-decoration: none;
}
.body {
margin-left: 0px;
margin-top: 2px;
margin-right: 0px;
margin-bottom: 2px;
background-image: url(<%=path %>/images/backGroup.gif);
}
.header_menu{background:url(<%=path %>/images/header_menu_02.gif) repeat-x;}
.whiteTitle{
font-family: "宋体", System;
font-size: 13px;
line-height: 20px;
font-weight: bold;
color: #FFFFFF;
text-decoration: none;
}
.whiteText {
font-family: "宋体", System;
font-size: 12px;
line-height: 20px;
color: #FFFFFF;
text-decoration: none;
}
.blackTitle {
font-family: "宋体", System;
font-size: 12px;
font-weight: bold;
line-height: 20px;
color: #000000;
text-decoration: none;
}
</style>
</head>
<body class="body" leftmargin="0" rightmargin="0">
<table cellspacing="1" cellpadding="0" width="100%" border="0" bgcolor="#F7F3F7">
<tr height="26">
<td class="blackTitle" align="center">商品名称</td>
<td class="blackTitle" align="center">购买数量</td>
<td class="blackTitle" align="center">购买价格</td>
</tr>
<c:forEach items="${requestScope.orderItemList}" var="orderItem">
<tr class="text" align="center" bgcolor="#FFFFFF">
<td>${orderItem.goods.mingcheng}</td>
<td>${orderItem.goods_quantity}</td>
<td>${orderItem.goods.tejia}</td>
</tr>
</c:forEach>
</table>
</body>
</html>

@ -0,0 +1,123 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> <!-- 订单填写界面 -->
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function back1() //返回之前的页面
{
window.history.go(-1);
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部各种功能 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部各种功能 -->
<div id="page">
<div id="page-bgtop">
<!--右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">填写订单</a></h2>
<div class="entry">
<form action="<%=path %>/buy?type=orderSubmit" name="f" method="post">
<table width="98%" align="center" border="0" cellpadding="9" cellspacing="9">
<tr align='center'>
<td width="20%" bgcolor="#FFFFFF" align="left">
收货人帐号:
</td>
<td width="80%" bgcolor="#FFFFFF" align="left">
<input type="text" readonly="readonly" value="${sessionScope.user.loginname}"/>
</td>
</tr>
<tr align='center'>
<td width="20%" bgcolor="#FFFFFF" align="left">
收货人姓名:
</td>
<td width="80%" bgcolor="#FFFFFF" align="left">
<input type="text" readonly="readonly" value="${sessionScope.user.name}"/>
</td>
</tr>
<tr align='center'>
<td width="20%" bgcolor="#FFFFFF" align="left">
送货地址:
</td>
<td width="80%" bgcolor="#FFFFFF" align="left">
<input type="text" name="songhuodizhi"/>
</td>
</tr>
<tr align='center'>
<td width="20%" bgcolor="#FFFFFF" align="left">
付款方式:
</td>
<td width="80%" bgcolor="#FFFFFF" align="left">
<select name="fukuanfangshi" style="width:155px;">
<option value="货到付款">货到付款</option>
</select> <!-- 下拉菜单 -->
</td>
</tr>
</table>
<table>
<tr height="7"><td></td></tr>
<tr>
<td width="120"></td>
<td>
<input type="button" value="返回" style="width: 80px;height: 30px;" onclick="back1()">
</td>
<td>
<input type="button" value="提交订单" style="width: 80px;height: 30px;" onclick="javascript:document.f.submit();">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧菜品类别 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧菜品类别 -->
<div style="clear: both;">&nbsp;</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -0,0 +1,94 @@
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function back1()//返回之前的界面
{
window.history.go(-1);
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<!-- 头部各种功能 -->
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
</div>
<!-- 头部各种功能 -->
<div id="page">
<div id="page-bgtop">
<!-- 右侧 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#"></a></h2>
<div class="entry">
<table width="99%" border="0" cellpadding="5" cellspacing="5" bgcolor="#FFFFFF" align="center" style="margin-top:8px">
<tr>
<td align="left" style="color: red">恭喜您,订单提交成功!</td>
</tr>
<tr>
<td style="font-size: 15px;">订单编号:${requestScope.order.bianhao }</td>
</tr>
<tr>
<td style="font-size: 15px;">总金额:${requestScope.order.jine }</td>
</tr>
<tr>
<td style="font-size: 15px;">下单日期:${requestScope.order.shijian }</td>
</tr>
<tr>
<td style="font-size: 15px;">送货地址:${requestScope.order.songhuodizhi }</td>
</tr>
<tr>
<td style="font-size: 15px;">付款方式:${requestScope.order.fukuanfangshi }</td>
</tr>
</table>
</div>
</div>
</div>
<!-- 右侧 -->
<!-- 左侧菜品类别 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include>
</div>
<!-- 左侧菜品类别 -->
<div style="clear: both;">&nbsp;</div> <!--clear:both该属性的值指出了不允许有浮动元素 -->
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>

@ -0,0 +1,38 @@
package com.itbaizhan.orm;
public class TAdmin { // 管理员类
private int userId; // 管理员用户ID
private String userName; // 管理员用户名
private String userPw; // 管理员密码
// 得到管理员用户名
public String getUserName() {
return userName;
}
// 设置管理员用户名
public void setUserName(String userName) {
this.userName = userName;
}
// 得到管理员密码
public String getUserPw() {
return userPw;
}
// 设置管理员密码
public void setUserPw(String userPw) {
this.userPw = userPw;
}
// 得到管理员用户ID
public int getUserId() {
return userId;
}
// 设置管理员用户ID
public void setUserId(int userId) {
this.userId = userId;
}
}

@ -0,0 +1,146 @@
package com.itbaizhan.orm;
/**
* TLiuyan -
*
*
*
*/
public class TLiuyan implements java.io.Serializable {
private Integer id; // 留言ID唯一标识每一条留言
private String neirong; // 留言内容,用户输入的留言文本
private String liuyanshi; // 留言时间,记录用户留言的时间
private String user_id; // 用户ID标识留言所属的用户
private String huifu; // 回复内容,管理员或用户对留言的回复
private String huifushi; // 回复时间,记录回复的时间
private Tuser user; // 用户信息关联留言所属的用户对象Tuser
/**
*
*
* @return
*/
public String getHuifu() {
return huifu;
}
/**
*
*
* @param huifu
*/
public void setHuifu(String huifu) {
this.huifu = huifu;
}
/**
*
*
* @return
*/
public String getHuifushi() {
return huifushi;
}
/**
*
*
* @param huifushi
*/
public void setHuifushi(String huifushi) {
this.huifushi = huifushi;
}
/**
* ID
*
* @return ID
*/
public Integer getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(Integer id) {
this.id = id;
}
/**
*
*
* @return
*/
public String getLiuyanshi() {
return liuyanshi;
}
/**
*
*
* @param liuyanshi
*/
public void setLiuyanshi(String liuyanshi) {
this.liuyanshi = liuyanshi;
}
/**
*
*
* @return
*/
public String getNeirong() {
return neirong;
}
/**
*
*
* @param neirong
*/
public void setNeirong(String neirong) {
this.neirong = neirong;
}
/**
*
*
* @return Tuser
*/
public Tuser getUser() {
return user;
}
/**
*
*
* @param user Tuser
*/
public void setUser(Tuser user) {
this.user = user;
}
/**
* ID
*
* @return ID
*/
public String getUser_id() {
return user_id;
}
/**
* ID
*
* @param user_id ID
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
}

@ -0,0 +1,34 @@
package com.itbaizhan.orm;
public class Tcatelog //菜品类别类
{
private String id;//菜品类别ID
private String name;//菜品类别名称
private String del;//菜品类别是否删除标志
public String getDel()//得到是否删除信息
{
return del;
}
public void setDel(String del)//设置是否删除信息
{
this.del = del;
}
public String getName()//得到菜品类别名信息
{
return name;
}
public void setName(String name)//设置菜品类别名信息
{
this.name = name;
}
public String getId()//得到菜品类别ID信息
{
return id;
}
public void setId(String id)//设置菜品类别ID信息
{
this.id = id;
}
}

@ -0,0 +1,104 @@
package com.itbaizhan.orm;
public class Tgoods { // 菜品信息类
private String id; // 菜品的ID
private String catelog_id; // 菜品类别的ID
private String bianhao; // 菜品的编号
private String mingcheng; // 菜品的名称
private String jieshao; // 菜品的介绍
private String fujian; // 菜品的图片
private int shichangjia; // 菜品的市场价
private int tejia; // 菜品的特价
private String del; // 菜品是否删除标志
// 获取菜品编号
public String getBianhao() {
return bianhao;
}
// 设置菜品编号
public void setBianhao(String bianhao) {
this.bianhao = bianhao;
}
// 获取菜品类别ID
public String getCatelog_id() {
return catelog_id;
}
// 设置菜品类别ID
public void setCatelog_id(String catelog_id) {
this.catelog_id = catelog_id;
}
// 获取菜品是否删除信息
public String getDel() {
return del;
}
// 设置菜品是否删除信息
public void setDel(String del) {
this.del = del;
}
// 获取菜品图片信息
public String getFujian() {
return fujian;
}
// 设置菜品图片信息
public void setFujian(String fujian) {
this.fujian = fujian;
}
// 获取菜品ID信息
public String getId() {
return id;
}
// 设置菜品ID信息
public void setId(String id) {
this.id = id;
}
// 获取菜品介绍信息
public String getJieshao() {
return jieshao;
}
// 设置菜品介绍信息
public void setJieshao(String jieshao) {
this.jieshao = jieshao;
}
// 获取菜品名称信息
public String getMingcheng() {
return mingcheng;
}
// 设置菜品名称信息
public void setMingcheng(String mingcheng) {
this.mingcheng = mingcheng;
}
// 获取菜品市场价信息
public int getShichangjia() {
return shichangjia;
}
// 设置菜品市场价信息
public void setShichangjia(int shichangjia) {
this.shichangjia = shichangjia;
}
// 获取菜品特价信息
public int getTejia() {
return tejia;
}
// 设置菜品特价信息
public void setTejia(int tejia) {
this.tejia = tejia;
}
}

@ -0,0 +1,186 @@
package com.itbaizhan.orm;
/**
* Torder -
*
*
* 线
*/
public class Torder implements java.io.Serializable {
private String id; // 订单ID唯一标识每一个订单
private String bianhao; // 订单编号,订单的唯一标识符(通常为系统自动生成)
private String shijian; // 下单时间,用户创建订单的时间
private String zhuangtai; // 订单状态,例如:待支付、已支付、已发货、已完成、已取消等
private String huifu; // 回复内容,可能用于管理员对订单的反馈或备注
private String songhuodizhi; // 送货地址,用户填写的送货地址
private String fukuanfangshi; // 付款方式,例如:信用卡、支付宝、现金等
private int jine = 0; // 总金额,订单的总费用
private String user_id; // 用户ID表示该订单所属的用户
/** 默认构造函数 */
public Torder() {
}
/**
*
*
* @return
*/
public String getBianhao() {
return bianhao;
}
/**
*
*
* @param bianhao
*/
public void setBianhao(String bianhao) {
this.bianhao = bianhao;
}
/**
*
*
* @return
*/
public String getFukuanfangshi() {
return fukuanfangshi;
}
/**
*
*
* @param fukuanfangshi
*/
public void setFukuanfangshi(String fukuanfangshi) {
this.fukuanfangshi = fukuanfangshi;
}
/**
* ID
*
* @return ID
*/
public String getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(String id) {
this.id = id;
}
/**
*
*
* @return
*/
public int getJine() {
return jine;
}
/**
*
*
* @return
*/
public String getHuifu() {
return huifu;
}
/**
*
*
* @param huifu
*/
public void setHuifu(String huifu) {
this.huifu = huifu;
}
/**
*
*
* @param jine
*/
public void setJine(int jine) {
this.jine = jine;
}
/**
*
*
* @return
*/
public String getShijian() {
return shijian;
}
/**
*
*
* @param shijian
*/
public void setShijian(String shijian) {
this.shijian = shijian;
}
/**
*
*
* @return
*/
public String getSonghuodizhi() {
return songhuodizhi;
}
/**
*
*
* @param songhuodizhi
*/
public void setSonghuodizhi(String songhuodizhi) {
this.songhuodizhi = songhuodizhi;
}
/**
* ID
*
* @return ID
*/
public String getUser_id() {
return user_id;
}
/**
* ID
*
* @param user_id ID
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
/**
*
*
* @return
*/
public String getZhuangtai() {
return zhuangtai;
}
/**
*
*
* @param zhuangtai
*/
public void setZhuangtai(String zhuangtai) {
this.zhuangtai = zhuangtai;
}
}

@ -0,0 +1,107 @@
package com.itbaizhan.orm;
/**
* TorderItem -
*
* IDID
*
*/
public class TorderItem {
private String id; // 订单明细ID唯一标识每个订单明细项
private String order_id; // 订单ID表示该订单明细项所属的订单
private String goods_id; // 商品ID表示该明细项对应的商品
private int goods_quantity; // 商品数量,表示该商品在该订单中的数量
private Tgoods goods; // 商品对象,关联商品详细信息(额外的字段)
/**
*
*
* @return
*/
public int getGoods_quantity() {
return goods_quantity;
}
/**
*
*
* @param goods_quantity
*/
public void setGoods_quantity(int goods_quantity) {
this.goods_quantity = goods_quantity;
}
/**
* ID
*
* @return ID
*/
public String getGoods_id() {
return goods_id;
}
/**
* ID
*
* @param goods_id ID
*/
public void setGoods_id(String goods_id) {
this.goods_id = goods_id;
}
/**
* ID
*
* @return ID
*/
public String getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(String id) {
this.id = id;
}
/**
* ID
*
* @return ID
*/
public String getOrder_id() {
return order_id;
}
/**
* ID
*
* @param order_id ID
*/
public void setOrder_id(String order_id) {
this.order_id = order_id;
}
/**
*
*
* @return
*/
public Tgoods getGoods() {
return goods;
}
/**
*
*
* @param goods
*/
public void setGoods(Tgoods goods) {
this.goods = goods;
}
}

@ -0,0 +1,106 @@
package com.itbaizhan.orm;
/**
* Tuser -
*
*
*
*/
public class Tuser {
private String id; // 用户ID唯一标识每个用户
private String loginname; // 用户登录账号,用户用于登录系统的唯一账号
private String loginpw; // 用户登录密码,用户登录系统时输入的密码
private String name; // 用户姓名,用户的真实姓名或显示名
private String del; // 是否删除标志,表示用户是否已被删除或禁用(逻辑删除)
/**
* ID
*
* @return ID
*/
public String getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(String id) {
this.id = id;
}
/**
*
*
* @return
*/
public String getLoginname() {
return loginname;
}
/**
*
*
* @param loginname
*/
public void setLoginname(String loginname) {
this.loginname = loginname;
}
/**
*
*
* @return
*/
public String getLoginpw() {
return loginpw;
}
/**
*
*
* @param loginpw
*/
public void setLoginpw(String loginpw) {
this.loginpw = loginpw;
}
/**
*
*
* @return
*/
public String getDel() {
return del;
}
/**
*
*
* @param del
*/
public void setDel(String del) {
this.del = del;
}
/**
*
*
* @return
*/
public String getName() {
return name;
}
/**
*
*
* @param name
*/
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,105 @@
package com.itbaizhan.orm;
/**
* Txinyong -
*
* IDID
*/
public class Txinyong {
private String id; // 评价ID唯一标识每条评价
private String shuxing; // 评价属性,管理员根据不同的标准对用户进行评价的属性(如信用、表现等)
private String neirong; // 评价内容,具体的评价文字或描述
private String shijian; // 评价时间,管理员进行评价的时间
private String user_id; // 用户ID标识被评价的用户
/**
* ID
*
* @return ID
*/
public String getId() {
return id;
}
/**
* ID
*
* @param id ID
*/
public void setId(String id) {
this.id = id;
}
/**
*
*
* @return
*/
public String getShuxing() {
return shuxing;
}
/**
*
*
* @param shuxing
*/
public void setShuxing(String shuxing) {
this.shuxing = shuxing;
}
/**
*
*
* @return
*/
public String getNeirong() {
return neirong;
}
/**
*
*
* @param neirong
*/
public void setNeirong(String neirong) {
this.neirong = neirong;
}
/**
*
*
* @return
*/
public String getShijian() {
return shijian;
}
/**
*
*
* @param shijian
*/
public void setShijian(String shijian) {
this.shijian = shijian;
}
/**
* ID
*
* @return ID
*/
public String getUser_id() {
return user_id;
}
/**
* ID
*
* @param user_id ID
*/
public void setUser_id(String user_id) {
this.user_id = user_id;
}
}

@ -0,0 +1,88 @@
package com.itbaizhan.service;
import javax.servlet.http.HttpSession;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import com.itbaizhan.util.Cart;
/**
* (cartService)
*
*
* 使 session
*/
public class cartService {
/**
*
*
* @param goodsId ID
* @param quantity
* @return ("yes" )
*/
public String modiNum(String goodsId, int quantity) {
String result = ""; // 初始化操作结果为空
// 获取 WebContext 上下文
WebContext ctx = WebContextFactory.get(); // 通过 DWR (Direct Web Remoting) 获取 WebContext
HttpSession session = ctx.getSession(); // 获取当前会话对象
// 获取购物车对象
Cart cart = (Cart) session.getAttribute("cart");
// 更新购物车中的商品数量
cart.updateCart(goodsId, quantity);
// 更新 session 中的购物车对象
session.setAttribute("cart", cart);
// 设置操作结果为 "yes" 表示成功
result = "yes";
return result;
}
/**
*
*
* @param goodsId ID
* @return ("yes" )
*/
public String delGoodsFromCart(String goodsId) {
// 获取 WebContext 上下文
WebContext ctx = WebContextFactory.get(); // 通过 DWR 获取 WebContext
HttpSession session = ctx.getSession(); // 获取当前会话对象
// 获取购物车对象
Cart cart = (Cart) session.getAttribute("cart");
// 从购物车中删除指定商品
cart.delGoods(goodsId);
// 更新 session 中的购物车对象
session.setAttribute("cart", cart);
return "yes"; // 返回成功标志
}
/**
*
*
* @return ("yes" )
*/
public String clearCart() {
// 获取 WebContext 上下文
WebContext ctx = WebContextFactory.get(); // 通过 DWR 获取 WebContext
HttpSession session = ctx.getSession(); // 获取当前会话对象
// 获取购物车对象
Cart cart = (Cart) session.getAttribute("cart");
// 清空购物车中的所有商品
cart.getItems().clear();
// 更新 session 中的购物车对象
session.setAttribute("cart", cart);
return "yes"; // 返回成功标志
}
}

@ -0,0 +1,344 @@
package com.itbaizhan.service;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.Tcatelog;
import com.itbaizhan.orm.Tgoods;
import com.itbaizhan.orm.Torder;
import com.itbaizhan.orm.TorderItem;
import com.itbaizhan.orm.Txinyong;
/**
* liuService
*
*
*/
public class liuService {
/**
* ID
*
* @return List ID
*/
public static List catelogList() {
List catelogList = new ArrayList(); // 初始化菜品种类列表
String sql = "select * from t_catelog where del='no'"; // 查询未被删除的菜品种类
Object[] params = {}; // 设置查询参数为空
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行 SQL 查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Tcatelog catelog = new Tcatelog(); // 创建 Tcatelog 对象
catelog.setId(rs.getString("id")); // 设置菜品类别 ID
catelog.setName(rs.getString("name")); // 设置菜品类别名称
catelogList.add(catelog); // 将菜品类别添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return catelogList; // 返回菜品类别列表
}
/**
*
*
* @param id ID
* @return Tgoods
*/
public static Tgoods getGoods(String id) {
Tgoods goods = new Tgoods(); // 初始化商品对象
String sql = "select * from t_goods where id=?"; // 查询指定商品的 SQL 语句
Object[] params = { id }; // 设置查询参数为商品 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
rs.next(); // 移动到第一行(只查询一条记录)
// 设置商品属性
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return goods; // 返回商品对象
}
/**
* ID 8
*
* @return
*/
public static List goodsNew() {
List goodsList = new ArrayList(); // 初始化商品列表
String sql = "select * from t_goods where del='no' order by id desc"; // 查询未删除的商品,按 ID 降序排列
Object[] params = {}; // 设置查询参数为空
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Tgoods goods = new Tgoods(); // 创建 Tgoods 对象
// 设置商品属性
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods); // 将商品添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
// 限制返回最多 8 个商品
if (goodsList.size() > 8) {
goodsList = goodsList.subList(0, 8);
}
return goodsList; // 返回最新商品列表
}
/**
* ID
*
* @param catelog_id ID
* @return
*/
public static List goodsByCatelog(String catelog_id) {
List goodsList = new ArrayList(); // 初始化商品列表
String sql = "select * from t_goods where del='no' and catelog_id=? order by id desc"; // 根据类别 ID 查询商品
Object[] params = { catelog_id }; // 设置查询参数为菜品类别 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Tgoods goods = new Tgoods(); // 创建 Tgoods 对象
// 设置商品属性
goods.setId(rs.getString("id"));
goods.setCatelog_id(rs.getString("catelog_id"));
goods.setBianhao(rs.getString("bianhao"));
goods.setMingcheng(rs.getString("mingcheng"));
goods.setJieshao(rs.getString("jieshao"));
goods.setFujian(rs.getString("fujian"));
goods.setShichangjia(rs.getInt("shichangjia"));
goods.setTejia(rs.getInt("tejia"));
goods.setDel(rs.getString("del"));
goodsList.add(goods); // 将商品添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return goodsList; // 返回商品列表
}
/**
*
*
* @param order
*/
public static void saveOrder(Torder order) {
String sql = "insert into t_order(id,bianhao,shijian,zhuangtai,huifu,songhuodizhi,fukuanfangshi,jine,user_id) values(?,?,?,?,?,?,?,?,?)";
Object[] params = { order.getId(), order.getBianhao(), order.getShijian(), order.getZhuangtai(),
order.getHuifu(), order.getSonghuodizhi(), order.getFukuanfangshi(), order.getJine(), order.getUser_id() };
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行插入操作
mydb.closed(); // 关闭数据库连接
}
/**
*
*
* @param id ID
* @param order_id ID
* @param goods_id ID
* @param goods_quantity
*/
public static void saveOrderItem(String id, String order_id, String goods_id, int goods_quantity) {
String sql = "insert into t_orderitem(id,order_id,goods_id,goods_quantity) values(?,?,?,?)";
Object[] params = { id, order_id, goods_id, goods_quantity };
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行插入操作
mydb.closed(); // 关闭数据库连接
}
/**
*
*
* @param goods_id ID
* @param goods_quantity
*/
public static void updateGoodsKucun(String goods_id, int goods_quantity) {
String sql = "update t_goods set kucun=kucun-? where id=?";
Object[] params = { goods_quantity, goods_id };
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行更新操作
mydb.closed(); // 关闭数据库连接
}
/**
*
*
* @param user_id ID
* @return
*/
public static List orderList(String user_id) {
List orderList = new ArrayList(); // 初始化订单列表
String sql = "select * from t_order where user_id=?"; // 查询该用户的所有订单
Object[] params = { user_id }; // 设置查询参数为用户 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Torder order = new Torder(); // 创建 Torder 对象
// 设置订单属性
order.setId(rs.getString("id"));
order.setBianhao(rs.getString("bianhao"));
order.setShijian(rs.getString("shijian"));
order.setZhuangtai(rs.getString("zhuangtai"));
order.setHuifu(rs.getString("huifu"));
order.setSonghuodizhi(rs.getString("songhuodizhi"));
order.setFukuanfangshi(rs.getString("fukuanfangshi"));
order.setJine(rs.getInt("jine"));
order.setUser_id(rs.getString("user_id"));
orderList.add(order); // 将订单添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return orderList; // 返回订单列表
}
/**
*
*
* @param order_id ID
* @return
*/
public static List orderItemList(String order_id) {
List orderitemList = new ArrayList(); // 初始化订单商品列表
String sql = "select * from t_orderitem where order_id=?"; // 查询订单中包含的商品
Object[] params = { order_id }; // 设置查询参数为订单 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
TorderItem orderItem = new TorderItem(); // 创建 TorderItem 对象
// 设置订单商品属性
orderItem.setId(rs.getString("id"));
orderItem.setGoods(getGoods(rs.getString("goods_id"))); // 获取商品信息
orderItem.setGoods_quantity(rs.getInt("goods_quantity")); // 设置商品数量
orderitemList.add(orderItem); // 将订单商品添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return orderitemList; // 返回订单商品列表
}
/**
*
*
* @param loginname
* @return "yizhan" "meizhan"
*/
public static String panduan_zhanghao(String loginname) {
String s = "meizhan"; // 默认返回“没占用”
String sql = "select * from t_user where del='no' and loginname=?"; // 查询账号是否存在
Object[] params = { loginname.trim() }; // 设置查询参数为账号
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 如果查询到结果,表示账号已存在
s = "yizhan"; // 账号已占用
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return s; // 返回账号是否已占用
}
/**
*
*
* @param user_id ID
* @return
*/
public static List getxinyongList(String user_id) {
List xinyongList = new ArrayList(); // 初始化信用信息列表
String sql = "select * from t_xinyong where user_id=?"; // 查询该用户的信用信息
Object[] params = { user_id }; // 设置查询参数为用户 ID
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Txinyong xinyong = new Txinyong(); // 创建 Txinyong 对象
// 设置信用信息属性
xinyong.setId(rs.getString("id"));
xinyong.setShuxing(rs.getString("shuxing"));
xinyong.setNeirong(rs.getString("neirong"));
xinyong.setShijian(rs.getString("shijian"));
xinyong.setUser_id(rs.getString("user_id"));
xinyongList.add(xinyong); // 将信用信息添加到列表
}
rs.close(); // 关闭结果集
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return xinyongList; // 返回信用信息列表
}
}

@ -0,0 +1,166 @@
package com.itbaizhan.service;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.directwebremoting.WebContext;
import org.directwebremoting.WebContextFactory;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.TAdmin;
import com.itbaizhan.orm.Tcatelog;
import com.itbaizhan.orm.Tuser;
import com.itbaizhan.util.Cart;
public class loginService {
/**
*
*
* session
*
* @param userName
* @param userPw
* @param userType 012
* @return "yes" "no"
*/
public String login(String userName, String userPw, int userType) {
String result = "no"; // 默认登录失败
if (userType == 0) { // 系统管理员登录
String sql = "select * from t_admin where userName=? and userPw=?";
Object[] params = { userName, userPw };
DB mydb = new DB();
mydb.doPstm(sql, params);
try {
ResultSet rs = mydb.getRs(); // 获取查询结果集
boolean mark = (rs == null || !rs.next() ? false : true); // 判断查询结果是否为空
if (!mark) {
result = "no"; // 登录失败
} else {
result = "yes"; // 登录成功
TAdmin admin = new TAdmin();
admin.setUserId(rs.getInt("userId"));
admin.setUserName(rs.getString("userName"));
admin.setUserPw(rs.getString("userPw"));
WebContext ctx = WebContextFactory.get(); // 获取 WebContext 对象
HttpSession session = ctx.getSession();
session.setAttribute("userType", 0); // 设置用户类型为管理员
session.setAttribute("admin", admin); // 将管理员信息存入 session
}
rs.close();
} catch (SQLException e) {
System.out.println("登录失败!");
e.printStackTrace();
} finally {
mydb.closed();
}
}
if (userType == 1) { // 会员登录
String sql = "select * from t_user where loginname=? and loginpw=? and del='no'";
Object[] params = { userName, userPw };
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行 SQL 查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
boolean mark = (rs == null || !rs.next() ? false : true); // 判断查询结果是否为空
if (!mark) {
result = "no"; // 登录失败
} else {
result = "yes"; // 登录成功
Tuser user = new Tuser();
user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setName(rs.getString("name"));
user.setDel(rs.getString("del"));
WebContext ctx = WebContextFactory.get(); // 获取 WebContext 对象
HttpSession session = ctx.getSession();
session.setAttribute("userType", 1); // 设置用户类型为会员
session.setAttribute("user", user); // 将用户信息存入 session
// 创建一个空的购物车对象,存入 session
Cart cart = new Cart();
session.setAttribute("cart", cart);
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed();
}
if (userType == 2) {
// 用户类型为 2 的登录逻辑可以在这里添加(暂未实现)
}
return result; // 返回登录结果
}
/**
*
*
*
* @param userPwNew
* @return "yes"
*/
public String adminPwEdit(String userPwNew) {
System.out.println("DDDD");
try {
Thread.sleep(700); // 确保线程运行顺序
} catch (InterruptedException e) {
e.printStackTrace();
}
WebContext ctx = WebContextFactory.get(); // 获取 WebContext 对象
HttpSession session = ctx.getSession();
TAdmin admin = (TAdmin) session.getAttribute("admin"); // 获取当前登录的管理员对象
String sql = "update t_admin set userPw=? where userId=?";
Object[] params = { userPwNew, admin.getUserId() }; // 设置更新的参数
DB mydb = new DB();
mydb.doPstm(sql, params); // 执行更新操作
return "yes"; // 返回修改成功的结果
}
/**
*
*
*
* @return
*/
public List catelogAll() {
try {
Thread.sleep(700); // 确保线程运行顺序
} catch (InterruptedException e) {
e.printStackTrace();
}
List catelogList = new ArrayList(); // 初始化菜品类别列表
String sql = "select * from t_catelog where del='no'"; // 查询未删除的菜品类别
Object[] params = {};
DB mydb = new DB();
try {
mydb.doPstm(sql, params); // 执行查询
ResultSet rs = mydb.getRs(); // 获取查询结果集
while (rs.next()) { // 遍历结果集
Tcatelog catelog = new Tcatelog();
catelog.setId(rs.getString("id")); // 设置菜品类别 ID
catelog.setName(rs.getString("name")); // 设置菜品类别名称
catelogList.add(catelog); // 将菜品类别添加到列表
}
rs.close();
} catch (Exception e) {
e.printStackTrace();
}
mydb.closed(); // 关闭数据库连接
return catelogList; // 返回菜品类别列表
}
}

@ -0,0 +1,199 @@
package com.itbaizhan.action;
import java.io.IOException;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.itbaizhan.dao.DB;
import com.itbaizhan.orm.Tuser;
import com.itbaizhan.service.liuService;
public class user_servlet extends HttpServlet
{
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
String type = req.getParameter("type");
if(type.endsWith("userReg"))
{
userReg(req, res);
}
if(type.endsWith("userLogout"))
{
userLogout(req, res);
}
if(type.endsWith("userMana"))
{
userMana(req, res);
}
if(type.endsWith("userDel"))
{
userDel(req, res);
}
if(type.endsWith("userDetail"))
{
userDetail(req, res);
}
}
public void userReg(HttpServletRequest req, HttpServletResponse res)
{
String id = String.valueOf(new Date().getTime());
String loginname = req.getParameter("loginname");
String loginpw = req.getParameter("loginpw");
String name = req.getParameter("name");
String del = "no";
String s = liuService.panduan_zhanghao(loginname);
if(s.equals("yizhan"))
{
req.setAttribute("message", "账号已占用,请重新选择账号");
req.setAttribute("path", "site/userreg/userreg.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
else
{
String sql = "insert into t_user values(?,?,?,?,?)";
Object[] params = {id, loginname, loginpw, name, del};
DB mydb = new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("message", "注册成功,请登录");
req.setAttribute("path", "site/default.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
}
public void userLogout(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
HttpSession session = req.getSession();
session.setAttribute("userType", null);
session.setAttribute("user", null);
req.setAttribute("message", "成功退出系统");
req.setAttribute("path", "site/default.jsp");
String targetURL = "/common/success.jsp";
dispatch(targetURL, req, res);
}
public void userMana(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
List userList = new ArrayList();
String sql = "select * from t_user where del='no'";
Object[] params = {};
DB mydb = new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs = mydb.getRs();
while(rs.next())
{
Tuser user = new Tuser();
user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setLoginpw(rs.getString("loginpw"));
user.setName(rs.getString("name"));
userList.add(user);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("userList", userList);
req.getRequestDispatcher("admin/user/userMana.jsp").forward(req, res);
}
public void userDel(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
String id = req.getParameter("id");
String sql = "update t_user set del='yes' where id=?";
Object[] params = {id};
DB mydb = new DB();
mydb.doPstm(sql, params);
mydb.closed();
req.setAttribute("msg", "用户信息删除成功");
String targetURL = "/common/msg.jsp";
dispatch(targetURL, req, res);
}
public void userDetail(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
{
String id = req.getParameter("id");
List userList = new ArrayList();
String sql = "select * from t_user where id=?";
Object[] params = {id};
DB mydb = new DB();
try
{
mydb.doPstm(sql, params);
ResultSet rs = mydb.getRs();
while(rs.next())
{
Tuser user = new Tuser();
user.setId(rs.getString("id"));
user.setLoginname(rs.getString("loginname"));
user.setLoginpw(rs.getString("loginpw"));
user.setLoginpw(rs.getString("loginpw"));
user.setName(rs.getString("name"));
userList.add(user);
}
rs.close();
}
catch(Exception e)
{
e.printStackTrace();
}
mydb.closed();
req.setAttribute("userList", userList);
req.setAttribute("xinyongList", liuService.getxinyongList(id));
req.getRequestDispatcher("admin/user/userDetail.jsp").forward(req, res);
}
public void dispatch(String targetURI, HttpServletRequest request, HttpServletResponse response)
{
RequestDispatcher dispatch = getServletContext().getRequestDispatcher(targetURI);
try
{
dispatch.forward(request, response);
}
catch (ServletException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
}
public void init(ServletConfig config) throws ServletException
{
super.init(config);
}
public void destroy()
{
}
}

@ -0,0 +1,84 @@
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script type='text/javascript' src='<%=path %>/dwr/interface/loginService.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/engine.js'></script>
<script type='text/javascript' src='<%=path %>/dwr/util.js'></script>
<script type="text/javascript">
function login()//会员登录信息完整的判断
{
if(document.userLogin.loginname.value=="")
{
alert("请输入账号");
return;
}
if(document.userLogin.loginpw.value=="")
{
alert("请输入密码");
return;
}
document.getElementById("indicator").style.display="block";//设置成块级元素,带自动换行
loginService.login(document.userLogin.loginname.value,document.userLogin.loginpw.value,1,callback);//判断账号密码是否正确
}
function callback(data)
{
document.getElementById("indicator").style.display="none";
if(data=="no")//账号密码错误返回fail.jsp页面
{
var url="<%=path %>/common/fail.jsp";
window.location.href=url;
}
if(data!="no")//返回的data就是用户的id当账号密码正确时
{
var url="<%=path %>/common/succ.jsp";
window.location.href=url;
}
}
</script>
</head>
<body>
<form name="userLogin" method="POST" action="">
<table cellspacing="0" cellpadding="0" width="98%" align="center" border="0">
<tr>
<td align="center" colspan="2" height="10"></td>
</tr>
<tr>
<td align="right" width="31%" height="30" style="font-size: 11px;">账号:</td>
<td align="left" width="69%"><input type="text" name="loginname" style="width: 100px;"/></td>
</tr>
<tr>
<td align="right" height="30" style="font-size: 11px;">密码:</td>
<td align="left"><input type="password" name="loginpw" style="width: 100px;"/></td>
</tr>
<tr>
<td align="center" colspan="2" height="5"></td>
</tr>
<tr>
<td align="right" height="30" style="font-size: 11px;">&nbsp;</td>
<td align="left">
<input type="button" value="登 录" onclick="login()" style="border:#ccc 1px solid; background-color:#FFFFFF; font-size:12px; padding-top:3px;" />
&nbsp;
<input type="reset" value="重 置" style="border:#ccc 1px solid; background-color:#FFFFFF; font-size:12px; padding-top:3px;" />
<img id="indicator" src="<%=path %>/images/loading.gif" style="display:none"/> <!-- idindicator插入载入动画 -->
</td>
</tr>
</table>
</form>
</body>
</html>

@ -0,0 +1,122 @@
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><!-- 会员注册页面 -->
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3"/>
<meta http-equiv="description" content="This is my page"/>
<link href="<%=path %>/css/qiantai.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function check1()//会员注册界面信息完整判断
{
if(document.form1.loginname.value=="")
{
alert("请输入账号");
return false;
}
if(document.form1.loginpw.value=="")
{
alert("请输入密码");
return false;
}
document.form1.submit();
}
</script>
</head>
<body>
<div id="wrapper">
<div id="logo">
<h1><a href="#">基于JSP的高校快餐店订餐系统
</a></h1>
<p><em><a href="#">&nbsp;</a></em></p>
</div>
<hr/>
<div id="header">
<jsp:include flush="true" page="/site/inc/daohang.jsp"></jsp:include>
<!-- 进入daohang.jsp导航页面设置如果缓存区满了就输出数据。-->
</div>
<!--标题头部部分-->
<div id="page">
<div id="page-bgtop">
<!-- 中间 -->
<div id="content">
<div class="post">
<h2 class="title"><a href="#">&nbsp;&nbsp;会员注册 </a></h2>
<div class="entry">
<form action="<%=path %>/user?type=userReg" name="form1" method="post">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td width="20%" height="30" align="right" bgcolor="#F9F9F9" style="font-size: 11px;">
账号:
</td>
<td width="80%" bgcolor="#FFFFFF">
&nbsp;
<input type="text" name="loginname" style="width: 200px;"/>
</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#F9F9F9" style="font-size: 11px;">
密码:
</td>
<td bgcolor="#FFFFFF">
&nbsp;
<input type="password" name="loginpw" style="width: 200px;"/>
</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#F9F9F9" style="font-size: 11px;">
姓名:
</td>
<td bgcolor="#FFFFFF">
&nbsp;
<input type="text" name="name" style="width: 200px;"/>
</td>
</tr>
<tr>
<td height="30" align="right" bgcolor="#F9F9F9">
&nbsp;
</td>
<td bgcolor="#FFFFFF">
&nbsp;
<input type="button" value="注册" onclick="check1();"/>
<input type="reset" value="重置"/>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<!-- 中间 -->
<!-- 左侧 -->
<div id="sidebar">
<jsp:include flush="true" page="/site/inc/left.jsp"></jsp:include><!--进入left.jsp左侧菜品类别页面设置如果缓存区满了就输出数据。-->
</div>
<!-- 左侧 -->
<div style="clear: both;">&nbsp;</div> <!--clear:both该属性的值指出了不允许有浮动元素 -->
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<p><a href="<%=path %>/login.jsp">系统后台</a></p>
</div>
</div>
</div>
</body>
</html>
Loading…
Cancel
Save