作者主页:夜未央5788
简介:Java领域优质创作者、Java项目、学习资料、技术互助
文末获取源码
项目介绍
系统功能:
用户:登录、注册、商品查询、公告预览、留言、订单管理、商品商城、修改密码、个人信息修改、商品查询。
管理员:登录、类别管理、用户管理、商品管理、订单管理、公告管理、留言管理
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可
4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;
5.是否Maven项目: 否;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目
6.数据库:MySql 5.7/8.0等版本均可;
技术栈
后台框架:Spring、SpringMVC、MyBatis
UI界面:JSP、jQuery 、BootStrap
数据库:MySQL
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,修改配置,运行项目;
3. 将项目中db.xml配置文件中的数据库配置改为自己的配置,然后运行;
运行截图
前台界面
后台界面
相关代码
ApplyController
package com.controller;
import javax.annotation.Resource;
import javax.mail.Session;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.dao.*;
import com.entity.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.util.Info;
import com.util.Saveobject;
import java.util.*;
@Controller
public class ApplyController extends BaseController {
@Resource
ApplyDAO applyDAO;
@Resource
UserDAO userDAO;
//后台查询入驻申请列表
@RequestMapping("admin/applyList")
public String applyList(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,HttpServletRequest request) {
String key = request.getParameter("key");
HashMap map = new HashMap();
map.put("key", key);
PageHelper.startPage(pageNum, 10);
List<Apply> list = applyDAO.selectAll(map);
PageInfo<Apply> pageInfo = new PageInfo<Apply>(list);
request.setAttribute("key",key);
request.setAttribute("pageInfo",pageInfo);
return "admin/applylist";
}
//商家申请列表
@RequestMapping("admin/applyLb")
public String applyLb(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,HttpServletRequest request) {
User admin = (User)request.getSession().getAttribute("admin");
User user = userDAO.findById(admin.getId());
String key = request.getParameter("key");
HashMap map = new HashMap();
map.put("memberid", user.getId());
PageHelper.startPage(pageNum, 10);
List<Apply> list = applyDAO.selectAll(map);
PageInfo<Apply> pageInfo = new PageInfo<Apply>(list);
request.setAttribute("key",key);
request.setAttribute("pageInfo",pageInfo);
return "admin/applylb";
}
//添加入驻申请
@RequestMapping("admin/applyAdd")
public String applyAdd(Apply apply,HttpServletRequest request){
User admin = (User)request.getSession().getAttribute("admin");
apply.setShstatus("待审核");
apply.setSavetime(Info.getDateStr());
apply.setMemberid(String.valueOf(admin.getId()));
applyDAO.add(apply);
return "redirect:applyLb.do";
}
//审核申请
@RequestMapping("admin/updateApply")
public String updateApply(Apply apply,HttpServletRequest request){
applyDAO.update(apply);
if(apply.getShstatus().equals("通过")){
Apply app = applyDAO.findById(apply.getId());
User user = userDAO.findById(Integer.parseInt(app.getMemberid()));
user.setShstatus("通过审核");
user.setFilename(app.getFilename());
user.setIdcard(app.getIdcard());
user.setRealname(app.getRealname());
userDAO.update(user);
}
return "redirect:applyList.do";
}
//删除入驻申请
@RequestMapping("admin/applyDel")
public String applyDel(int id, HttpServletRequest request,HttpServletResponse response){
applyDAO.delete(id);
return "redirect:applyList.do";
}
//删除入驻申请
@RequestMapping("admin/applySc")
public String applySc(int id, HttpServletRequest request,HttpServletResponse response){
applyDAO.delete(id);
return "redirect:applyLb.do";
}
}
BbsController
package com.controller;
import javax.annotation.Resource;
import javax.mail.Session;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import com.dao.*;
import com.entity.*;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.util.Info;
import com.util.Saveobject;
import java.util.*;
@Controller
public class BbsController extends BaseController {
@Resource
NewsDAO newsDAO;
@Resource
CategoryDAO categoryDAO;
@Resource
MemberDAO memberDAO;
@Resource
ProductDAO productDAO;
@Resource
Saveobject saveobject;
@Resource
OrdermsgDAO ordermsgDAO;
@Resource
BbsDAO bbsDAO;
//后台查询帖子列表
@RequestMapping("/admin/bbsList")
public String bbsList(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,HttpServletRequest request) {
String key = request.getParameter("key");
HashMap map = new HashMap();
map.put("key", key);
map.put("fid", "0");
PageHelper.startPage(pageNum, 10);
List<Bbs> list = bbsDAO.selectAll(map);
for(Bbs bbs:list){
bbs.setMember(memberDAO.findById(bbs.getMid()));
}
PageInfo<Bbs> pageInfo = new PageInfo<Bbs>(list);
request.setAttribute("key",key);
request.setAttribute("pageInfo",pageInfo);
return "admin/bbslist";
}
//后台查询帖子评论列表
@RequestMapping("/admin/bbsplList")
public String bbsplList(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,int fid,HttpServletRequest request) {
String key = request.getParameter("key");
HashMap map = new HashMap();
map.put("key", key);
map.put("fid", fid);
PageHelper.startPage(pageNum, 10);
List<Bbs> list = bbsDAO.selectAll(map);
for(Bbs bbs:list){
bbs.setMember(memberDAO.findById(bbs.getMid()));
}
PageInfo<Bbs> pageInfo = new PageInfo<Bbs>(list);
request.setAttribute("key",key);
request.setAttribute("fid",fid);
request.setAttribute("pageInfo",pageInfo);
return "admin/bbspllist";
}
//删除帖子评论
@RequestMapping("/admin/bbsplDelforadmin")
public String bbsplDelforadmin(int id,int fid, HttpServletRequest request,HttpServletResponse response){
bbsDAO.delete(id);
return "redirect:bbsplList.do?fid="+fid;
}
//删除
@RequestMapping("/admin/bbsDelforadmin")
public String bbsDelforadmin(int id, HttpServletRequest request,HttpServletResponse response){
Bbs bbs = bbsDAO.findById(id);
HashMap map = new HashMap();
map.put("fid",id);
List<Bbs> list = bbsDAO.selectAll(map);
for(Bbs b:list){
bbsDAO.delete(b.getId());
}
bbsDAO.delete(id);
return "redirect:bbsList.do";
}
//会员帖子列表
@RequestMapping("mybbsList")
public String mybbsList(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,HttpServletRequest request) {
Member member = (Member) request.getSession().getAttribute("sessionmember");
String key = request.getParameter("key");
HashMap map = new HashMap();
map.put("mid", member.getId());
map.put("fid", "0");
PageHelper.startPage(pageNum, 10);
List<Bbs> list = bbsDAO.selectAll(map);
for(Bbs bbs:list){
bbs.setMember(memberDAO.findById(bbs.getMid()));
}
PageInfo<Bbs> pageInfo = new PageInfo<Bbs>(list);
request.setAttribute("key",key);
request.setAttribute("pageInfo",pageInfo);
saveobject.getCart(request);
saveobject.getCategoryObject(request);
return "mybbslist";
}
//前台查询帖子列表
@RequestMapping("bbsLb")
public String bbsLb(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,HttpServletRequest request) {
String key = request.getParameter("key");
HashMap map = new HashMap();
map.put("key", key);
map.put("fid", "0");
PageHelper.startPage(pageNum, 10);
List<Bbs> list = bbsDAO.selectAll(map);
for(Bbs bbs:list){
bbs.setMember(memberDAO.findById(bbs.getMid()));
}
PageInfo<Bbs> pageInfo = new PageInfo<Bbs>(list);
request.setAttribute("key",key);
request.setAttribute("pageInfo",pageInfo);
saveobject.getCart(request);
saveobject.getCategoryObject(request);
saveobject.hotSales("",request);
List<Product> zphlist = saveobject.hotSales("",request);
request.setAttribute("zphlist", zphlist);
return "bbslb";
}
//去发布帖子
@RequestMapping("toBbsAdd")
public String toBbsAdd(HttpServletRequest request){
Bbs bbs = new Bbs();
bbs.setFid(0);
request.setAttribute("bbs",bbs);
saveobject.getCart(request);
saveobject.getCategoryObject(request);
return "bbsadd";
}
//帖子提交
@RequestMapping("bbsAdd")
public String bbsAdd(Bbs bbs,HttpServletRequest request){
Member member = (Member) request.getSession().getAttribute("sessionmember");
bbs.setSavetime(Info.getDateStr());
bbs.setMid(member.getId());
bbsDAO.add(bbs);
saveobject.getCart(request);
saveobject.getCategoryObject(request);
return "redirect:mybbsList.do";
}
//去编辑帖子
@RequestMapping("toBbsEdit")
public String toBbsEdit(int id,HttpServletRequest request){
Bbs bbs = bbsDAO.findById(id);
saveobject.getCart(request);
saveobject.getCategoryObject(request);
request.setAttribute("bbs",bbs);
return "bbsedit";
}
//编辑帖子提交
@RequestMapping("bbsEdit")
public String bbsEdit(Bbs bbs,HttpServletRequest request){
bbsDAO.update(bbs);
return "redirect:mybbsList.do";
}
//删除帖子
@RequestMapping("bbsDel")
public String bbsDel(int id, HttpServletRequest request,HttpServletResponse response){
Bbs bbs = bbsDAO.findById(id);
HashMap map = new HashMap();
map.put("fid",id);
List<Bbs> list = bbsDAO.selectAll(map);
for(Bbs b:list){
bbsDAO.delete(b.getId());
}
bbsDAO.delete(id);
return "redirect:mybbsList.do";
}
//帖子详情
@RequestMapping("bbsShow")
public String bbsShow(@RequestParam(defaultValue = "1",value = "pageNum") Integer pageNum,int id,HttpServletRequest request){
Bbs bbs = bbsDAO.findById(id);
Member author = memberDAO.findById(bbs.getMid());
bbs.setMember(author);
HashMap map = new HashMap();
map.put("fid",id);
PageHelper.startPage(pageNum, 10);
List<Bbs> list = bbsDAO.selectAll(map);
for(Bbs b:list){
b.setMember(memberDAO.findById(b.getMid()));
}
PageInfo<Bbs> pageInfo = new PageInfo<Bbs>(list);
request.setAttribute("pageInfo",pageInfo);
saveobject.getCart(request);
saveobject.getCategoryObject(request);
request.setAttribute("bbs",bbs);
return "bbsx";
}
//帖子回复
@RequestMapping("tzhf")
public String tzhf(HttpServletRequest request){
Member member = (Member) request.getSession().getAttribute("sessionmember");
int fid = Integer.valueOf(request.getParameter("fid"));
String note = request.getParameter("note");
Bbs bbs = new Bbs();
bbs.setFid(fid);
bbs.setNote(note);
bbs.setSavetime(Info.getDateStr());
bbs.setMid(member.getId());
bbsDAO.add(bbs);
saveobject.getCart(request);
saveobject.getCategoryObject(request);
return "redirect:bbsShow.do?id="+fid;
}
}
如果也想学习本系统,下面领取。关注并回复:308ssm