基于SSM的婴幼儿商城

基于微信小程序+VUE+Springboot+Mysql的中小学生作业管理系统

✌全网粉丝20W+,csdn特邀作者、博客专家、CSDN新星计划导师、java领域优质创作者,博客之星、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌

🍅文末获取项目下载方式🍅


一、项目背景介绍:

当今社会已经是一个新的信息技术时代,各个行业和领域也都有了翻天覆地的变革,各大行业都努力争取上游,改变各种行业管理水平和现代化管理,进一步适应信息科技和社会的变革与发展,计算机、网络技术已融合到各行各业的工作生活当中,企业对信息的需求刻不容缓。
设计并研究开发一个基于 myeclipse 开发平台的母婴用品商城系统,该平台采用 b / s 架构,结合前端开发语言 java ,后台数据库 mysql。母婴专属商品网站系统可以为用户提供方便的信息注册、查询、管理等功能,大家通过互联网就可以及时地查找和获取自己的所需,不仅大大降低了人力物力,而且网站管理员的工作效率大大提升。本研究项目依据企业日常经营管理工作的要求和母婴用品商城系统的经营管理流程,结合现代科学管理理论,设计并研制一个基于互联网环境下的母婴用品商城系统。据分析母婴用品商城系统的市场需求和其应用,通过对用户和系统管理员两个角色的配置来完成对系统职能的执行与实现,完成对企业信息的管理。

二、项目技术简介:

  1. JAVA:Java是一门面向对象编程语言,不仅吸收了C++语言的各种优点,还摒弃了C++里难以理解的多继承、指针等概念,因此Java语言具有功能强大和简单易用两个特征。Java语言作为静态面向对象编程语言的代表,极好地实现了面向对象理论,允许程序员以优雅的思维方式进行复杂的编程。
  2. Spring:Spring框架是一个开放源代码的J2EE应用程序框架,由Rod Johnson发起,是针对bean的生命周期进行管理的轻量级容器(lightweight container)。 Spring解决了开发者在J2EE开发中遇到的许多常见的问题,提供了功能强大IOC、AOP及Web MVC等功能。Spring可以单独应用于构筑应用程序,也可以和Struts、Webwork、Tapestry等众多Web框架组合使用,并且可以与 Swing等桌面应用程序AP组合。因此, Spring不仅仅能应用于J2EE应用程序之中,也可以应用于桌面应用程序以及小应用程序之中。Spring框架主要由七部分组成,分别是 Spring Core、 Spring AOP、 Spring ORM、 Spring DAO、Spring Context、 Spring Web和 Spring Web MVC。
  3. Mybatis:MyBatis本是apache的一个开源项目iBatis,2010年这个项目由apache software foundation迁移到了google code,并且改名为MyBatis。2013年11月迁移到Github。
    iBATIS一词来源于“internet”和“abatis”的组合,是一个基于Java的持久层框架。iBATIS提供的持久层框架包括SQL Maps和Data Access Objects(DAOs)。
  4. Jsp:JSP(全称JavaServer Pages)是由Sun Microsystems公司主导创建的一种动态网页技术标准。JSP部署于网络服务器上,可以响应客户端发送的请求,并根据请求内容动态地生成HTML、XML或其他格式文档的Web网页,然后返回给请求者。JSP技术以Java语言作为脚本语言,为用户的HTTP请求提供服务,并能与服务器上的其它Java程序共同处理复杂的业务需求。
    JSP将Java代码和特定变动内容嵌入到静态的页面中,实现以静态页面为模板,动态生成其中的部分内容。JSP引入了被称为“JSP动作”的XML标签,用来调用内建功能。另外,可以创建JSP标签库,然后像使用标准HTML或XML标签一样使用它们。标签库能增强功能和服务器性能,而且不受跨平台问题的限制。JSP文件在运行时会被其编译器转换成更原始的Servlet代码。JSP编译器可以把JSP文件编译成用Java代码写的Servlet,然后再由Java编译器来编译成能快速执行的二进制机器码,也可以直接编译成二进制码。
  5. Spring-Mvc:Spring MVC属于SpringFrameWork的后续产品,已经融合在Spring Web Flow里面。Spring 框架提供了构建 Web 应用程序的全功能 MVC 模块。使用 Spring 可插入的 MVC 架构,从而在使用Spring进行WEB开发时,可以选择使用Spring的Spring MVC框架或集成其他MVC开发框。

三、系统功能模块介绍:

功能模块图

四、数据库设计:

1:active(active)

字段名类型默认值列注释
idintNULL
itemIdintNULL
stockintNULL
numintNULL
startTimedatetimeNULL
endTimedatetimeNULL
statusintNULL状态[0:未开始,1:开始中,2:已结束]
pricevarcharNULL

2:car(car)

字段名类型默认值列注释
idintNULL
item_idintNULL
user_idintNULL
numintNULL
pricedecimalNULL
totalvarcharNULL

3:comment(comment)

字段名类型默认值列注释
idintNULL
user_idintNULL
item_idintNULL
contentvarcharNULL
addTimedatetimeNULL
statusintNULL

4:item(item)

字段名类型默认值列注释
idintNULL
namevarcharNULL
pricevarcharNULL价格
scNumintNULL收藏数
gmNumintNULL购买数
url1varcharNULL主图
url2varcharNULL附图
url3varcharNULL附图
url4varcharNULL附图
url5varcharNULL附图
mstextNULL描述
pam1varcharNULL参数1
pam2varcharNULL参数2
pam3varcharNULL参数3
val3varcharNULL值3
val2varcharNULL值2
val1varcharNULL值1
typeintNULL类型
zkfloatNULL折扣
category_id_oneintNULL类别id
category_id_twointNULL类别2级
isDeleteintNULL0否 1是
numintNULL点赞数

5:item_category(item_category)

字段名类型默认值列注释
idintNULL
namevarcharNULL类目名称
pidintNULL父id
isDeleteintNULL

6:item_order(item_order)

字段名类型默认值列注释
idintNULL
item_idintNULL
user_idintNULL
codevarcharNULL
addTimedatetimeNULL
totalvarcharNULL
isDeleteintNULL
statusintNULL0.新建代发货1.已取消 2已已发货3.到收货4已评价

7:manage(manage)

字段名类型默认值列注释
idintNULL
userNamevarcharNULL
passWordvarcharNULL
realNamevarcharNULL
typevarcharNULL

8:‘留言表’(message)

字段名类型默认值列注释
idintNULL
namevarcharNULL
phonevarcharNULL
contentvarcharNULL

9:news(news)

字段名类型默认值列注释
idintNULL
namevarcharNULL
contenttextNULL
addTimedatetimeNULL

10:order_detail(order_detail)

字段名类型默认值列注释
idintNULL
item_idintNULL
order_idintNULL
statusintNULL0.未退货 1已退货
numintNULL
totalvarcharNULL

11:sc(sc)

字段名类型默认值列注释
idintNULL
item_idintNULL
user_idintNULL

12:user(user)

字段名类型默认值列注释
idintNULL
userNamevarcharNULL
passWordvarcharNULL
phonevarcharNULL
realNamevarcharNULL
sexvarcharNULL
addressvarcharNULL
emailvarcharNULL

五、功能模块:

  1. 首页:商城首页会展示所有后台添加的一级分类,二级分类数据,以及秒杀活动,热门商品等数据

    首页

  2. 商品列表模块:根据不同的二级分类,可以今日不同的商品列表模块,该模块可以进行查询,排序等操作

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-LIyTrz2M-1691808130317)(https://code-grade-server-prd.oss-cn-shenzhen.aliyuncs.com/2023-02-22/6bc68173-27ef-4d7c-8a7e-18acd8c81c49_montherchild2.png)]

  3. 商品详情模块:该模块主要是商品详情的一个展示,还包括加入购物车,收藏,点赞,评论等功能

    商品详情模块

  4. 购物车,订单模块:购物完成之后会将购物车里的数据删除,添加到我的订单中去,其中也包括一系列的订单状态,包括代发货,已收货,已完成等

    购物车,订单模块

  5. 个人中心:个人中心包含个人信息管理,地址管理,订单,评论,收藏等管理

    个人中心

  6. 秒杀模块:主要对系统的一些特殊商品进行秒杀处理

    秒杀模块

  7. 后台管理模块:后台主要对商品,商品分类,育儿知识文章,订单,管理员等进行一系列的管理操作

    [外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-zhy1HavQ-1691808130319)(https://code-grade-server-prd.oss-cn-shenzhen.aliyuncs.com/2023-02-22/3085cd92-e8dd-43d7-83ff-aa61787f35f7_montherchild10.png)]

  8. 数据统计模块:数据统计主要对整个商城进行一些销售统计,从而形成图形报表,供管理员查看

    数据统计模块

六、代码示例:

首页
 @RequestMapping("/uIndex")
    public String uIndex(Model model, Item item, HttpServletRequest request) {
        String sql1 = "select * from item_category where isDelete=0 and pid is null order by name";
        List<ItemCategory> fatherList = itemCategoryService.listBySqlReturnEntity(sql1);
        List<CategoryDto> list = new ArrayList<>();
        if (!CollectionUtils.isEmpty(fatherList)) {
            for (ItemCategory ic : fatherList) {
                CategoryDto dto = new CategoryDto();
                dto.setFather(ic);
                //查询二级分类
                String sql2 = "select * from item_category where isDelete=0 and pid=" + ic.getId();
                List<ItemCategory> childrens = itemCategoryService.listBySqlReturnEntity(sql2);
                dto.setChildrens(childrens);
                list.add(dto);
                model.addAttribute("lbs", list);
            }
        }
        //秒杀活动
        String sql = "select * from active where status != 2 order by startTime desc";
        List<Active> activeList = activeService.listBySqlReturnEntity(sql);
        if (activeList != null && activeList.size() > 0) {
            Map<Integer, Active> integerActiveMap = activeList.stream().collect(Collectors.toMap(a -> a.getItemId(), a -> a, (k1, k2) -> k1));
            String itemIds = activeList.stream().map(active -> String.valueOf(active.getItemId())).collect(Collectors.joining(","));
            String itemSql = "select * from item where isDelete=0 and id in (" + itemIds + ")";
            List<Item> zks = itemService.listBySqlReturnEntity(itemSql);
            for (Item zk : zks) {
                zk.setStartTime(integerActiveMap.get(zk.getId()).getStartTime());
            }
            model.addAttribute("zks", zks);
        }


        //热销商品
        List<Item> rxs = itemService.listBySqlReturnEntity("select * from item where isDelete=0 order by gmNum desc limit 0,10");
        model.addAttribute("rxs", rxs);

        return "login/uIndex";
    }
商品列表模块
 /**
     * 查询分类列表
     */
    @RequestMapping("/findBySql")
    public String findBySql(Model model,ItemCategory itemCategory){
        String sql = "select * from item_category where isDelete = 0 and pid is null order by id";
        Pager<ItemCategory> pagers = itemCategoryService.findBySqlRerturnEntity(sql);
        model.addAttribute("pagers",pagers);
        model.addAttribute("obj",itemCategory);
        return "itemCategory/itemCategory";
    }

    /**
     * 转向到新增一级分类页面
     */
    @RequestMapping(value = "/add")
    public String add(){
        return "itemCategory/add";
    }
商品详情模块
 @RequestMapping("/shoplist")
    public String shoplist(Item item, String condition, Model model) {
        String sql = "select * from item where isDelete=0";
        if (!isEmpty(item.getCategoryIdOne())) {
            sql += " and category_id_one=" + item.getCategoryIdOne();
        }
        if (!isEmpty(item.getCategoryIdTwo())) {
            sql += " and category_id_two=" + item.getCategoryIdTwo();
        }
        if (!isEmpty(condition)) {
            sql += " and name like '%" + condition + "%' or category_id_one like '%" + condition + "%' or category_id_two like '%" + condition + "%'";
            model.addAttribute("condition", condition);
        }
        if (!isEmpty(item.getPrice())) {
            sql += " order by (price+0) desc";
        }
        if (!isEmpty(item.getGmNum())) {
            sql += " order by gmNum desc";
        }
        if (isEmpty(item.getPrice()) && isEmpty(item.getGmNum())) {
            sql += " order by id desc";
        }

        Pager<Item> pagers = itemService.findBySqlRerturnEntity(sql);
        model.addAttribute("pagers", pagers);
        model.addAttribute("obj", item);
        return "item/shoplist";
    }
购物车,订单模块
@RequestMapping("/my")
    public String my(Model model, HttpServletRequest request) {
        Object attribute = request.getSession().getAttribute(Consts.USERID);
        if (attribute == null) {
            return "redirect:/login/uLogin";
        }
        Integer userId = Integer.valueOf(attribute.toString());
        //全部订单
        String sql = "select * from item_order where user_id=" + userId + " order by id desc";
        List<ItemOrder> all = itemOrderService.listBySqlReturnEntity(sql);
        //待发货
        String sql2 = "select * from item_order where user_id=" + userId + " and status=0 order by id desc";
        List<ItemOrder> dfh = itemOrderService.listBySqlReturnEntity(sql2);
        //已取消
        String sql3 = "select * from item_order where user_id=" + userId + " and status=1 order by id desc";
        List<ItemOrder> yqx = itemOrderService.listBySqlReturnEntity(sql3);
        //已发货
        String sql4 = "select * from item_order where user_id=" + userId + " and status=2 order by id desc";
        List<ItemOrder> dsh = itemOrderService.listBySqlReturnEntity(sql4);
        //已收货
        String sql5 = "select * from item_order where user_id=" + userId + " and status=3 order by id desc";
        List<ItemOrder> ysh = itemOrderService.listBySqlReturnEntity(sql5);

        model.addAttribute("all", all);
        model.addAttribute("dfh", dfh);
        model.addAttribute("yqx", yqx);
        model.addAttribute("dsh", dsh);
        model.addAttribute("ysh", ysh);
        return "itemOrder/my";
    }

个人中心
 @RequestMapping("/findBySql")
    public String findBySql(Model model, User user, Manage manage,HttpServletRequest request){
        //怎么获取当前登录的用户
//        Object role = request.getSession().getAttribute(Consts.MANAGE);
//        cgp
//        if (role!="admin"){
//            return "user/role";
//        }
        String sql = "select * from user where 1=1 ";
        if(!isEmpty(user.getUserName())){
            sql += " and userName like '%"+user.getUserName()+"%' ";
        }
        sql+=" order by id";
        Pager<User> pagers = userService.findBySqlRerturnEntity(sql);
        model.addAttribute("pagers",pagers);
        model.addAttribute("obj",user);
        return "user/user";
    }
秒杀模块
@RequestMapping("/ms")
    @ResponseBody
    public String ms(Integer itemId, Integer msId, HttpServletRequest request) {
        Object attribute = request.getSession().getAttribute(Consts.USERID);
        JSONObject js = new JSONObject();
        if (attribute == null) {
            js.put(Consts.RES, 0);//没有登录
            return js.toJSONString();
        }

        Integer userId = Integer.valueOf(attribute.toString());
        User byId = userService.getById(userId);
        if (StringUtils.isEmpty(byId.getAddress())) {
            js.put(Consts.RES, 2);//地址为空
            return js.toJSONString();
        }
        synchronized (lock) {
            ItemOrder order = new ItemOrder();
            Active active = activeService.getById(msId);
            if (active.getStatus() != 1) {
                js.put(Consts.RES, 3);//地址为空
                return js.toJSONString();
            }
            active.setNum(active.getNum() - 1);
            activeService.updateById(active);
            order.setStatus(0);
            order.setCode(getOrderNo());
            order.setIsDelete(0);
            order.setTotal(active.getPrice());
            order.setUserId(userId);
            order.setAddTime(new Date());
            itemOrderService.insert(order);
            OrderDetail de = new OrderDetail();
            de.setItemId(itemId);
            de.setOrderId(order.getId());
            de.setStatus(0);
            de.setNum(1);
            de.setTotal(active.getPrice());
            orderDetailService.insert(de);
            // 修改成交数
            Item load2 = itemService.load(itemId);
            load2.setGmNum(load2.getGmNum() + 1);
            itemService.updateById(load2);
            js.put(Consts.RES, 1);//成功
            return js.toJSONString();
        }
    }
后台管理模块
    private void itemCommon(Item item, @RequestParam("file") CommonsMultipartFile[] files, HttpServletRequest request) throws IOException {
        if (files.length > 0) {
            for (int s = 0; s < files.length; s++) {
                String n = UUIDUtils.create();
                String path = SystemContext.getRealPath() + "\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename();
                File newFile = new File(path);
                //通过CommonsMultipartFile的方法直接写文件
                files[s].transferTo(newFile);
                if (s == 0) {
                    item.setUrl1(request.getContextPath() + "\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
                }
                if (s == 1) {
                    item.setUrl2(request.getContextPath() + "\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
                }
                if (s == 2) {
                    item.setUrl3(request.getContextPath() + "\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
                }
                if (s == 3) {
                    item.setUrl4(request.getContextPath() + "\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
                }
                if (s == 4) {
                    item.setUrl5(request.getContextPath() + "\\resource\\ueditor\\upload\\" + n + files[s].getOriginalFilename());
                }
            }
        }
        ItemCategory byId = itemCategoryService.getById(item.getCategoryIdTwo());
        item.setCategoryIdOne(byId.getPid());
    }
数据统计模块
 @ResponseBody
    @RequestMapping("/dz")
    public String dz(Item item, HttpServletRequest request) {
        JSONObject js = new JSONObject();
        Object attribute = request.getSession().getAttribute(Consts.USERID);
        if (attribute == null) {
            js.put(Consts.RES, 0);//0失败
            return js.toJSONString(); //用json格式输出,将JSON对象转化为JSON字符.结合ajax,请求服务器数据。
        }
        Item item1 = itemService.load(item.getId());
        item.setNum(item1.getNum() + 1);
        itemService.updateById(item);
        js.put(Consts.RES, 1);//成功
        return js.toJSONString();
    }

七、项目总结:

本母婴商城系统主要分为前台和后台两大板块。

用户的操作区域是在前台,管理员则对后台进行操作前台系统主要具备了登录和注册,商品展示,商品搜索,购物车等功能,游客可以进入商城主页进行浏览,查看关于母婴商品信息,可以精准查找所需商品,了解相关活动资讯。后台系统包括维护商品和对前台页面动态进行维护管理。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值