diff --git a/蒋婷湘用例2和3进出库/CartController.java b/蒋婷湘用例2和3进出库/CartController.java new file mode 100644 index 0000000..a289415 --- /dev/null +++ b/蒋婷湘用例2和3进出库/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/蒋婷湘用例2和3进出库/GoodsController.java b/蒋婷湘用例2和3进出库/GoodsController.java new file mode 100644 index 0000000..06b3bbd --- /dev/null +++ b/蒋婷湘用例2和3进出库/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/蒋婷湘用例2和3进出库/TypeController.java b/蒋婷湘用例2和3进出库/TypeController.java new file mode 100644 index 0000000..9e3b5be --- /dev/null +++ b/蒋婷湘用例2和3进出库/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); + } +}