• 基于springboot的海鲜特产商城


    博主主页猫头鹰源码

    博主简介:Java领域优质创作者、CSDN博客专家、公司架构师、全网粉丝5万+、专注Java技术领域和毕业设计项目实战

    主要内容:毕业设计(Javaweb项目|小程序等)、简历模板、学习资料、面试题库、技术咨询

    文末联系获取

    项目介绍: 

    该系统创作于2022年4月,包含详细数据库设计。基于springboot技术,数据层为MyBatis,mysql数据库,页面采用html,具有完整的业务逻辑,适合选题:海鲜、特产、商城、海鲜特产等。

    项目功能:

    主要是买家,卖家,相当于私人商铺
    登录注册,顾客查询商品,购物车,购买,订单、取消订单
    管理员、商品管理、分类管理、用户管理、订单管理(退货)

    数据库表结构文档: 

    系统包含技术:

    后端:springboot、mybatis
    前端:layui,js,css等,html页面
    开发工具:idea
    数据库:mysql 5.7
    JDK版本:jdk1.8

    部分截图说明:

    下面是首页

    商品页面,可以筛选

    商品详情,可以加入购物车

    购物车

    我的订单,看到详情和取消订单

    订单详情

    登录页面,管理员和用户都可以登录

     后台-首页

    后台对用户进行管理

    后台对分类进行维护

    后台对商品进行维护

    后台对订单进行维护

    部分代码:

    拦截器

    1. @Override
    2. public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    3. HttpSession session = request.getSession();
    4. if(session.getAttribute("userInfo") != null){
    5. return true;
    6. }
    7. // 不符合条件的给出提示信息,并转发到主页面
    8. request.setAttribute("msg", "您还没有登录,请先登录!");
    9. request.getRequestDispatcher("/logout").forward(request, response);
    10. //返回true通过,返回false拦截
    11. return false;
    12. }

    文件上传

    1. /**
    2. * 文件上传
    3. * @param dropFile
    4. * @param request
    5. * @return
    6. */
    7. @ResponseBody
    8. @RequestMapping(value = "/avatar", method = RequestMethod.POST)
    9. public Map<String, Object> acticleAvatar(MultipartFile dropFile, HttpServletRequest request) throws IOException {
    10. Map<String, Object> result = new HashMap<>();
    11. //获取文件后缀
    12. String fileName = dropFile.getOriginalFilename();
    13. String fileSuffix = fileName.substring(fileName.lastIndexOf('.'));
    14. //文件存放路径
    15. String fileDirPath = new String(uploadDir);
    16. File fileDir = new File(fileDirPath);
    17. //判断文件是否存在
    18. if (!fileDir.exists()){
    19. fileDir.mkdirs();
    20. }
    21. File file = new File(fileDir.getAbsolutePath()+File.separator+ UUID.randomUUID() + fileSuffix);
    22. try {
    23. dropFile.transferTo(file);
    24. } catch (IOException e) {
    25. e.printStackTrace();
    26. }
    27. //传到前端
    28. result.put("fileName", "http://localhost:"+port+"/upload/"+file.getName());
    29. return result;
    30. }

     商品操作

    1. // 依赖注入
    2. @Autowired
    3. private GoodsService goodsService;
    4. @Autowired
    5. private CategoryService categoryService;
    6. /**进入列表页面*/
    7. @GetMapping("/goods")
    8. public String userIframe(Model model, HttpSession session){
    9. Category category = new Category();
    10. List<Category> categories = categoryService.selectByCondition(category);
    11. model.addAttribute("categories",categories);
    12. return "GoodsList";
    13. }
    14. /**列表数据*/
    15. @GetMapping("/list")
    16. @ResponseBody
    17. public PageResultVo findGoods(Goods goods, Integer limit, Integer page, HttpSession session){
    18. PageHelper.startPage(page,limit);
    19. List<Goods> goodsList = goodsService.selectByCondition(goods);
    20. PageInfo<Goods> pages = new PageInfo<>(goodsList);
    21. return JsonData.table(goodsList,pages.getTotal());
    22. }
    23. /**编辑详情*/
    24. @GetMapping("/edit")
    25. @ResponseBody
    26. public Goods edit(Model model, String id){
    27. return goodsService.selectById(id);
    28. }
    29. /**编辑*/
    30. @PostMapping("/edit")
    31. @ResponseBody
    32. public JsonData edit(Goods goods){
    33. int a = goodsService.updateById(goods);
    34. if (a > 0) {
    35. return JsonData.success(null,"编辑成功!");
    36. } else {
    37. return JsonData.fail("编辑失败");
    38. }
    39. }
    40. /**删除*/
    41. @PostMapping("/del")
    42. @ResponseBody
    43. public JsonData del(String id){
    44. try{
    45. goodsService.deleteById(Integer.parseInt(id));
    46. }catch(Exception ex){
    47. JsonData.fail("出现错误");
    48. }
    49. return JsonData.success(null,"删除成功");
    50. }

    以上就是部分功能展示,从整体上来看,本系统功能是十分完整的,界面设计简洁大方,交互友好,数据库设计也很合理,规模适中,代码工整,清晰,适合学习使用。

    好了,今天就到这儿吧,小伙伴们点赞、收藏、评论,一键三连走起呀,下期见~~

  • 相关阅读:
    驱动代码整理
    TPA4045-ASEMI光伏防回流二极管TPA4045
    C#实现钉钉自定义机器人发送群消息帮助类
    【前端开发】HTML1
    【Apache Spark 】第 9 章使用 Apache Spark构建可靠的数据湖
    贪心算法之装箱问题
    GFS分布式存储
    高薪程序员&面试题精讲系列145之前后端如何交互?Swagger你用过吗?
    基于Matlab的高压直流输电系统仿真研究
    中端品牌进击存量蓝海,维也纳赋能老酒店“重焕新生”
  • 原文地址:https://blog.csdn.net/mtyedu/article/details/126737441