基于javaweb+jsp的在线水果商城系统(java+JSP+Spring+SpringMVC +MyBatis+html+mysql)
一、项目简述
功能: 区分为管理员用户和普通用户,普通用户:用户注册登录,首页水果展示,商品分类展示,购物车添加,下单,订单查询,个人信息修改,管理员用户:包括水果基本信息维护增删改查,分类管理,订单管理,用户管理等等功能。
二、项目运行
环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)
项目技术:
JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等。
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
} catch (IOException e) {
e.printStackTrace();
}
map.put("pics", savePath);
result=goodsInfoBiz.addGood(map);
return result;
}
@RequestMapping("/findgoods")
@ResponseBody
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds(String mno) {
return cartInfoBiz.finds(mno);
}
@RequestMapping("/update")
@ResponseBody
public Integer update(String cno, Integer num) {
return cartInfoBiz.update(cno, num);
}
private IOrderInfoBiz orderInfoBiz;
@RequestMapping("/addOrderInfo")
@ResponseBody
public Integer addOrderInfo(String ono, String odate, String ano, String price) {
Integer in = 0;
try {
in = orderInfoBiz.addOrderInfo(ono, odate,ano,price);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return in;
}
@RequestMapping("/getOrder")
@ResponseBody
public List<OrderInfo> getOrder(String mno) {
return orderInfoBiz.getOrder(mno);
}
}
购物车信息控制层:
@Controller
@RequestMapping("/cartInfo")
public class CartInfoController {
@Autowired
private ICartInfoBiz cartInfoBiz;
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds(String mno) {
return cartInfoBiz.finds(mno);
}
@RequestMapping("/update")
@ResponseBody
public Integer update(String cno, Integer num) {
return cartInfoBiz.update(cno, num);
}
@RequestMapping("/del")
@ResponseBody
public List<GoodsInfo> findAll() {
return goodsInfoBiz.findAll();
}
@RequestMapping("/find")
@ResponseBody
public GoodsInfo find(String str) {
System.out.println(goodsInfoBiz.find(str));
return goodsInfoBiz.find(str);
}
@RequestMapping("/findByTno")
@ResponseBody
public List<GoodsInfo> findByTno(String tno,String start) {
return goodsInfoBiz.findByTno(tno,start);
}
@RequestMapping("/updateBal")
}
@RequestMapping("/findByTno")
@ResponseBody
public List<GoodsInfo> findByTno(String tno,String start) {
return goodsInfoBiz.findByTno(tno,start);
}
@RequestMapping("/updateBal")
@ResponseBody
public Integer updateBal(String[] gnos,String[] nums) {
return goodsInfoBiz.updateBal(gnos,nums);
}
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds() {
return goodsInfoBiz.finds();
}
@RequestMapping("/upload")
@ResponseBody
public Map<String, Object> add(@RequestParam("upload")MultipartFile pic,HttpServletRequest request) {
Map<String, Object> map = new HashMap<String, Object>();
} catch (IOException e) {
e.printStackTrace();
}
map.put("pics", savePath);
result=goodsInfoBiz.addGood(map);
return result;
}
@RequestMapping("/findgoods")
@ResponseBody
result=goodsInfoBiz.addGood(map);
return result;
}
@RequestMapping("/findgoods")
@ResponseBody
public List<GoodsInfo> findgoods() {
return goodsInfoBiz.findgoods();
}
@RequestMapping("/del")
@ResponseBody
public int del(String gno) {
return goodsInfoBiz.del(gno);
}
@RequestMapping("/getPage")
@ResponseBody
public Integer getPage(String tno) {
int total=goodsInfoBiz.getTotal(tno);
int page=total%10==0?total/10:total/10+1;
return page;
}
}
@RequestMapping("/update")
@ResponseBody
public Integer update(String cno, Integer num) {
return cartInfoBiz.update(cno, num);
}
@RequestMapping("/del")
@ResponseBody
public Integer del(String cno) {
return cartInfoBiz.del(cno);
}
@RequestMapping("/add")
@ResponseBody
public Integer add(String mno, String gno, Integer num) {
return cartInfoBiz.add(mno,gno,num);
}
@RequestMapping("/checkCar")
}
return map;
}
//管理员端的商品信息
@RequestMapping("/addGood")
@ResponseBody
public int addGood(@RequestParam Map<String,Object> map,@RequestParam MultipartFile pic, HttpServletRequest request){
int result =-1;
if(pic.isEmpty()){
result=-2;//说明没有图片需要上传
}
String savePath="";
try {
String path= request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadpath");
if(!StringUtil.checkNull(temp)){
}
@RequestMapping("/dels")
@ResponseBody
public Integer dels(String[] gnos)throws IOException {
return cartInfoBiz.dels(gnos);
}
}
商品信息控制层:
@Controller
@RequestMapping("/goodsInfo")
public class GoodsInfoController {
@Autowired
private IGoodsInfoBiz goodsInfoBiz;
@RequestMapping("/findAll")
@ResponseBody
public List<GoodsInfo> findAll() {
return goodsInfoBiz.findAll();
}
@RequestMapping("/find")
@ResponseBody
@RequestMapping("/updateBal")
@ResponseBody
public Integer updateBal(String[] gnos,String[] nums) {
return goodsInfoBiz.updateBal(gnos,nums);
}
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds() {
return goodsInfoBiz.finds();
}
@RequestMapping("/upload")
@ResponseBody
public Map<String, Object> add(@RequestParam("upload")MultipartFile pic,HttpServletRequest request) {
Map<String, Object> map = new HashMap<String, Object>();
if(pic.isEmpty()){
return map;
}
try{
String savePath = "images/goods";
@ResponseBody
public Integer updateBal(String[] gnos,String[] nums) {
return goodsInfoBiz.updateBal(gnos,nums);
}
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds() {
return goodsInfoBiz.finds();
}
@RequestMapping("/upload")
@ResponseBody
public Map<String, Object> add(@RequestParam("upload")MultipartFile pic,HttpServletRequest request) {
Map<String, Object> map = new HashMap<String, Object>();
if(pic.isEmpty()){
return map;
}
return page;
}
}
订单信息控制层:
@Controller
@RequestMapping("/orderInfo")
public class OrderInfoController {
@Autowired
private IOrderInfoBiz orderInfoBiz;
@RequestMapping("/addOrderInfo")
@ResponseBody
public Integer addOrderInfo(String ono, String odate, String ano, String price) {
Integer in = 0;
try {
}
@RequestMapping("/setStatus")
@ResponseBody
public Integer setStatus(String ono) {
System.out.println("修改1");
return orderInfoBiz.setStatus(ono);
}
@RequestMapping("/getOrderByPage")
@ResponseBody
public List<OrderInfo> getOrderByPage(String mno, Integer page) {
return orderInfoBiz.getOrderByPage(mno,page);
}
@RequestMapping("/getPage")
@ResponseBody
public Integer getPage(String mno) {
int total=orderInfoBiz.getTotal(mno);
int page=total%2==0?total/2:total/2+1;
return page;
}
}
public List<GoodsInfo> finds(String mno) {
return cartInfoBiz.finds(mno);
}
@RequestMapping("/update")
@ResponseBody
public Integer update(String cno, Integer num) {
return cartInfoBiz.update(cno, num);
}
@RequestMapping("/del")
@ResponseBody
public Integer del(String cno) {
return cartInfoBiz.del(cno);
}
@ResponseBody
public int addGood(@RequestParam Map<String,Object> map,@RequestParam MultipartFile pic, HttpServletRequest request){
int result =-1;
if(pic.isEmpty()){
result=-2;//说明没有图片需要上传
}
String savePath="";
try {
String path= request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadpath");
if(!StringUtil.checkNull(temp)){
savePath = temp;
}
return map;
}
//管理员端的商品信息
@RequestMapping("/addGood")
@ResponseBody
public int addGood(@RequestParam Map<String,Object> map,@RequestParam MultipartFile pic, HttpServletRequest request){
int result =-1;
if(pic.isEmpty()){
result=-2;//说明没有图片需要上传
}
String savePath="";
try {
String path= request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadpath");
if(!StringUtil.checkNull(temp)){
savePath = temp;
}
savePath="images/goods/"+pic.getOriginalFilename();
File dest = new File(path, savePath);
//将图片存到服务器的指定文件夹
pic.transferTo(dest);
} catch (IllegalStateException e) {
public Integer addOrderInfo(String ono, String odate, String ano, String price) {
Integer in = 0;
try {
in = orderInfoBiz.addOrderInfo(ono, odate,ano,price);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return in;
}
@RequestMapping("/getOrder")
@ResponseBody
public List<OrderInfo> getOrder(String mno) {
}
@RequestMapping("/getPage")
@ResponseBody
public Integer getPage(String tno) {
int total=goodsInfoBiz.getTotal(tno);
int page=total%10==0?total/10:total/10+1;
return page;
}
}
@ResponseBody
public Integer setStatus(String ono) {
System.out.println("修改1");
return orderInfoBiz.setStatus(ono);
}
@RequestMapping("/getOrderByPage")
@ResponseBody
public List<OrderInfo> getOrderByPage(String mno, Integer page) {
return orderInfoBiz.getOrderByPage(mno,page);
}
@RequestMapping("/getPage")
@ResponseBody
public Integer getPage(String mno) {
int total=orderInfoBiz.getTotal(mno);
int page=total%2==0?total/2:total/2+1;
return page;
map.put("url","../../../"+savePath);
}catch(IllegalStateException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}
return map;
}
//管理员端的商品信息
@RequestMapping("/addGood")
@ResponseBody
public int addGood(@RequestParam Map<String,Object> map,@RequestParam MultipartFile pic, HttpServletRequest request){
int result =-1;
if(pic.isEmpty()){
result=-2;//说明没有图片需要上传
}
String savePath="";
try {
String path= request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadpath");
if(!StringUtil.checkNull(temp)){
@RequestMapping("/findAll")
@ResponseBody
public List<GoodsInfo> findAll() {
return goodsInfoBiz.findAll();
}
@RequestMapping("/find")
@ResponseBody
public GoodsInfo find(String str) {
System.out.println(goodsInfoBiz.find(str));
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds() {
return goodsInfoBiz.finds();
}
@RequestMapping("/upload")
@ResponseBody
public Map<String, Object> add(@RequestParam("upload")MultipartFile pic,HttpServletRequest request) {
Map<String, Object> map = new HashMap<String, Object>();
if(pic.isEmpty()){
return map;
}
try{
String savePath = "images/goods";
String path = request.getServletContext().getRealPath("");
String temp = request.getServletContext().getInitParameter("uploadPath");
if(temp != null){
savePath = temp;
}
@RequestMapping("/findByTno")
@ResponseBody
public List<GoodsInfo> findByTno(String tno,String start) {
return goodsInfoBiz.findByTno(tno,start);
}
@RequestMapping("/updateBal")
@ResponseBody
public Integer updateBal(String[] gnos,String[] nums) {
return goodsInfoBiz.updateBal(gnos,nums);
}
@RequestMapping("/finds")
@ResponseBody
public List<GoodsInfo> finds() {
return goodsInfoBiz.finds();
}
@RequestMapping("/upload")
@ResponseBody
public Map<String, Object> add(@RequestParam("upload")MultipartFile pic,HttpServletRequest request) {
@ResponseBody
public Integer update(String cno, Integer num) {
return cartInfoBiz.update(cno, num);
}
@RequestMapping("/del")
@ResponseBody
public Integer del(String cno) {
return cartInfoBiz.del(cno);
}
@RequestMapping("/add")
@ResponseBody
public Integer add(String mno, String gno, Integer num) {
return cartInfoBiz.add(mno,gno,num);