简介
关于宠物的商店,首页,搜索商品,详情页,可选择尺寸,衣服颜色,根据不同规格显示不同的商品价格,加入购物车,立即购买,评价列表展示,商品详情展示,商品评分,分类商品,标签查询,更多分类查询
技术
Ssm+ajax+bootscrap+css+jq+js+jsp
功能:
首页,搜索商品,详情页,可选择尺寸,衣服颜色,根据不同规格显示不同的商品价格,加入购物车,立即购买,评价列表展示,商品详情展示,商品评分,分类商品,标签查询,更多分类查询
用户:登录(密码MD5加密),注册,修改密码,收货地址管理,购物车,确认支付订单修改收货地址,添加备注,待支付订单,待发货订单,待收货订单,待评价低订单,已完成订单,申请退款订单,已退款订单,取消订单,删除订单,查看评价信息,我的购物车(可修改购买数量,可删除,可批量付款,也可单个付款)。订单没有合并,一个商品一个订单哦。
管理员:商品分类管理(排序),商品标签管理,商品管理(可灵活设置商品尺寸没规格参数和不同的价格,图文混合编辑),订单管理(未付款,待发货,待确认,待评价,已完成,待退款,已退款,查看评价),用户管理
网站建议+特价+轮播+导出月销量+销量统计图
部分截图
商品代码
package s.jf3q.com.controller.jsp;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import s.jf3q.com.cons.Sys;
import s.jf3q.com.model.SpAd;
import s.jf3q.com.model.SpGoods;
import s.jf3q.com.model.SpTags;
import s.jf3q.com.service.SpAdService;
import s.jf3q.com.service.SpGoodsService;
import s.jf3q.com.service.SpTagsService;
import s.jf3q.com.service.SpTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@Controller
@RequestMapping("/shop/spGoods")
public class SpGoodsController {
@Resource
SpGoodsService spGoodsService;
@Resource
SpTypeService spTypeService;
@Resource
SpTagsService spTagsService;
@Resource
SpAdService spAdService;
/*
* 商品分类
* */
@RequestMapping("/index")
public String page(@RequestParam(value="pageNo",defaultValue="1")int pageNo,HttpServletRequest request, HttpServletResponse response,HttpSession session,
Model model,SpGoods g) throws IOException {
g.setIs_putaway("1");
PageHelper.startPage(pageNo,16," cts desc ");
List<SpGoods> li=spGoodsService.queryList(g);
PageInfo<SpGoods> pageInfo = new PageInfo<SpGoods>(li,Sys.Common.pageSize);
li=pageInfo.getList();
if(li.size()>0) {
for(SpGoods spg:li){
spg.setMain_img(spg.getMain_img().split(",")[0]);
spg.setGdesc(null);
}
}
model.addAttribute("pageInfo", pageInfo);
SpAd ad=new SpAd();
ad.setOrderby("tsort_asc");
ad.setHasimg("1");
ad.setType("lb");
List<SpAd> lbli=spAdService.queryList(ad);
ad.setType("dg");
List<SpAd> dgli=spAdService.queryList(ad);
model.addAttribute("lbli", lbli);
model.addAttribute("dgli", dgli);
return Sys.Common.front + "/index";
}
/*
* 商品分类
* */
@RequestMapping("/search")
public String search(@RequestParam(value="pageNo",defaultValue="1")int pageNo,HttpServletRequest request, HttpServletResponse response,HttpSession session,
Model model,SpGoods g) throws IOException {
g.setIs_putaway("1");
PageHelper.startPage(pageNo,16," cts desc ");
List<SpGoods> li=spGoodsService.queryList(g);
PageInfo<SpGoods> pageInfo = new PageInfo<SpGoods>(li,Sys.Common.pageSize);
li=pageInfo.getList();
if(li.size()>0) {
for(SpGoods spg:li){
spg.setMain_img(spg.getMain_img().split(",")[0]);
spg.setGdesc(null);
}
}
model.addAttribute("pageInfo", pageInfo);
model.addAttribute("g", g);
return Sys.Common.front + "/goods_list";
}
/*
* 商品分类
* */
@RequestMapping("/detail")
public String detail(HttpServletRequest request, HttpServletResponse response,HttpSession session,
Model model,SpGoods g) throws IOException {
//添加浏览量
g=spGoodsService.queryById(g.getId()+"");
g.setView_num(g.getView_num()+1);
spGoodsService.update(g);
//获取图片
String[] imgs=g.getMain_img().split(",");
List<String> imgli=new ArrayList<String> ();
for(String img:imgs){
if(img.trim().length()>0)imgli.add(img);
}
model.addAttribute("g", g);
model.addAttribute("imgli", imgli);
//尺寸规格
String[] gsize=g.getGsize().split(",");
List<String> gszieli=new ArrayList<String> ();
for(String s:gsize){
if(s.trim().length()>0)gszieli.add(s);
}
model.addAttribute("gszieli", gszieli);
//规格
String[] spec_price=g.getSpec_price().split("-");
List<Map<String,Object>> sprli=new ArrayList<Map<String,Object>> ();
for(String s:spec_price){
if(s.trim().length()>0){
Map<String,Object> m=new HashMap<String,Object>();
m.put("spec",s.split("@")[0]);
m.put("price",s.split("@")[1]);
sprli.add(m);
}
}
model.addAttribute("sprli", sprli);
//获取标签
SpTags tags=new SpTags();
tags.setTid(g.getGtype());
List<SpTags> tagsli=spTagsService.queryList(tags);
model.addAttribute("tagsli",tagsli);
//获取猜你喜欢同类型的商品
SpGoods gcon=new SpGoods();
gcon.setGtype(g.getGtype());
PageHelper.startPage(1,15," cts desc ");
List<SpGoods> goodsli=spGoodsService.queryList(gcon);
PageInfo pageInfo = new PageInfo(goodsli,Sys.Common.pageSize);
goodsli=pageInfo.getList();
if(goodsli.size()>0) {
for(SpGoods spg:goodsli){
spg.setMain_img(spg.getMain_img().split(",")[0]);
spg.setGdesc(null);
}
}
model.addAttribute("goodsli",goodsli);
//商品平均分
int avg_evel=5;
if(g.getEvel()>0&&g.getEvaluation_num()>0){
avg_evel=g.getEvel()/g.getEvaluation_num();
}
model.addAttribute("avg_evel",avg_evel);
return Sys.Common.front + "/detail";
}
/*
* 更多分类
* */
@RequestMapping("/more")
public String more(@RequestParam(value="pageNo",defaultValue="1")int pageNo,HttpServletRequest request, HttpServletResponse response,HttpSession session,
Model model,SpGoods g) throws IOException {
return Sys.Common.front+"/more";
}
}
标签:java,SpGoods,宠物店,源码,import,model,addAttribute,com,spg
From: https://www.cnblogs.com/1913284695q/p/17068218.html