基于javaweb+mysql的在线商城购物商城水果蔬菜批发商城(前台、后台)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
后台管理:用户、新闻公告、果蔬类型、城市信息、配货点、果蔬商品、订单、评价等管理等
前台购物:注册登录、公告、商品、购买、评价等
idea:
eclipse/myeclipse:
前台购物:
后台管理:
技术框架
JavaBean MVC JSP SSM(Spring SpringMVC MyBatis) MySQL Bootstrap JavaScript
@RequestMapping("getAllPeihuo.action")
public String getAllPeihuo(String number) {
List<Peihuo> peihuoList = this.peihuoService.getAllPeihuo();
PageHelper.getPage(peihuoList, "peihuo", null, null, 10, number, this.getRequest(), null);
return "admin/listpeihuo";
}
@RequestMapping("getNetWork.action")
public String getNetWork(String number) {
List<Peihuo> peihuoList = this.peihuoService.getAllPeihuo();
PageHelper.getPage(peihuoList, "peihuo", null, null, 10, number, this.getRequest(), null);
return "users/network";
}
return day;
}
public static String getNowMonth(String sdate) {
sdate = sdate.substring(0, 8) + "01";
Date date = VeDate.strToDate(sdate);
Calendar c = Calendar.getInstance();
c.setTime(date);
int u = c.get(Calendar.DAY_OF_WEEK);
String newday = VeDate.getNextDay(sdate, (1 - u) + "");
return newday;
}
public static String getNo(int k) {
return getUserDate("yyyyMMddhhmmss") + getRandom(k);
}
public static String getRandom(int i) {
border: 0;
background-color: #005aa9;
font-weight: bold;
}
style>
<script type="text/javascript">
var $s = function(id) {
return "string" == typeof id ? document.getElementById(id) : id;
};
var Class = {
create : function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}
Object.extend = function(destination, source) {
for ( var property in source) {
destination[property] = source[property];
jiancai.setHits(name);
}
if ("sellnum".equals(cond)) {
jiancai.setSellnum(name);
}
if ("contents".equals(cond)) {
jiancai.setContents(name);
}
}
List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.jiancaiService.getJiancaiByLike(jiancai), "jiancai", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/queryjiancai";
}
@RequestMapping("over.action")
public String over(String id) {
this.front();
if (this.getSession().getAttribute("userid") == null) {
return "redirect:/index/preLogin.action";
}
Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
orders.setStatus("已收货");
this.ordersService.updateOrders(orders);
return "redirect:/index/showOrders.action";
}
@RequestMapping("cancel.action")
public String cancel(String id) {
this.front();
if (this.getSession().getAttribute("userid") == null) {
@RequestMapping("addArticle.action")
public String addArticle(Article article) {
article.setAddtime(VeDate.getStringDateShort());
article.setHits("0");
this.articleService.insertArticle(article);
return "redirect:/article/createArticle.action";
}
@RequestMapping("deleteArticle.action")
public String deleteArticle(String id) {
this.articleService.deleteArticle(id);
return "redirect:/article/getAllArticle.action";
}
@RequestMapping("deleteArticleByIds.action")
public String deleteArticleByIds() {
String[] ids = this.getRequest().getParameterValues("articleid");
for (String articleid : ids) {
this.articleService.deleteArticle(articleid);
}
return "redirect:/article/getAllArticle.action";
<strong>销量:strong>${goods.sellnum}
dd>
li>
ul>
<ul class="bnt_ul">
<li class="clearfix">
<dd>
<strong>购买数量:strong> <input name="num" type="text" id="number" value="1" size="4"
style="border: 1px solid #ccc;" /> <input type="hidden" name="goodsid" value="${goods.jiancaiid }" /> <input
type="hidden" name="price" value="${goods.price }" />
dd>
li>
<li class="padd"><input type="image" src="themes/xecmoban_haier2015/images/goumai2.png" />li>
ul>
form>
div>
div>
<div class="blank">div>
<div class="box">
<div style="padding: 0 0px;">
<div id="com_b" class="history clearfix">
<h2>果蔬描述h2>
div>
div>
<div class="box_1">
<div id="com_v" class=" " style="padding: 6px;">div>
<div id="com_h">
<td align="right">评分:td>
<td><input name="num" type="radio" value="1" id="num1" /> <img
src="themes/xecmoban_haier2015/images/stars1.gif" /> <input name="num" type="radio" value="2" id="num2" />
<img src="themes/xecmoban_haier2015/images/stars2.gif" /> <input name="num" type="radio" value="3"
id="num3" /> <img src="themes/xecmoban_haier2015/images/stars3.gif" /> <input name="num" type="radio"
value="4" id="num4" /> <img src="themes/xecmoban_haier2015/images/stars4.gif" /> <input name="num"
type="radio" value="5" checked="checked" id="num5" /> <img
src="themes/xecmoban_haier2015/images/stars5.gif" />td>
tr>
<tr>
<td align="right" valign="top">评论内容:td>
<td><textarea name="contents" class="inputBorder" style="height: 50px; width: 620px;">textarea> <input
type="hidden" name="goodsid" value="${goods.jiancaiid }" />td>
tr>
<tr>
<td colspan="2"><input name="" type="submit" value="评论咨询" class="f_r bnt_blue_1"
style="margin-right: 8px;" />td>
tr>
table>
form>
div>
div>
div>
div>
div>
div>
div>
Cart cart = new Cart();
cart.setUsersid(userid);
List<Cart> cartList = this.cartService.getCartByCond(cart);
this.getRequest().setAttribute("cartList", cartList);
return "users/cart";
}
@RequestMapping("deletecart.action")
public String deletecart(String id) {
this.front();
if (this.getSession().getAttribute("userid") == null) {
return "redirect:/index/preLogin.action";
}
this.cartService.deleteCart(id);
return "redirect:/index/cart.action";
}
insert into topic(topicid , usersid , jiancaiid , num , contents , addtime )
values(#{topicid} , #{usersid} , #{jiancaiid} , #{num} , #{contents} ,
#{addtime} )
insert>
<update id="updateTopic" parameterType="topic">
update topic set usersid=#{usersid} , jiancaiid=#{jiancaiid} , num=#{num} ,
contents=#{contents} , addtime=#{addtime} where topicid=#{topicid}
update>
<delete id="deleteTopic" parameterType="String">
delete from topic where topicid = #{topicid}
delete>
<select id="getAllTopic" resultMap="topicMap">
select a.* , b.username , c.jiancainame from topic a , users b , jiancai c where
1=1 and a.usersid = b.usersid and a.jiancaiid = c.jiancaiid order by topicid
desc
select>
<div class="line">div>
<div class="line">div>
<div class="line">div>
<div class="wrapper">
<form action="peihuo/updatePeihuo.action" name="myform" method="post" onsubmit="return check()" class="form">
<div class="widget" style="width: 40%">
<div class="title">
<img src="images/icons/dark/list.png" alt="" class="titleIcon" />
<h6>编辑配货点信息h6>
div>
<div class="formRow">
<label>配货点名称label>
this.front();
Users u = new Users();
u.setUsername(users.getUsername());
List<Users> usersList = this.usersService.getUsersByCond(u);
if (usersList.size() == 0) {
users.setRegdate(VeDate.getStringDateShort());
this.usersService.insertUsers(users);
} else {
this.getSession().setAttribute("message", "用户名已存在");
return "redirect:/index/preReg.action";
}
return "redirect:/index/preLogin.action";
}
@RequestMapping("exit.action")
public String exit() {
this.front();
this.getSession().removeAttribute("userid");
}
public static String getStringDateShort() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
return dateString;
}
public static String getStringTimeShort() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss");
String dateString = formatter.format(currentTime);
return dateString;
}
public static String getYear() {
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy");
String dateString = formatter.format(currentTime);
return dateString;
{
opener = window.parent;
// get access to global parameters
var oParams = window.opener.oldFramesetPageParams;
// make frameset rows string prepare
var sFramesetRows = ( parseInt( oParams.firstframeh, 10 ) || '30') + ",*," + ( parseInt( oParams.thirdframeh, 10 ) || '150' ) + ',0' ;
document.getElementById( 'itFrameset' ).rows = sFramesetRows ;
// dynamic including init frames and crossdomain transport code
// from config sproxy_js_frameset url
var addScriptUrl = oParams.sproxy_js_frameset ;
doLoadScript( addScriptUrl ) ;
}
script>
head>
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Peihuo;
import com.service.PeihuoService;
import com.entity.City;
import com.service.CityService;
import com.util.PageHelper;
@Controller
@RequestMapping(value = "/peihuo", produces = "text/plain;charset=utf-8")
public class PeihuoAction extends BaseAction {
@Autowired
@Resource
private PeihuoService peihuoService;
@Autowired
@Resource
private CityService cityService;
Original: https://blog.csdn.net/m0_69592937/article/details/127742065
Author: m0_69592937
Title: 基于javaweb+mysql的在线商城购物商城水果蔬菜批发商城(前台、后台)
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/653123/
转载文章受原作者版权保护。转载请注明原作者出处!