易购项目(简单描述)

该项目采用SOA架构,包括ego-commons、ego-manage、ego-portal等子项目,利用逆向工程生成mapper和pojo,通过maven+nexus上传到私服。ego-item通过dubbo接口访问数据库,ego-redis用于缓存,后台管理通过dubbo provider保护数据库访问,同时使用vsftpd和nginx处理图片上传。
摘要由CSDN通过智能技术生成

易购项目(简单描述)
基于SOA架构
在这里插入图片描述
使用逆向工程生成mapper和pojo

使用maven+nexus将项目上传到私服
在这里插入图片描述
创建一个父项目和八个子项目
在这里插入图片描述
ego-commons:整个项目需要用到的工具类
ego-manage:后台展示
ego-portal:前台展示
ego-pojo:实体类
ego-item:portal通过该项目访问dubbo
ego-redis:manane和portal需要使用
ego-service:dubbo的接口
ego-service-impl:dubbo的实现类

此外还需要搭建的环境
在这里插入图片描述
后台展示
通过dubbo的provider来提供对数据库的保护,manange通过provider来对数据库进行访问在这里插入图片描述
通过vsftd和nginx实现图片的上传
在这里插入图片描述
代码

package com.ego.manage.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class PageController {
   
    @RequestMapping("/")
    public String welcome(){
   
        return "index";
    }
    @RequestMapping("{page}")
    public String showPage(@PathVariable String page){
   
        return page;
    }
}

package com.ego.manage.controller;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.ego.manage.service.PicService;

@Controller
public class PicController {
   
    @Resource
    private PicService picServiceImpl;

    /**
     * 图片上传
     */
    @RequestMapping("pic/upload")
    @ResponseBody
    public Map<String,Object> upload(MultipartFile uploadFile){
   
        Map<String,Object> map = null;
        try {
   
            map= picServiceImpl.upload(uploadFile);
        } catch (IOException e) {
   
            e.printStackTrace();
            map.put("error", 1);
            map.put("message","上传图片时服务器异常");
        }
        return map;
    }
}

package com.ego.manage.controller;

import com.ego.commons.pojo.EasyUiTree;
import com.ego.commons.pojo.EgoResult;
import com.ego.manage.service.TbContentCategoryService;
import com.ego.pojo.TbContentCategory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class TbContentCategoryController {
   
    @Resource
    private TbContentCategoryService tbContentCategoryServiceImpl;
    /**
     * 查询商品类目
     */
    @RequestMapping("content/category/list")
    @ResponseBody
    public List<EasyUiTree> showCategory(@RequestParam(defaultValue="0") long id){
   
        return tbContentCategoryServiceImpl.showCategory(id);
    }
    /**
     * 新增内容类目
     */
    @RequestMapping("content/category/create")
    @ResponseBody
    public EgoResult create(TbContentCategory cate){
   
        return tbContentCategoryServiceImpl.create(cate);
    }
    /**
     * 重命名
     */
    @RequestMapping("content/category/update")
    @ResponseBody
    public EgoResult update(TbContentCategory cate){
   
        return tbContentCategoryServiceImpl.update(cate);
    }
    /**
     * 删除
     */
    @RequestMapping("content/category/delete")
    @ResponseBody
    public EgoResult delete(TbContentCategory cate){
   
        return tbContentCategoryServiceImpl.delete(cate);
    }
}

package com.ego.manage.controller;

import com.ego.commons.pojo.EasyUIDataGrid;
import com.ego.commons.pojo.EgoResult;
import com.ego.manage.service.TbContentService;
import com.ego.pojo.TbContent;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class TbContentController {
   
    @Resource
    private TbContentService tbContentServiceImpl;

    /**
     * 显示内容信息
     */
    @RequestMapping("content/query/list")
    @ResponseBody
    public EasyUIDataGrid showContent(long categoryId, int page, int rows){
   
        return tbContentServiceImpl.showContent(categoryId, page, rows);
    }
    /**
     * 新增内容
     */
    @RequestMapping("content/save")
    @ResponseBody
    public EgoResult save(TbContent content){
   
        EgoResult er = new EgoResult();
        int index = tbContentServiceImpl.save(content);
        if(index>0){
   
            er.setStatus(200);
        }
        return er;
    }
}

package com.ego.manage.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ego.commons.pojo.EasyUiTree;
import com.ego.manage.service.TbItemCatService;

@Controller
public class TbItemCatController {
   
    @Resource
    private TbItemCatService tbItemCatServiceImpl;
    /**
     * 显示商品类目
     */
    @RequestMapping("item/cat/list")
    @ResponseBody
    public List<EasyUiTree> showCat(@RequestParam(defaultValue="0") long id){
   
        return tbItemCatServiceImpl.show(id);
    }
}

package com.ego.manage.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ego.commons.pojo.EasyUIDataGrid;
import com.ego.commons.pojo.EgoResult;
import com.ego.manage.service.TbItemService;
import com.ego.pojo.TbItem;
import com.ego.pojo.TbItemDesc;

@Controller
public class TbItemController {
   
    @Resource
    private TbItemService tbItemServiceImpl;
    /**
     * 分页显示商品
     */
    @RequestMapping("item/list")
    @ResponseBody
    public EasyUIDataGrid show(int page,int rows){
   
        return tbItemServiceImpl.show(page, rows);
    }
    /**
     * 显示商品修改

     */
    @RequestMapping("rest/page/item-edit")
    public String showItemEdit(){
   
        return "item-edit";
    }

    /**
     * 商品删除
     */
    @RequestMapping("rest/item/delete")
    @ResponseBody
    public EgoResult delete(String ids){
   
        EgoResult er = new EgoResult();
        int index = tbItemServiceImpl.update(ids, (byte)3);
        if(index==1){
   
            er.setStatus(200);
        }
        return er;
    }
    /**
     * 商品下架
     */
    @RequestMapping("rest/item/instock")
    @ResponseBody
    public EgoResult instock(String ids){
   
        EgoResult er = new EgoResult();
        int index = tbItemServiceImpl.update(ids, (byte)2);
        if(index==1){
   
            er.setStatus(200);
        }
        return er;
    }
    /**
     * 商品上架
     */
    @RequestMapping("rest/item/reshelf")
    @ResponseBody
    public EgoResult reshelf(String ids){
   
        EgoResult er = new EgoResult();
        int index = tbItemServiceImpl.update(ids, (byte)1);
        if(index==1){
   
            er.setStatus(200);
        }
        return<
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值