From 1714af8ca4854c7e635ac37ed489cba7871030b8 Mon Sep 17 00:00:00 2001 From: ttt <3067797505@qq.com> Date: Fri, 15 Dec 2023 15:38:51 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=BB=95=E7=94=B0=E7=94=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- UserAndOrderAndOutController.java | 36 +++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 UserAndOrderAndOutController.java diff --git a/UserAndOrderAndOutController.java b/UserAndOrderAndOutController.java new file mode 100644 index 0000000..a1f35c9 --- /dev/null +++ b/UserAndOrderAndOutController.java @@ -0,0 +1,36 @@ +package com.ch.ebusiness.controller.admin; + +import javax.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.ch.ebusiness.entity.AUser; +import com.ch.ebusiness.service.admin.UserAndOrderAndOutService; +@Controller +public class UserAndOrderAndOutController extends AdminBaseController{ + @Autowired + private UserAndOrderAndOutService userAndOrderAndOutService; + @RequestMapping("/loginOut") + public String loginOut(@ModelAttribute("aUser") AUser aUser, HttpSession session) { + session.invalidate(); + return "admin/login"; + } + @RequestMapping("/selectUser") + public String selectUser(Model model, int currentPage) { + return userAndOrderAndOutService.selectUser(model, currentPage); + } + @RequestMapping("/deleteUser") + @ResponseBody + public String deleteUser(Model model, int id) { + return userAndOrderAndOutService.deleteUser(model, id); + } + @RequestMapping("/selectOrder") + public String selectOrder(Model model, int currentPage) { + return userAndOrderAndOutService.selectOrder(model, currentPage); + } +} From 6499d3b2cae588efb54eb729bc47d662dd5cb5d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=A9=B7=E6=B9=98?= <1684173385@qq.com> Date: Fri, 15 Dec 2023 15:53:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=92=8B=E5=A9=B7=E6=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OnlineFlowerShop/CartController.java | 71 +++++++++++++++++++++++++++ OnlineFlowerShop/GoodsController.java | 44 +++++++++++++++++ OnlineFlowerShop/TypeController.java | 35 +++++++++++++ 3 files changed, 150 insertions(+) create mode 100644 OnlineFlowerShop/CartController.java create mode 100644 OnlineFlowerShop/GoodsController.java create mode 100644 OnlineFlowerShop/TypeController.java diff --git a/OnlineFlowerShop/CartController.java b/OnlineFlowerShop/CartController.java new file mode 100644 index 0000000..a289415 --- /dev/null +++ b/OnlineFlowerShop/CartController.java @@ -0,0 +1,71 @@ +package com.ch.ebusiness.controller.before; + +import javax.servlet.http.HttpSession; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.ch.ebusiness.entity.Goods; +import com.ch.ebusiness.entity.Order; +import com.ch.ebusiness.service.before.CartService; + +@Controller +@RequestMapping("/cart") +public class CartController extends BeforeBaseController{ + @Autowired + private CartService cartService; + @RequestMapping("/putCart") + public String putCart(Goods goods, Model model, HttpSession session) { + return cartService.putCart(goods, model, session); + } + @RequestMapping("/focus") + @ResponseBody + public String focus(@RequestBody Goods goods, Model model, HttpSession session) { + return cartService.focus(model, session, goods.getId()); + } + @RequestMapping("/selectCart") + public String selectCart(Model model, HttpSession session, String act) { + return cartService.selectCart(model, session, act); + } + @RequestMapping("/deleteCart") + public String deleteCart(HttpSession session, Integer gid) { + return cartService.deleteCart(session, gid); + } + @RequestMapping("/clearCart") + public String clearCart(HttpSession session) { + return cartService.clearCart(session); + } + @RequestMapping("/submitOrder") + public String submitOrder(Order order, Model model, HttpSession session) { + return cartService.submitOrder(order, model, session); + } + @RequestMapping("/pay") + @ResponseBody + public String pay(@RequestBody Order order) { + return cartService.pay(order); + } + @RequestMapping("/myFocus") + public String myFocus(Model model, HttpSession session) { + return cartService.myFocus(model, session); + } + @RequestMapping("/myOder") + public String myOder(Model model, HttpSession session) { + return cartService.myOder(model, session); + } + @RequestMapping("/orderDetail") + public String orderDetail(Model model, Integer id) { + return cartService.orderDetail(model, id); + } + @RequestMapping("/userInfo") + public String userInfo() { + return "user/userInfo"; + } + @RequestMapping("/updateUpwd") + public String updateUpwd(HttpSession session, String bpwd) { + return cartService.updateUpwd(session, bpwd); + } +} diff --git a/OnlineFlowerShop/GoodsController.java b/OnlineFlowerShop/GoodsController.java new file mode 100644 index 0000000..06b3bbd --- /dev/null +++ b/OnlineFlowerShop/GoodsController.java @@ -0,0 +1,44 @@ +package com.ch.ebusiness.controller.admin; + +import java.io.IOException; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.ch.ebusiness.entity.Goods; +import com.ch.ebusiness.service.admin.GoodsService; +@Controller +@RequestMapping("/goods") +public class GoodsController extends AdminBaseController{ + @Autowired + private GoodsService goodsService; + @RequestMapping("/selectAllGoodsByPage") + public String selectAllGoodsByPage(Model model, int currentPage) { + return goodsService.selectAllGoodsByPage(model, currentPage); + } + @RequestMapping("/toAddGoods") + public String toAddGoods(@ModelAttribute("goods") Goods goods, Model model) { + goods.setIsAdvertisement(0); + goods.setIsRecommend(1); + return goodsService.toAddGoods(goods, model); + } + @RequestMapping("/addGoods") + public String addGoods(@ModelAttribute("goods") Goods goods, HttpServletRequest request, String act) throws IllegalStateException, IOException { + return goodsService.addGoods(goods, request, act); + } + @RequestMapping("/detail") + public String detail(Model model, Integer id, String act) { + return goodsService.detail(model, id, act); + } + @RequestMapping("/delete") + @ResponseBody + public String delete(Integer id) { + return goodsService.delete(id); + } +} diff --git a/OnlineFlowerShop/TypeController.java b/OnlineFlowerShop/TypeController.java new file mode 100644 index 0000000..9e3b5be --- /dev/null +++ b/OnlineFlowerShop/TypeController.java @@ -0,0 +1,35 @@ +package com.ch.ebusiness.controller.admin; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.ch.ebusiness.entity.GoodsType; +import com.ch.ebusiness.service.admin.TypeService; + +@Controller +@RequestMapping("/type") +public class TypeController extends AdminBaseController{ + @Autowired + private TypeService typeService; + @RequestMapping("/selectAllTypeByPage") + public String selectAllTypeByPage(Model model, int currentPage) { + return typeService.selectAllTypeByPage(model, currentPage); + } + @RequestMapping("/deleteType") + @ResponseBody//返回字符串数据而不是视图 + public String delete(int id) { + return typeService.delete(id); + } + @RequestMapping("/toAddType") + public String toAddType(@ModelAttribute("goodsType") GoodsType goodsType) { + return "admin/addType"; + } + @RequestMapping("/addType") + public String addType(@ModelAttribute("goodsType") GoodsType goodsType) { + return typeService.addType(goodsType); + } +}