欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Java 實戰(zhàn)項目之家居購物商城系統(tǒng)詳解流程

 更新時間:2021年11月10日 16:31:42   作者:qq_1334611189  
讀萬卷書不如行萬里路,只學(xué)書上的理論是遠遠不夠的,只有在實戰(zhàn)中才能獲得能力的提升,本篇文章手把手帶你用Java實現(xiàn)一個家居購物商城系統(tǒng),大家可以在過程中查缺補漏,提升水平

一、項目簡述

功能: Java Web精品項目源碼,家居商城分類展示,商品展示, 商品下單,購物車,個人中心,后臺管理,用戶管理,商品管理,分類管理等等。

二、項目運行

環(huán)境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)

項目技術(shù): Jdbc+ Servlert + html+ css + JavaScript + JQuery + Ajax + Fileupload

打開訂單列表頁面代碼:

@Controller
@RequestMapping("/order")
public class OrderController {
    @Autowired
    private OrderService orderService;
 
    /**
     * 打開訂單列表頁面
     *
     * @return
     */
    @RequestMapping("/toList.html")
    public String toOrderList() {
        return "mall/order/list";
    }
 
    /**
     * 查詢用戶訂單列表
     *
     * @param request
     * @return
     */
    @RequestMapping("/list.do")
    @ResponseBody
    public ResultBean<List<Order>> listData(HttpServletRequest request) {
        List<Order> orders = orderService.findUserOrder(request);
        return new ResultBean<>(orders);
    }
 
    /**
     * 查詢訂單詳情
     *
     * @param orderId
     * @return
     */
    @RequestMapping("/getDetail.do")
    @ResponseBody
    public ResultBean<List<OrderItem>> getDetail(int orderId) {
        List<OrderItem> orderItems = orderService.findItems(orderId);
        return new ResultBean<>(orderItems);
    }
 
    /**
     * 提交訂單
     *
     * @param name
     * @param phone
     * @param addr
     * @param request
     * @param response
     */
    @RequestMapping("/submit.do")
    public void submit(String name,
                       String phone,
                       String addr,
                       HttpServletRequest request,
                       HttpServletResponse response) throws Exception {
        orderService.submit(name, phone, addr, request, response);
    }
 
    /**
     * 支付方法
     *
     * @param orderId
     */
    @RequestMapping("pay.do")
    @ResponseBody
    public ResultBean<Boolean> pay(int orderId, HttpServletResponse response) throws IOException {
        orderService.pay(orderId);
        return new ResultBean<>(true);
    }
 
    /**
     * 確認收貨
     * @param orderId
     * @param response
     * @return
     * @throws IOException
     */
    @RequestMapping("receive.do")
    @ResponseBody
    public ResultBean<Boolean> receive(int orderId, HttpServletResponse response) throws IOException {
        orderService.receive(orderId);
        return new ResultBean<>(true);
    }
 
 
}

商品信息操作代碼:

@Controller
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductService productService;
    @Autowired
    private ClassificationService classificationService;
    @Autowired
    private ShopCartService shopCartService;
 
    /**
     * 獲取商品信息
     *
     * @param id
     * @return
     */
    @RequestMapping("/get.do")
    public ResultBean<Product> getProduct(int id) {
        Product product = productService.findById(id);
        return new ResultBean<>(product);
    }
 
    /**
     * 打開商品詳情頁面
     *
     * @param id
     * @param map
     * @return
     */
    @RequestMapping("/get.html")
    public String toProductPage(int id, Map<String, Object> map) {
        Product product = productService.findById(id);
        map.put("product", product);
        return "mall/product/info";
    }
 
    /**
     * 查找熱門商品
     *
     * @return
     */
    @ResponseBody
    @RequestMapping("/hot.do")
    public ResultBean<List<Product>> getHotProduct() {
        List<Product> products = productService.findHotProduct();
        return new ResultBean<>(products);
    }
 
    /**
     * 查找最新商品
     *
     * @param pageNo
     * @param pageSize
     * @return
     */
    @ResponseBody
    @RequestMapping("/new.do")
    public ResultBean<List<Product>> getNewProduct(int pageNo, int pageSize) {
        Pageable pageable = new PageRequest(pageNo, pageSize);
        List<Product> products = productService.findNewProduct(pageable);
        return new ResultBean<>(products);
    }
 
    /**
     * 打開分類查看商品頁面
     *
     * @return
     */
    @RequestMapping("/category.html")
    public String toCatePage(int cid, Map<String, Object> map) {
        Classification classification = classificationService.findById(cid);
        map.put("category", classification);
        return "mall/product/category";
    }
 
    @RequestMapping("/toCart.html")
    public String toCart(){
        return "mall/product/cart";
    }
 
    /**
     * 按一級分類查找商品
     *
     * @param cid
     * @param pageNo
     * @param pageSize
     * @return
     */
    @ResponseBody
    @RequestMapping("/category.do")
    public ResultBean<List<Product>> getCategoryProduct(int cid, int pageNo, int pageSize) {
        Pageable pageable = new PageRequest(pageNo, pageSize);
        List<Product> products = productService.findByCid(cid, pageable);
        return new ResultBean<>(products);
    }
 
    /**
     * 按二級分類查找商品
     *
     * @param csId
     * @param pageNo
     * @param pageSize
     * @return
     */
    @ResponseBody
    @RequestMapping("/categorySec.do")
    public ResultBean<List<Product>> getCategorySecProduct(int csId, int pageNo, int pageSize) {
        Pageable pageable = new PageRequest(pageNo, pageSize);
        List<Product> products = productService.findByCsid(csId, pageable);
        return new ResultBean<>(products);
    }
 
    /**
     * 根據(jù)一級分類查詢它所有的二級分類
     * @param cid
     * @return
     */
    @ResponseBody
    @RequestMapping("/getCategorySec.do")
    public ResultBean<List<Classification>> getCategorySec(int cid){
        List<Classification> list = classificationService.findByParentId(cid);
        return new ResultBean<>(list);
    }
 
    /**
     * 加購物車
     *
     * @param productId
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/addCart.do")
    public ResultBean<Boolean> addToCart(int productId, HttpServletRequest request) throws Exception {
        shopCartService.addCart(productId, request);
        return new ResultBean<>(true);
    }
 
    /**
     * 移除購物車
     *
     * @param productId
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/delCart.do")
    public ResultBean<Boolean> delToCart(int productId, HttpServletRequest request) throws Exception {
        shopCartService.remove(productId, request);
        return new ResultBean<>(true);
    }
 
    /**
     * 查看購物車商品
     * @param request
     * @return
     */
    @ResponseBody
    @RequestMapping("/listCart.do")
    public ResultBean<List<OrderItem>> listCart(HttpServletRequest request) throws Exception {
        List<OrderItem> orderItems = shopCartService.listCart(request);
        return new ResultBean<>(orderItems);
    }
 
 
}

以上就是Java 實戰(zhàn)項目之家居購物商城系統(tǒng)詳解流程的詳細內(nèi)容,更多關(guān)于Java 家居購物商城系統(tǒng)的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

  • Spring Cache相關(guān)知識總結(jié)

    Spring Cache相關(guān)知識總結(jié)

    今天帶大家學(xué)習(xí)Spring的相關(guān)知識,文中對Spring Cache作了非常詳細的介紹,對正在學(xué)習(xí)Java Spring的小伙伴們很有幫助,需要的朋友可以參考下
    2021-05-05
  • Java redisTemplate阻塞式處理消息隊列

    Java redisTemplate阻塞式處理消息隊列

    用redis中的List可以實現(xiàn)隊列,這樣可以用來做消息處理和任務(wù)調(diào)度的隊列。因此,本文將主要為大家介紹如何利用redisTemplate處理消息隊列,感興趣的小伙伴可以了解一下
    2021-12-12
  • 5個Java API使用技巧

    5個Java API使用技巧

    這篇文章主要為大家詳細介紹了Java API安全和性能方面的簡單易用技巧,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-10-10
  • Java 17 更新后的 strictfp 關(guān)鍵字

    Java 17 更新后的 strictfp 關(guān)鍵字

    strictfp 可能是最沒有存在感的關(guān)鍵字了,很多人寫了多年 Java 甚至都不知道它的存在,strictfp,字面意思就是嚴格的浮點型。這玩意兒居然還有個關(guān)鍵字,可見其地位還是很高的。下面文章小編就帶大家詳細介紹其關(guān)鍵字,需要的朋友可以參考一下
    2021-09-09
  • Struts2學(xué)習(xí)筆記(7)-訪問Web元素

    Struts2學(xué)習(xí)筆記(7)-訪問Web元素

    這篇文章主要介紹Struts2中訪問Web元素的方法,希望能給大家做一個參考。
    2016-06-06
  • SpringBoot應(yīng)用War包形式部署到外部Tomcat的方法

    SpringBoot應(yīng)用War包形式部署到外部Tomcat的方法

    這篇文章主要介紹了SpringBoot應(yīng)用War包形式部署到外部Tomcat的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-08-08
  • 關(guān)于后端如何解決跨域的問題說明

    關(guān)于后端如何解決跨域的問題說明

    這篇文章主要介紹了關(guān)于后端如何解決跨域的問題說明,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-08-08
  • sqlite數(shù)據(jù)庫的介紹與java操作sqlite的實例講解

    sqlite數(shù)據(jù)庫的介紹與java操作sqlite的實例講解

    今天小編就為大家分享一篇關(guān)于sqlite數(shù)據(jù)庫的介紹與java操作sqlite的實例講解,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧
    2019-02-02
  • Java常見的數(shù)據(jù)結(jié)構(gòu)之棧和隊列詳解

    Java常見的數(shù)據(jù)結(jié)構(gòu)之棧和隊列詳解

    這篇文章主要介紹了Java常見的數(shù)據(jù)結(jié)構(gòu)之棧和隊列詳解,棧(Stack) 是一種基本的數(shù)據(jù)結(jié)構(gòu),具有后進先出(LIFO)的特性,類似于現(xiàn)實生活中的一疊盤子,棧用于存儲一組元素,但只允許在棧頂進行插入(入棧)和刪除(出棧)操作,需要的朋友可以參考下
    2023-10-10
  • Java實戰(zhàn)項目 圖書管理系統(tǒng)

    Java實戰(zhàn)項目 圖書管理系統(tǒng)

    這篇文章主要介紹了使用java SSM jsp mysql maven設(shè)計實現(xiàn)的精品圖書管理系統(tǒng),是一個很好的實例,對大家的學(xué)習(xí)和工作具有借鑒意義,建議收藏一下
    2021-09-09

最新評論