项目介绍:
该系统创作于2022年4月,包含详细数据库设计。基于springboot技术,数据层为MyBatis,mysql数据库,页面采用html,具有完整的业务逻辑,适合选题:海鲜、特产、商城、海鲜特产等。
项目功能:
主要是买家,卖家,相当于私人商铺
登录注册,顾客查询商品,购物车,购买,订单、取消订单
管理员、商品管理、分类管理、用户管理、订单管理(退货)
数据库表结构文档:
系统包含技术:
后端:springboot、mybatis
前端:layui,js,css等,html页面
开发工具:idea
数据库:mysql 5.7
JDK版本:jdk1.8
部分截图说明:
下面是首页
商品页面,可以筛选
商品详情,可以加入购物车
购物车
我的订单,看到详情和取消订单
订单详情
登录页面,管理员和用户都可以登录
后台-首页
后台对用户进行管理
后台对分类进行维护
后台对商品进行维护
后台对订单进行维护
部分代码:
拦截器
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
HttpSession session = request.getSession();
if(session.getAttribute("userInfo") != null){
return true;
}
// 不符合条件的给出提示信息,并转发到主页面
request.setAttribute("msg", "您还没有登录,请先登录!");
request.getRequestDispatcher("/logout").forward(request, response);
//返回true通过,返回false拦截
return false;
}
文件上传
/**
* 文件上传
* @param dropFile
* @param request
* @return
*/
@ResponseBody
@RequestMapping(value = "/avatar", method = RequestMethod.POST)
public Map<String, Object> acticleAvatar(MultipartFile dropFile, HttpServletRequest request) throws IOException {
Map<String, Object> result = new HashMap<>();
//获取文件后缀
String fileName = dropFile.getOriginalFilename();
String fileSuffix = fileName.substring(fileName.lastIndexOf('.'));
//文件存放路径
String fileDirPath = new String(uploadDir);
File fileDir = new File(fileDirPath);
//判断文件是否存在
if (!fileDir.exists()){
fileDir.mkdirs();
}
File file = new File(fileDir.getAbsolutePath()+File.separator+ UUID.randomUUID() + fileSuffix);
try {
dropFile.transferTo(file);
} catch (IOException e) {
e.printStackTrace();
}
//传到前端
result.put("fileName", "http://localhost:"+port+"/upload/"+file.getName());
return result;
}
商品操作
// 依赖注入
@Autowired
private GoodsService goodsService;
@Autowired
private CategoryService categoryService;
/**进入列表页面*/
@GetMapping("/goods")
public String userIframe(Model model, HttpSession session){
Category category = new Category();
List<Category> categories = categoryService.selectByCondition(category);
model.addAttribute("categories",categories);
return "GoodsList";
}
/**列表数据*/
@GetMapping("/list")
@ResponseBody
public PageResultVo findGoods(Goods goods, Integer limit, Integer page, HttpSession session){
PageHelper.startPage(page,limit);
List<Goods> goodsList = goodsService.selectByCondition(goods);
PageInfo<Goods> pages = new PageInfo<>(goodsList);
return JsonData.table(goodsList,pages.getTotal());
}
/**编辑详情*/
@GetMapping("/edit")
@ResponseBody
public Goods edit(Model model, String id){
return goodsService.selectById(id);
}
/**编辑*/
@PostMapping("/edit")
@ResponseBody
public JsonData edit(Goods goods){
int a = goodsService.updateById(goods);
if (a > 0) {
return JsonData.success(null,"编辑成功!");
} else {
return JsonData.fail("编辑失败");
}
}
/**删除*/
@PostMapping("/del")
@ResponseBody
public JsonData del(String id){
try{
goodsService.deleteById(Integer.parseInt(id));
}catch(Exception ex){
JsonData.fail("出现错误");
}
return JsonData.success(null,"删除成功");
}
以上就是部分功能展示,从整体上来看,本系统功能是十分完整的,界面设计简洁大方,交互友好,数据库设计也很合理,规模适中,代码工整,清晰,适合学习使用。
好了,今天就到这儿吧,小伙伴们点赞、收藏、评论,一键三连走起呀,下期见~~