├── .idea ├── artifacts │ ├── tmall_ssm_war.xml │ └── tmall_ssm_war_exploded.xml ├── compiler.xml ├── encodings.xml ├── inspectionProfiles │ └── Project_Default.xml ├── libraries │ ├── Maven__aopalliance_aopalliance_1_0.xml │ ├── Maven__com_alibaba_druid_1_0_18.xml │ ├── Maven__com_github_jsqlparser_jsqlparser_1_0.xml │ ├── Maven__com_github_pagehelper_pagehelper_5_1_2_beta.xml │ ├── Maven__commons_fileupload_commons_fileupload_1_2_1.xml │ ├── Maven__commons_io_commons_io_1_3_2.xml │ ├── Maven__commons_lang_commons_lang_2_6.xml │ ├── Maven__commons_logging_commons_logging_1_2.xml │ ├── Maven__javax_servlet_javax_servlet_api_3_1_0.xml │ ├── Maven__jstl_jstl_1_2.xml │ ├── Maven__junit_junit_3_8_1.xml │ ├── Maven__log4j_log4j_1_2_16.xml │ ├── Maven__mysql_mysql_connector_java_5_1_6.xml │ ├── Maven__org_aspectj_aspectjweaver_1_8_4.xml │ ├── Maven__org_mybatis_generator_mybatis_generator_core_1_3_5.xml │ ├── Maven__org_mybatis_mybatis_3_1_1.xml │ ├── Maven__org_mybatis_mybatis_spring_1_2_3.xml │ ├── Maven__org_springframework_spring_aop_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_aspects_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_beans_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_context_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_core_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_expression_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_jdbc_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_test_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_tx_4_1_3_RELEASE.xml │ ├── Maven__org_springframework_spring_web_4_1_3_RELEASE.xml │ └── Maven__org_springframework_spring_webmvc_4_1_3_RELEASE.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── README.md ├── pom.xml ├── src └── main │ ├── java │ ├── com │ │ └── how2java │ │ │ └── tmall │ │ │ ├── controller │ │ │ ├── CategoryController.java │ │ │ ├── ForeController.java │ │ │ ├── OrderController.java │ │ │ ├── PageController.java │ │ │ ├── ProductController.java │ │ │ ├── ProductImageController.java │ │ │ ├── PropertyController.java │ │ │ ├── PropertyValueController.java │ │ │ └── UserController.java │ │ │ ├── interceptor │ │ │ ├── LoginInterceptor.java │ │ │ └── OtherInterceptor.java │ │ │ ├── mapper │ │ │ ├── CategoryMapper.java │ │ │ ├── OrderItemMapper.java │ │ │ ├── OrderMapper.java │ │ │ ├── ProductImageMapper.java │ │ │ ├── ProductMapper.java │ │ │ ├── PropertyMapper.java │ │ │ ├── PropertyValueMapper.java │ │ │ ├── ReviewMapper.java │ │ │ └── UserMapper.java │ │ │ ├── pojo │ │ │ ├── Category.java │ │ │ ├── CategoryExample.java │ │ │ ├── Order.java │ │ │ ├── OrderExample.java │ │ │ ├── OrderItem.java │ │ │ ├── OrderItemExample.java │ │ │ ├── Product.java │ │ │ ├── ProductExample.java │ │ │ ├── ProductImage.java │ │ │ ├── ProductImageExample.java │ │ │ ├── Property.java │ │ │ ├── PropertyExample.java │ │ │ ├── PropertyValue.java │ │ │ ├── PropertyValueExample.java │ │ │ ├── Review.java │ │ │ ├── ReviewExample.java │ │ │ ├── User.java │ │ │ └── UserExample.java │ │ │ ├── service │ │ │ ├── CategoryService.java │ │ │ ├── OrderItemService.java │ │ │ ├── OrderService.java │ │ │ ├── ProductImageService.java │ │ │ ├── ProductService.java │ │ │ ├── PropertyService.java │ │ │ ├── PropertyValueService.java │ │ │ ├── ReviewService.java │ │ │ ├── UserService.java │ │ │ └── impl │ │ │ │ ├── CategoryServiceImpl.java │ │ │ │ ├── OrderItemServiceImpl.java │ │ │ │ ├── OrderServiceImpl.java │ │ │ │ ├── ProductImageServiceImpl.java │ │ │ │ ├── ProductServiceImpl.java │ │ │ │ ├── PropertyServiceImpl.java │ │ │ │ ├── PropertyValueServiceImpl.java │ │ │ │ ├── ReviewServiceImpl.java │ │ │ │ └── UserServiceImpl.java │ │ │ └── util │ │ │ ├── ImageUtil.java │ │ │ ├── MybatisGenerator.java │ │ │ ├── OverIsMergeablePlugin.java │ │ │ ├── Page.java │ │ │ └── UploadedImageFile.java │ └── tmall │ │ └── comparator │ │ ├── ProductAllComparator.java │ │ ├── ProductDateComparator.java │ │ ├── ProductPriceComparator.java │ │ ├── ProductReviewComparator.java │ │ └── ProductSaleCountComparator.java │ ├── resources │ ├── applicationContext.xml │ ├── generatorConfig.xml │ ├── jdbc.properties │ ├── log4j.properties │ ├── mapper │ │ └── CategoryMapper.xml │ └── springMVC.xml │ └── webapp │ ├── WEB-INF │ ├── jsp │ │ ├── admin │ │ │ ├── editCategory.jsp │ │ │ ├── editProduct.jsp │ │ │ ├── editProperty.jsp │ │ │ ├── editPropertyValue.jsp │ │ │ ├── listCategory.jsp │ │ │ ├── listOrder.jsp │ │ │ ├── listProduct.jsp │ │ │ ├── listProductImage.jsp │ │ │ ├── listProperty.jsp │ │ │ └── listUser.jsp │ │ ├── fore │ │ │ ├── alipay.jsp │ │ │ ├── bought.jsp │ │ │ ├── buy.jsp │ │ │ ├── cart.jsp │ │ │ ├── category.jsp │ │ │ ├── confirmPay.jsp │ │ │ ├── home.jsp │ │ │ ├── login.jsp │ │ │ ├── orderConfirmed.jsp │ │ │ ├── payed.jsp │ │ │ ├── product.jsp │ │ │ ├── register.jsp │ │ │ ├── registerSuccess.jsp │ │ │ ├── review.jsp │ │ │ └── searchResult.jsp │ │ └── include │ │ │ ├── cart │ │ │ ├── alipayPage.jsp │ │ │ ├── boughtPage.jsp │ │ │ ├── buyPage.jsp │ │ │ ├── cartPage.jsp │ │ │ ├── confirmPayPage.jsp │ │ │ ├── orderConfirmedPage.jsp │ │ │ ├── payedPage.jsp │ │ │ └── reviewPage.jsp │ │ │ ├── category │ │ │ ├── categoryPage.jsp │ │ │ ├── productsByCategory.jsp │ │ │ └── sortBar.jsp │ │ │ ├── fore │ │ │ ├── footer.jsp │ │ │ ├── header.jsp │ │ │ ├── home │ │ │ │ ├── carousel.jsp │ │ │ │ ├── categoryAndcarousel.jsp │ │ │ │ ├── categoryMenu.jsp │ │ │ │ ├── homePage.jsp │ │ │ │ ├── homepageCategoryProducts.jsp │ │ │ │ └── productsAsideCategorys.jsp │ │ │ ├── loginPage.jsp │ │ │ ├── modal.jsp │ │ │ ├── productsBySearch.jsp │ │ │ ├── registerPage.jsp │ │ │ ├── registerSuccessPage.jsp │ │ │ ├── search.jsp │ │ │ ├── searchResultPage.jsp │ │ │ ├── simpleSearch.jsp │ │ │ └── top.jsp │ │ │ └── product │ │ │ ├── imgAndInfo.jsp │ │ │ ├── productDetail.jsp │ │ │ ├── productPage.jsp │ │ │ └── productReview.jsp │ └── web.xml │ └── index.jsp └── tmall_ssm.iml /.idea/artifacts/tmall_ssm_war.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/target 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/artifacts/tmall_ssm_war_exploded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/target/tmall_ssm 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__aopalliance_aopalliance_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_druid_1_0_18.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_jsqlparser_jsqlparser_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_pagehelper_pagehelper_5_1_2_beta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_fileupload_commons_fileupload_1_2_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_io_commons_io_1_3_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_logging_commons_logging_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jstl_jstl_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_3_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__log4j_log4j_1_2_16.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__mysql_mysql_connector_java_5_1_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_aspectj_aspectjweaver_1_8_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_generator_mybatis_generator_core_1_3_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_3_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_mybatis_mybatis_spring_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aop_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_aspects_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_beans_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_context_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_core_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_expression_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_jdbc_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_test_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_web_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_webmvc_4_1_3_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tmall_ssm 2 | 模仿天猫商城使用ssm框架搭建的前后台交互的购物网站 3 | 4 | 5 | 2018.01.06 6 | 7 | 到今天为止,项目以及初步实现,基本功能都有了! 8 | 9 | 数据库和图片文件比较大,就不上传了, 10 | 在此贴出图片和数据库的百度云地址 11 | 链接:https://pan.baidu.com/s/1i4YkmUh 密码:zrfy 12 | 13 | 可以下载后部署到本地调试 14 | 15 | 接下来就是一些bug修复功能,有些地方还需要完善! 16 | 17 | 18 | 我将完整源码上传于此,大家可以下载借鉴着看 19 | https://pan.baidu.com/s/1srPVTPnmQXjqRatDJUXleQ 密码:dk4f 20 | 21 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/controller/CategoryController.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.controller; 2 | 3 | import com.github.pagehelper.PageHelper; 4 | import com.github.pagehelper.PageInfo; 5 | import com.how2java.tmall.pojo.Category; 6 | import com.how2java.tmall.service.CategoryService; 7 | import com.how2java.tmall.util.ImageUtil; 8 | import com.how2java.tmall.util.Page; 9 | import com.how2java.tmall.util.UploadedImageFile; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Controller; 12 | import org.springframework.ui.Model; 13 | import org.springframework.web.bind.annotation.RequestMapping; 14 | import org.springframework.web.multipart.MultipartFile; 15 | 16 | import javax.imageio.ImageIO; 17 | import javax.servlet.http.HttpSession; 18 | import java.awt.image.BufferedImage; 19 | import java.io.File; 20 | import java.io.IOException; 21 | import java.util.List; 22 | 23 | @Controller 24 | @RequestMapping("") 25 | public class CategoryController { 26 | @Autowired 27 | CategoryService categoryService; 28 | 29 | @RequestMapping("admin_category_list") 30 | public String list(Model model,Page page){ 31 | PageHelper.offsetPage(page.getStart(),page.getCount()); 32 | List cs= categoryService.list(); 33 | int total = (int) new PageInfo<>(cs).getTotal(); 34 | page.setTotal(total); 35 | model.addAttribute("cs", cs); 36 | model.addAttribute("page", page); 37 | return "admin/listCategory"; 38 | } 39 | 40 | @RequestMapping("admin_category_add") 41 | public String add(Category c, HttpSession session, UploadedImageFile uploadedImageFile) throws IOException { 42 | categoryService.add(c); 43 | File imageFolder= new File(session.getServletContext().getRealPath("img/category")); 44 | File file = new File(imageFolder,c.getId()+".jpg"); 45 | if(!file.getParentFile().exists()) 46 | file.getParentFile().mkdirs(); 47 | uploadedImageFile.getImage().transferTo(file); 48 | BufferedImage img = ImageUtil.change2jpg(file); 49 | ImageIO.write(img, "jpg", file); 50 | return "redirect:/admin_category_list"; 51 | } 52 | 53 | @RequestMapping("admin_category_delete") 54 | public String delete(int id,HttpSession session) throws IOException { 55 | categoryService.delete(id); 56 | 57 | File imageFolder= new File(session.getServletContext().getRealPath("img/category")); 58 | File file = new File(imageFolder,id+".jpg"); 59 | file.delete(); 60 | 61 | return "redirect:/admin_category_list"; 62 | } 63 | 64 | @RequestMapping("admin_category_edit") 65 | public String edit(int id,Model model) throws IOException { 66 | Category c= categoryService.get(id); 67 | model.addAttribute("c", c); 68 | return "admin/editCategory"; 69 | } 70 | 71 | @RequestMapping("admin_category_update") 72 | public String update(Category c, HttpSession session, UploadedImageFile uploadedImageFile) throws IOException { 73 | categoryService.update(c); 74 | MultipartFile image = uploadedImageFile.getImage(); 75 | if(null!=image &&!image.isEmpty()){ 76 | File imageFolder= new File(session.getServletContext().getRealPath("img/category")); 77 | File file = new File(imageFolder,c.getId()+".jpg"); 78 | image.transferTo(file); 79 | BufferedImage img = ImageUtil.change2jpg(file); 80 | ImageIO.write(img, "jpg", file); 81 | } 82 | return "redirect:/admin_category_list"; 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.controller; 2 | 3 | import java.io.IOException; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.ui.Model; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | 12 | import com.github.pagehelper.PageHelper; 13 | import com.github.pagehelper.PageInfo; 14 | import com.how2java.tmall.pojo.Order; 15 | import com.how2java.tmall.service.OrderItemService; 16 | import com.how2java.tmall.service.OrderService; 17 | import com.how2java.tmall.util.Page; 18 | 19 | 20 | @Controller 21 | @RequestMapping("") 22 | public class OrderController { 23 | @Autowired 24 | OrderService orderService; 25 | @Autowired 26 | OrderItemService orderItemService; 27 | 28 | @RequestMapping("admin_order_list") 29 | public String list(Model model, Page page){ 30 | PageHelper.offsetPage(page.getStart(),page.getCount()); 31 | 32 | List os= orderService.list(); 33 | 34 | int total = (int) new PageInfo<>(os).getTotal(); 35 | page.setTotal(total); 36 | 37 | orderItemService.fill(os); 38 | 39 | model.addAttribute("os", os); 40 | model.addAttribute("page", page); 41 | 42 | return "admin/listOrder"; 43 | } 44 | 45 | @RequestMapping("admin_order_delivery") 46 | public String delivery(Order o) throws IOException { 47 | o.setDeliveryDate(new Date()); 48 | o.setStatus(OrderService.waitConfirm); 49 | orderService.update(o); 50 | return "redirect:admin_order_list"; 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/controller/PageController.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.controller; 2 | 3 | import org.springframework.stereotype.Controller; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | 6 | @Controller 7 | @RequestMapping("") 8 | public class PageController { 9 | @RequestMapping("registerPage") 10 | public String registerPage() { 11 | return "fore/register"; 12 | } 13 | @RequestMapping("registerSuccessPage") 14 | public String registerSuccessPage() { 15 | return "fore/registerSuccess"; 16 | } 17 | @RequestMapping("loginPage") 18 | public String loginPage() { 19 | return "fore/login"; 20 | } 21 | @RequestMapping("forealipay") 22 | public String alipay(){ 23 | return "fore/alipay"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/controller/ProductController.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.controller; 2 | 3 | import java.util.List; 4 | 5 | import javax.servlet.http.HttpServletResponse; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.ui.Model; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | 12 | import com.github.pagehelper.PageHelper; 13 | import com.github.pagehelper.PageInfo; 14 | import com.how2java.tmall.pojo.Category; 15 | import com.how2java.tmall.pojo.Product; 16 | import com.how2java.tmall.service.CategoryService; 17 | import com.how2java.tmall.service.ProductService; 18 | import com.how2java.tmall.util.Page; 19 | 20 | @Controller 21 | @RequestMapping("") 22 | public class ProductController { 23 | @Autowired 24 | CategoryService categoryService; 25 | @Autowired 26 | ProductService productService; 27 | 28 | @RequestMapping("admin_product_add") 29 | public String add(Model model, Product p) { 30 | productService.add(p); 31 | return "redirect:admin_product_list?cid="+p.getCid(); 32 | } 33 | 34 | @RequestMapping("admin_product_delete") 35 | public String delete(int id) { 36 | Product p = productService.get(id); 37 | productService.delete(id); 38 | return "redirect:admin_product_list?cid="+p.getCid(); 39 | } 40 | 41 | @RequestMapping("admin_product_edit") 42 | public String edit(Model model, int id) { 43 | Product p = productService.get(id); 44 | Category c = categoryService.get(p.getCid()); 45 | p.setCategory(c); 46 | model.addAttribute("p", p); 47 | return "admin/editProduct"; 48 | } 49 | 50 | @RequestMapping("admin_product_update") 51 | public String update(Product p) { 52 | productService.update(p); 53 | return "redirect:admin_product_list?cid="+p.getCid(); 54 | } 55 | 56 | @RequestMapping("admin_product_list") 57 | public String list(int cid, Model model, Page page) { 58 | Category c = categoryService.get(cid); 59 | 60 | PageHelper.offsetPage(page.getStart(),page.getCount()); 61 | List ps = productService.list(cid); 62 | 63 | int total = (int) new PageInfo<>(ps).getTotal(); 64 | page.setTotal(total); 65 | page.setParam("&cid="+c.getId()); 66 | 67 | model.addAttribute("ps", ps); 68 | model.addAttribute("c", c); 69 | model.addAttribute("page", page); 70 | 71 | return "admin/listProduct"; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/controller/ProductImageController.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.controller; 2 | 3 | import java.awt.image.BufferedImage; 4 | import java.io.File; 5 | import java.util.List; 6 | 7 | import javax.imageio.ImageIO; 8 | import javax.servlet.http.HttpServletResponse; 9 | import javax.servlet.http.HttpSession; 10 | 11 | import org.springframework.beans.factory.annotation.Autowired; 12 | import org.springframework.stereotype.Controller; 13 | import org.springframework.ui.Model; 14 | import org.springframework.web.bind.annotation.RequestMapping; 15 | 16 | import com.how2java.tmall.pojo.Product; 17 | import com.how2java.tmall.pojo.ProductImage; 18 | import com.how2java.tmall.service.ProductImageService; 19 | import com.how2java.tmall.service.ProductService; 20 | import com.how2java.tmall.util.ImageUtil; 21 | import com.how2java.tmall.util.Page; 22 | import com.how2java.tmall.util.UploadedImageFile; 23 | 24 | 25 | @Controller 26 | @RequestMapping("") 27 | public class ProductImageController { 28 | @Autowired 29 | ProductService productService; 30 | 31 | @Autowired 32 | ProductImageService productImageService; 33 | 34 | 35 | @RequestMapping("admin_productImage_add") 36 | public String add(ProductImage pi, HttpSession session, UploadedImageFile uploadedImageFile) { 37 | productImageService.add(pi); 38 | String fileName = pi.getId()+ ".jpg"; 39 | String imageFolder; 40 | String imageFolder_small=null; 41 | String imageFolder_middle=null; 42 | if(ProductImageService.type_single.equals(pi.getType())){ 43 | imageFolder= session.getServletContext().getRealPath("img/productSingle"); 44 | imageFolder_small= session.getServletContext().getRealPath("img/productSingle_small"); 45 | imageFolder_middle= session.getServletContext().getRealPath("img/productSingle_middle"); 46 | } 47 | else{ 48 | imageFolder= session.getServletContext().getRealPath("img/productDetail"); 49 | } 50 | 51 | File f = new File(imageFolder, fileName); 52 | f.getParentFile().mkdirs(); 53 | try { 54 | uploadedImageFile.getImage().transferTo(f); 55 | BufferedImage img = ImageUtil.change2jpg(f); 56 | ImageIO.write(img, "jpg", f); 57 | 58 | if(ProductImageService.type_single.equals(pi.getType())) { 59 | File f_small = new File(imageFolder_small, fileName); 60 | File f_middle = new File(imageFolder_middle, fileName); 61 | 62 | ImageUtil.resizeImage(f, 56, 56, f_small); 63 | ImageUtil.resizeImage(f, 217, 190, f_middle); 64 | } 65 | 66 | } catch (Exception e) { 67 | e.printStackTrace(); 68 | } 69 | return "redirect:admin_productImage_list?pid="+pi.getPid(); 70 | } 71 | 72 | @RequestMapping("admin_productImage_delete") 73 | public String delete(int id,HttpSession session) { 74 | ProductImage pi = productImageService.get(id); 75 | 76 | String fileName = pi.getId()+ ".jpg"; 77 | String imageFolder; 78 | String imageFolder_small=null; 79 | String imageFolder_middle=null; 80 | 81 | if(ProductImageService.type_single.equals(pi.getType())){ 82 | imageFolder= session.getServletContext().getRealPath("img/productSingle"); 83 | imageFolder_small= session.getServletContext().getRealPath("img/productSingle_small"); 84 | imageFolder_middle= session.getServletContext().getRealPath("img/productSingle_middle"); 85 | File imageFile = new File(imageFolder,fileName); 86 | File f_small = new File(imageFolder_small,fileName); 87 | File f_middle = new File(imageFolder_middle,fileName); 88 | imageFile.delete(); 89 | f_small.delete(); 90 | f_middle.delete(); 91 | 92 | } 93 | else{ 94 | imageFolder= session.getServletContext().getRealPath("img/productDetail"); 95 | File imageFile = new File(imageFolder,fileName); 96 | imageFile.delete(); 97 | } 98 | 99 | 100 | productImageService.delete(id); 101 | 102 | 103 | return "redirect:admin_productImage_list?pid="+pi.getPid(); 104 | } 105 | 106 | @RequestMapping("admin_productImage_list") 107 | public String list(int pid, Model model) { 108 | Product p =productService.get(pid); 109 | List pisSingle = productImageService.list(pid, ProductImageService.type_single); 110 | List pisDetail = productImageService.list(pid, ProductImageService.type_detail); 111 | 112 | 113 | model.addAttribute("p", p); 114 | model.addAttribute("pisSingle", pisSingle); 115 | model.addAttribute("pisDetail", pisDetail); 116 | 117 | return "admin/listProductImage"; 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/controller/PropertyController.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.controller; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.ui.Model; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | 10 | import com.github.pagehelper.PageHelper; 11 | import com.github.pagehelper.PageInfo; 12 | import com.how2java.tmall.pojo.Category; 13 | import com.how2java.tmall.pojo.Property; 14 | import com.how2java.tmall.service.CategoryService; 15 | import com.how2java.tmall.service.PropertyService; 16 | import com.how2java.tmall.util.Page; 17 | 18 | @Controller 19 | @RequestMapping("") 20 | public class PropertyController { 21 | @Autowired 22 | CategoryService categoryService; 23 | @Autowired 24 | PropertyService propertyService; 25 | 26 | @RequestMapping("admin_property_add") 27 | public String add(Model model, Property p) { 28 | propertyService.add(p); 29 | return "redirect:admin_property_list?cid="+p.getCid(); 30 | } 31 | 32 | @RequestMapping("admin_property_delete") 33 | public String delete(int id) { 34 | Property p = propertyService.get(id); 35 | propertyService.delete(id); 36 | return "redirect:admin_property_list?cid="+p.getCid(); 37 | } 38 | 39 | @RequestMapping("admin_property_edit") 40 | public String edit(Model model, int id) { 41 | Property p = propertyService.get(id); 42 | Category c = categoryService.get(p.getCid()); 43 | p.setCategory(c); 44 | model.addAttribute("p", p); 45 | return "admin/editProperty"; 46 | } 47 | 48 | @RequestMapping("admin_property_update") 49 | public String update(Property p) { 50 | propertyService.update(p); 51 | return "redirect:admin_property_list?cid="+p.getCid(); 52 | } 53 | 54 | @RequestMapping("admin_property_list") 55 | public String list(int cid, Model model, Page page) { 56 | Category c = categoryService.get(cid); 57 | 58 | PageHelper.offsetPage(page.getStart(),page.getCount()); 59 | List ps = propertyService.list(cid); 60 | 61 | int total = (int) new PageInfo<>(ps).getTotal(); 62 | page.setTotal(total); 63 | page.setParam("&cid="+c.getId()); 64 | 65 | model.addAttribute("ps", ps); 66 | model.addAttribute("c", c); 67 | model.addAttribute("page", page); 68 | 69 | return "admin/listProperty"; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/controller/PropertyValueController.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.controller; 2 | 3 | import com.how2java.tmall.pojo.Product; 4 | import com.how2java.tmall.pojo.PropertyValue; 5 | import com.how2java.tmall.service.ProductService; 6 | import com.how2java.tmall.service.PropertyValueService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Controller; 9 | import org.springframework.ui.Model; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.ResponseBody; 12 | 13 | import java.util.List; 14 | 15 | @Controller 16 | @RequestMapping("") 17 | public class PropertyValueController { 18 | @Autowired 19 | PropertyValueService propertyValueService; 20 | @Autowired 21 | ProductService productService; 22 | 23 | @RequestMapping("admin_propertyValue_edit") 24 | public String edit(Model model,int pid) { 25 | Product p = productService.get(pid); 26 | propertyValueService.init(p); 27 | List pvs = propertyValueService.list(p.getId()); 28 | 29 | model.addAttribute("p", p); 30 | model.addAttribute("pvs", pvs); 31 | return "admin/editPropertyValue"; 32 | } 33 | @RequestMapping("admin_propertyValue_update") 34 | @ResponseBody 35 | public String update(PropertyValue pv) { 36 | propertyValueService.update(pv); 37 | return "success"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/controller/UserController.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.controller; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Controller; 7 | import org.springframework.ui.Model; 8 | import org.springframework.web.bind.annotation.RequestMapping; 9 | 10 | import com.github.pagehelper.PageHelper; 11 | import com.github.pagehelper.PageInfo; 12 | import com.how2java.tmall.pojo.User; 13 | import com.how2java.tmall.service.UserService; 14 | import com.how2java.tmall.util.Page; 15 | 16 | 17 | @Controller 18 | @RequestMapping("") 19 | public class UserController { 20 | @Autowired 21 | UserService userService; 22 | 23 | @RequestMapping("admin_user_list") 24 | public String list(Model model, Page page){ 25 | PageHelper.offsetPage(page.getStart(),page.getCount()); 26 | 27 | List us= userService.list(); 28 | 29 | int total = (int) new PageInfo<>(us).getTotal(); 30 | page.setTotal(total); 31 | 32 | model.addAttribute("us", us); 33 | model.addAttribute("page", page); 34 | 35 | return "admin/listUser"; 36 | } 37 | 38 | 39 | 40 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/interceptor/LoginInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.interceptor; 2 | import com.how2java.tmall.pojo.User; 3 | import com.how2java.tmall.service.CategoryService; 4 | import com.how2java.tmall.service.OrderItemService; 5 | import org.apache.commons.lang.StringUtils; 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.web.servlet.ModelAndView; 8 | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; 9 | 10 | import javax.servlet.http.HttpServletRequest; 11 | import javax.servlet.http.HttpServletResponse; 12 | import javax.servlet.http.HttpSession; 13 | import java.util.Arrays; 14 | 15 | public class LoginInterceptor extends HandlerInterceptorAdapter { 16 | @Autowired 17 | CategoryService categoryService; 18 | @Autowired 19 | OrderItemService orderItemService; 20 | /** 21 | * 在业务处理器处理请求之前被调用 22 | * 如果返回false 23 | * 从当前的拦截器往回执行所有拦截器的afterCompletion(),再退出拦截器链 24 | * 如果返回true 25 | * 执行下一个拦截器,直到所有的拦截器都执行完毕 26 | * 再执行被拦截的Controller 27 | * 然后进入拦截器链, 28 | * 从最后一个拦截器往回执行所有的postHandle() 29 | * 接着再从最后一个拦截器往回执行所有的afterCompletion() 30 | */ 31 | public boolean preHandle(HttpServletRequest request, 32 | HttpServletResponse response, Object handler) throws Exception { 33 | 34 | HttpSession session = request.getSession(); 35 | String contextPath=session.getServletContext().getContextPath(); 36 | String[] noNeedAuthPage = new String[]{ 37 | "home", 38 | "checkLogin", 39 | "register", 40 | "loginAjax", 41 | "login", 42 | "product", 43 | "category", 44 | "search"}; 45 | 46 | String uri = request.getRequestURI(); 47 | uri = StringUtils.remove(uri, contextPath); 48 | // System.out.println(uri); 49 | if(uri.startsWith("/fore")){ 50 | String method = StringUtils.substringAfterLast(uri,"/fore" ); 51 | if(!Arrays.asList(noNeedAuthPage).contains(method)){ 52 | User user =(User) session.getAttribute("user"); 53 | if(null==user){ 54 | response.sendRedirect("loginPage"); 55 | return false; 56 | } 57 | } 58 | } 59 | 60 | return true; 61 | 62 | } 63 | 64 | /** 65 | * 在业务处理器处理请求执行完成后,生成视图之前执行的动作 66 | * 可在modelAndView中加入数据,比如当前时间 67 | */ 68 | 69 | public void postHandle(HttpServletRequest request, 70 | HttpServletResponse response, Object handler, 71 | ModelAndView modelAndView) throws Exception { 72 | 73 | 74 | } 75 | 76 | /** 77 | * 在DispatcherServlet完全处理完请求后被调用,可用于清理资源等 78 | * 79 | * 当有拦截器抛出异常时,会从当前拦截器往回执行所有的拦截器的afterCompletion() 80 | */ 81 | 82 | public void afterCompletion(HttpServletRequest request, 83 | HttpServletResponse response, Object handler, Exception ex) 84 | throws Exception { 85 | 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/interceptor/OtherInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.interceptor; 2 | import java.util.Arrays; 3 | import java.util.List; 4 | 5 | import javax.servlet.http.HttpServletRequest; 6 | import javax.servlet.http.HttpServletResponse; 7 | import javax.servlet.http.HttpSession; 8 | 9 | import org.apache.commons.lang.StringUtils; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.web.servlet.ModelAndView; 12 | import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; 13 | 14 | import com.how2java.tmall.pojo.Category; 15 | import com.how2java.tmall.pojo.OrderItem; 16 | import com.how2java.tmall.pojo.User; 17 | import com.how2java.tmall.service.CategoryService; 18 | import com.how2java.tmall.service.OrderItemService; 19 | 20 | public class OtherInterceptor extends HandlerInterceptorAdapter { 21 | @Autowired 22 | CategoryService categoryService; 23 | @Autowired 24 | OrderItemService orderItemService; 25 | /** 26 | * 在业务处理器处理请求之前被调用 27 | * 如果返回false 28 | * 从当前的拦截器往回执行所有拦截器的afterCompletion(),再退出拦截器链 29 | * 如果返回true 30 | * 执行下一个拦截器,直到所有的拦截器都执行完毕 31 | * 再执行被拦截的Controller 32 | * 然后进入拦截器链, 33 | * 从最后一个拦截器往回执行所有的postHandle() 34 | * 接着再从最后一个拦截器往回执行所有的afterCompletion() 35 | */ 36 | public boolean preHandle(HttpServletRequest request, 37 | HttpServletResponse response, Object handler) throws Exception { 38 | return true; 39 | 40 | } 41 | 42 | /** 43 | * 在业务处理器处理请求执行完成后,生成视图之前执行的动作 44 | * 可在modelAndView中加入数据,比如当前时间 45 | */ 46 | 47 | public void postHandle(HttpServletRequest request, 48 | HttpServletResponse response, Object handler, 49 | ModelAndView modelAndView) throws Exception { 50 | /*这里是获取分类集合信息,用于放在搜索栏下面*/ 51 | List cs = categoryService.list(); 52 | request.getSession().setAttribute("cs", cs); 53 | 54 | /*这里是获取当前的contextPath:tmall_ssm,用与放在左上角那个变形金刚,点击之后才能够跳转到首页,否则点击之后也仅仅停留在当前页面*/ 55 | HttpSession session = request.getSession(); 56 | String contextPath=session.getServletContext().getContextPath(); 57 | request.getSession().setAttribute("contextPath", contextPath); 58 | 59 | /*这里是获取购物车中一共有多少数量*/ 60 | User user =(User) session.getAttribute("user"); 61 | int cartTotalItemNumber = 0; 62 | if(null!=user) { 63 | List ois = orderItemService.listByUser(user.getId()); 64 | for (OrderItem oi : ois) { 65 | cartTotalItemNumber+=oi.getNumber(); 66 | } 67 | 68 | } 69 | request.getSession().setAttribute("cartTotalItemNumber", cartTotalItemNumber); 70 | 71 | } 72 | 73 | /** 74 | * 在DispatcherServlet完全处理完请求后被调用,可用于清理资源等 75 | * 76 | * 当有拦截器抛出异常时,会从当前拦截器往回执行所有的拦截器的afterCompletion() 77 | */ 78 | 79 | public void afterCompletion(HttpServletRequest request, 80 | HttpServletResponse response, Object handler, Exception ex) 81 | throws Exception { 82 | 83 | // System.out.println("afterCompletion(), 在访问视图之后被调用"); 84 | } 85 | 86 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/CategoryMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.Category; 4 | import com.how2java.tmall.pojo.CategoryExample; 5 | import java.util.List; 6 | 7 | public interface CategoryMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(Category record); 11 | 12 | int insertSelective(Category record); 13 | 14 | List selectByExample(CategoryExample example); 15 | 16 | Category selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(Category record); 19 | 20 | int updateByPrimaryKey(Category record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/OrderItemMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.OrderItem; 4 | import com.how2java.tmall.pojo.OrderItemExample; 5 | import java.util.List; 6 | 7 | public interface OrderItemMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(OrderItem record); 11 | 12 | int insertSelective(OrderItem record); 13 | 14 | List selectByExample(OrderItemExample example); 15 | 16 | OrderItem selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(OrderItem record); 19 | 20 | int updateByPrimaryKey(OrderItem record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/OrderMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.Order; 4 | import com.how2java.tmall.pojo.OrderExample; 5 | import java.util.List; 6 | 7 | public interface OrderMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(Order record); 11 | 12 | int insertSelective(Order record); 13 | 14 | List selectByExample(OrderExample example); 15 | 16 | Order selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(Order record); 19 | 20 | int updateByPrimaryKey(Order record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/ProductImageMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.ProductImage; 4 | import com.how2java.tmall.pojo.ProductImageExample; 5 | import java.util.List; 6 | 7 | public interface ProductImageMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(ProductImage record); 11 | 12 | int insertSelective(ProductImage record); 13 | 14 | List selectByExample(ProductImageExample example); 15 | 16 | ProductImage selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(ProductImage record); 19 | 20 | int updateByPrimaryKey(ProductImage record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/ProductMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.Product; 4 | import com.how2java.tmall.pojo.ProductExample; 5 | import java.util.List; 6 | 7 | public interface ProductMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(Product record); 11 | 12 | int insertSelective(Product record); 13 | 14 | List selectByExample(ProductExample example); 15 | 16 | Product selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(Product record); 19 | 20 | int updateByPrimaryKey(Product record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/PropertyMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.Property; 4 | import com.how2java.tmall.pojo.PropertyExample; 5 | import java.util.List; 6 | 7 | public interface PropertyMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(Property record); 11 | 12 | int insertSelective(Property record); 13 | 14 | List selectByExample(PropertyExample example); 15 | 16 | Property selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(Property record); 19 | 20 | int updateByPrimaryKey(Property record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/PropertyValueMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.PropertyValue; 4 | import com.how2java.tmall.pojo.PropertyValueExample; 5 | import java.util.List; 6 | 7 | public interface PropertyValueMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(PropertyValue record); 11 | 12 | int insertSelective(PropertyValue record); 13 | 14 | List selectByExample(PropertyValueExample example); 15 | 16 | PropertyValue selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(PropertyValue record); 19 | 20 | int updateByPrimaryKey(PropertyValue record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/ReviewMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.Review; 4 | import com.how2java.tmall.pojo.ReviewExample; 5 | import java.util.List; 6 | 7 | public interface ReviewMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(Review record); 11 | 12 | int insertSelective(Review record); 13 | 14 | List selectByExample(ReviewExample example); 15 | 16 | Review selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(Review record); 19 | 20 | int updateByPrimaryKey(Review record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/mapper/UserMapper.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.mapper; 2 | 3 | import com.how2java.tmall.pojo.User; 4 | import com.how2java.tmall.pojo.UserExample; 5 | import java.util.List; 6 | 7 | public interface UserMapper { 8 | int deleteByPrimaryKey(Integer id); 9 | 10 | int insert(User record); 11 | 12 | int insertSelective(User record); 13 | 14 | List selectByExample(UserExample example); 15 | 16 | User selectByPrimaryKey(Integer id); 17 | 18 | int updateByPrimaryKeySelective(User record); 19 | 20 | int updateByPrimaryKey(User record); 21 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/Category.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | import java.util.List; 4 | 5 | public class Category { 6 | private Integer id; 7 | 8 | private String name; 9 | 10 | /*如下是非数据库字段*/ 11 | private List products; 12 | 13 | private List> productsByRow; 14 | 15 | public Integer getId() { 16 | return id; 17 | } 18 | 19 | public void setId(Integer id) { 20 | this.id = id; 21 | } 22 | 23 | public String getName() { 24 | return name; 25 | } 26 | 27 | public void setName(String name) { 28 | this.name = name == null ? null : name.trim(); 29 | } 30 | 31 | public List getProducts() { 32 | return products; 33 | } 34 | 35 | public void setProducts(List products) { 36 | this.products = products; 37 | } 38 | 39 | public List> getProductsByRow() { 40 | return productsByRow; 41 | } 42 | 43 | public void setProductsByRow(List> productsByRow) { 44 | this.productsByRow = productsByRow; 45 | } 46 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/Order.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | import com.how2java.tmall.service.OrderService; 4 | 5 | import java.util.Date; 6 | import java.util.List; 7 | 8 | 9 | public class Order { 10 | private Integer id; 11 | 12 | private String orderCode; 13 | 14 | private String address; 15 | 16 | private String post; 17 | 18 | private String receiver; 19 | 20 | private String mobile; 21 | 22 | private String userMessage; 23 | 24 | private Date createDate; 25 | 26 | private Date payDate; 27 | 28 | private Date deliveryDate; 29 | 30 | private Date confirmDate; 31 | 32 | private Integer uid; 33 | 34 | private String status; 35 | 36 | 37 | /*如下是非数据库字段*/ 38 | private List orderItems; 39 | 40 | private User user; 41 | 42 | private float total; 43 | 44 | private int totalNumber; 45 | 46 | public Integer getId() { 47 | return id; 48 | } 49 | 50 | public void setId(Integer id) { 51 | this.id = id; 52 | } 53 | 54 | public String getOrderCode() { 55 | return orderCode; 56 | } 57 | 58 | public void setOrderCode(String orderCode) { 59 | this.orderCode = orderCode; 60 | } 61 | 62 | public String getAddress() { 63 | return address; 64 | } 65 | 66 | public void setAddress(String address) { 67 | this.address = address; 68 | } 69 | 70 | public String getPost() { 71 | return post; 72 | } 73 | 74 | public void setPost(String post) { 75 | this.post = post; 76 | } 77 | 78 | public String getReceiver() { 79 | return receiver; 80 | } 81 | 82 | public void setReceiver(String receiver) { 83 | this.receiver = receiver; 84 | } 85 | 86 | public String getMobile() { 87 | return mobile; 88 | } 89 | 90 | public void setMobile(String mobile) { 91 | this.mobile = mobile; 92 | } 93 | 94 | public String getUserMessage() { 95 | return userMessage; 96 | } 97 | 98 | public void setUserMessage(String userMessage) { 99 | this.userMessage = userMessage; 100 | } 101 | 102 | public Date getCreateDate() { 103 | return createDate; 104 | } 105 | 106 | public void setCreateDate(Date createDate) { 107 | this.createDate = createDate; 108 | } 109 | 110 | public Date getPayDate() { 111 | return payDate; 112 | } 113 | 114 | public void setPayDate(Date payDate) { 115 | this.payDate = payDate; 116 | } 117 | 118 | public Date getDeliveryDate() { 119 | return deliveryDate; 120 | } 121 | 122 | public void setDeliveryDate(Date deliveryDate) { 123 | this.deliveryDate = deliveryDate; 124 | } 125 | 126 | public Date getConfirmDate() { 127 | return confirmDate; 128 | } 129 | 130 | public void setConfirmDate(Date confirmDate) { 131 | this.confirmDate = confirmDate; 132 | } 133 | 134 | public Integer getUid() { 135 | return uid; 136 | } 137 | 138 | public void setUid(Integer uid) { 139 | this.uid = uid; 140 | } 141 | 142 | public String getStatus() { 143 | return status; 144 | } 145 | 146 | public void setStatus(String status) { 147 | this.status = status; 148 | } 149 | 150 | public List getOrderItems() { 151 | return orderItems; 152 | } 153 | 154 | public void setOrderItems(List orderItems) { 155 | this.orderItems = orderItems; 156 | } 157 | 158 | public User getUser() { 159 | return user; 160 | } 161 | 162 | public void setUser(User user) { 163 | this.user = user; 164 | } 165 | 166 | public float getTotal() { 167 | return total; 168 | } 169 | 170 | public void setTotal(float total) { 171 | this.total = total; 172 | } 173 | 174 | public int getTotalNumber() { 175 | return totalNumber; 176 | } 177 | 178 | public void setTotalNumber(int totalNumber) { 179 | this.totalNumber = totalNumber; 180 | } 181 | 182 | public static void main(String args[]){ 183 | Order o = new Order(); 184 | o.setStatus(OrderService.delete); 185 | System.out.println(o.getStatusDesc()); 186 | } 187 | public String getStatusDesc(){ 188 | String desc ="未知"; 189 | switch(status){ 190 | case OrderService.waitPay: 191 | desc="待付款"; 192 | break; 193 | case OrderService.waitDelivery: 194 | desc="待发货"; 195 | break; 196 | case OrderService.waitConfirm: 197 | desc="待收货"; 198 | break; 199 | case OrderService.waitReview: 200 | desc="等评价"; 201 | break; 202 | case OrderService.finish: 203 | desc="完成"; 204 | break; 205 | case OrderService.delete: 206 | desc="刪除"; 207 | break; 208 | default: 209 | desc="未知"; 210 | } 211 | return desc; 212 | } 213 | 214 | 215 | 216 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/OrderItem.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | public class OrderItem { 4 | private Integer id; 5 | 6 | private Integer pid; 7 | 8 | private Integer oid; 9 | 10 | private Integer uid; 11 | 12 | private Integer number; 13 | 14 | /*非数据库字段*/ 15 | private Product product; 16 | 17 | public Integer getId() { 18 | return id; 19 | } 20 | 21 | public void setId(Integer id) { 22 | this.id = id; 23 | } 24 | 25 | public Integer getPid() { 26 | return pid; 27 | } 28 | 29 | public void setPid(Integer pid) { 30 | this.pid = pid; 31 | } 32 | 33 | public Integer getOid() { 34 | return oid; 35 | } 36 | 37 | public void setOid(Integer oid) { 38 | this.oid = oid; 39 | } 40 | 41 | public Integer getUid() { 42 | return uid; 43 | } 44 | 45 | public void setUid(Integer uid) { 46 | this.uid = uid; 47 | } 48 | 49 | public Integer getNumber() { 50 | return number; 51 | } 52 | 53 | public void setNumber(Integer number) { 54 | this.number = number; 55 | } 56 | 57 | public Product getProduct() { 58 | return product; 59 | } 60 | 61 | public void setProduct(Product product) { 62 | this.product = product; 63 | } 64 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/Product.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | import java.util.Date; 4 | import java.util.List; 5 | 6 | public class Product { 7 | private Integer id; 8 | 9 | private String name; 10 | 11 | private String subTitle; 12 | 13 | private Float originalPrice; 14 | 15 | private Float promotePrice; 16 | 17 | private Integer stock; 18 | 19 | private Integer cid; 20 | 21 | private Date createDate; 22 | 23 | 24 | /*非数据库字段*/ 25 | private Category category; 26 | 27 | private ProductImage firstProductImage; 28 | 29 | private List productSingleImages; 30 | 31 | private List productDetailImages; 32 | 33 | private int saleCount; 34 | 35 | private int reviewCount; 36 | 37 | 38 | public Category getCategory() { 39 | return category; 40 | } 41 | 42 | public void setCategory(Category category) { 43 | this.category = category; 44 | } 45 | 46 | public Integer getId() { 47 | return id; 48 | } 49 | 50 | public void setId(Integer id) { 51 | this.id = id; 52 | } 53 | 54 | public String getName() { 55 | return name; 56 | } 57 | 58 | public void setName(String name) { 59 | this.name = name == null ? null : name.trim(); 60 | } 61 | 62 | public String getSubTitle() { 63 | return subTitle; 64 | } 65 | 66 | public void setSubTitle(String subTitle) { 67 | this.subTitle = subTitle == null ? null : subTitle.trim(); 68 | } 69 | 70 | public Float getOriginalPrice() { 71 | return originalPrice; 72 | } 73 | 74 | public void setOriginalPrice(Float originalPrice) { 75 | this.originalPrice = originalPrice; 76 | } 77 | 78 | public Float getPromotePrice() { 79 | return promotePrice; 80 | } 81 | 82 | public void setPromotePrice(Float promotePrice) { 83 | this.promotePrice = promotePrice; 84 | } 85 | 86 | public Integer getStock() { 87 | return stock; 88 | } 89 | 90 | public void setStock(Integer stock) { 91 | this.stock = stock; 92 | } 93 | 94 | public Integer getCid() { 95 | return cid; 96 | } 97 | 98 | public void setCid(Integer cid) { 99 | this.cid = cid; 100 | } 101 | 102 | public Date getCreateDate() { 103 | return createDate; 104 | } 105 | 106 | public void setCreateDate(Date createDate) { 107 | this.createDate = createDate; 108 | } 109 | 110 | public ProductImage getFirstProductImage() { 111 | return firstProductImage; 112 | } 113 | 114 | 115 | public void setFirstProductImage(ProductImage firstProductImage) { 116 | this.firstProductImage = firstProductImage; 117 | } 118 | 119 | public List getProductSingleImages() { 120 | return productSingleImages; 121 | } 122 | 123 | public void setProductSingleImages(List productSingleImages) { 124 | this.productSingleImages = productSingleImages; 125 | } 126 | 127 | public List getProductDetailImages() { 128 | return productDetailImages; 129 | } 130 | 131 | public void setProductDetailImages(List productDetailImages) { 132 | this.productDetailImages = productDetailImages; 133 | } 134 | 135 | public int getSaleCount() { 136 | return saleCount; 137 | } 138 | 139 | public void setSaleCount(int saleCount) { 140 | this.saleCount = saleCount; 141 | } 142 | 143 | public int getReviewCount() { 144 | return reviewCount; 145 | } 146 | 147 | public void setReviewCount(int reviewCount) { 148 | this.reviewCount = reviewCount; 149 | } 150 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/ProductImage.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | public class ProductImage { 4 | private Integer id; 5 | 6 | private Integer pid; 7 | 8 | private String type; 9 | 10 | public Integer getId() { 11 | return id; 12 | } 13 | 14 | public void setId(Integer id) { 15 | this.id = id; 16 | } 17 | 18 | public Integer getPid() { 19 | return pid; 20 | } 21 | 22 | public void setPid(Integer pid) { 23 | this.pid = pid; 24 | } 25 | 26 | public String getType() { 27 | return type; 28 | } 29 | 30 | public void setType(String type) { 31 | this.type = type == null ? null : type.trim(); 32 | } 33 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/Property.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | public class Property { 4 | private Integer id; 5 | 6 | private Integer cid; 7 | 8 | private String name; 9 | 10 | /*非数据库字段*/ 11 | private Category category; 12 | 13 | public Category getCategory() { 14 | return category; 15 | } 16 | 17 | public void setCategory(Category category) { 18 | this.category = category; 19 | } 20 | public Integer getId() { 21 | return id; 22 | } 23 | 24 | public void setId(Integer id) { 25 | this.id = id; 26 | } 27 | 28 | public Integer getCid() { 29 | return cid; 30 | } 31 | 32 | public void setCid(Integer cid) { 33 | this.cid = cid; 34 | } 35 | 36 | public String getName() { 37 | return name; 38 | } 39 | 40 | public void setName(String name) { 41 | this.name = name == null ? null : name.trim(); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/PropertyValue.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | public class PropertyValue { 4 | private Integer id; 5 | 6 | private Integer pid; 7 | 8 | private Integer ptid; 9 | 10 | private String value; 11 | 12 | /*非数据库字段*/ 13 | private Property property; 14 | 15 | public Property getProperty() { 16 | return property; 17 | } 18 | 19 | public void setProperty(Property property) { 20 | this.property = property; 21 | } 22 | 23 | public Integer getId() { 24 | return id; 25 | } 26 | 27 | public void setId(Integer id) { 28 | this.id = id; 29 | } 30 | 31 | public Integer getPid() { 32 | return pid; 33 | } 34 | 35 | public void setPid(Integer pid) { 36 | this.pid = pid; 37 | } 38 | 39 | public Integer getPtid() { 40 | return ptid; 41 | } 42 | 43 | public void setPtid(Integer ptid) { 44 | this.ptid = ptid; 45 | } 46 | 47 | public String getValue() { 48 | return value; 49 | } 50 | 51 | public void setValue(String value) { 52 | this.value = value == null ? null : value.trim(); 53 | } 54 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/Review.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | import java.util.Date; 4 | 5 | public class Review { 6 | private Integer id; 7 | 8 | private String content; 9 | 10 | private Integer uid; 11 | 12 | private Integer pid; 13 | 14 | private Date createDate; 15 | /*非数据库字段*/ 16 | private User user; 17 | 18 | public Integer getId() { 19 | return id; 20 | } 21 | 22 | public void setId(Integer id) { 23 | this.id = id; 24 | } 25 | 26 | public String getContent() { 27 | return content; 28 | } 29 | 30 | public void setContent(String content) { 31 | this.content = content == null ? null : content.trim(); 32 | } 33 | 34 | public Integer getUid() { 35 | return uid; 36 | } 37 | 38 | public void setUid(Integer uid) { 39 | this.uid = uid; 40 | } 41 | 42 | public Integer getPid() { 43 | return pid; 44 | } 45 | 46 | public void setPid(Integer pid) { 47 | this.pid = pid; 48 | } 49 | 50 | public Date getCreateDate() { 51 | return createDate; 52 | } 53 | 54 | public void setCreateDate(Date createDate) { 55 | this.createDate = createDate; 56 | } 57 | 58 | public User getUser() { 59 | return user; 60 | } 61 | 62 | public void setUser(User user) { 63 | this.user = user; 64 | } 65 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/pojo/User.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.pojo; 2 | 3 | public class User { 4 | private Integer id; 5 | 6 | private String name; 7 | 8 | private String password; 9 | 10 | public Integer getId() { 11 | return id; 12 | } 13 | 14 | public void setId(Integer id) { 15 | this.id = id; 16 | } 17 | 18 | public String getName() { 19 | return name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name == null ? null : name.trim(); 24 | } 25 | 26 | public String getPassword() { 27 | return password; 28 | } 29 | 30 | public void setPassword(String password) { 31 | this.password = password == null ? null : password.trim(); 32 | } 33 | 34 | public String getAnonymousName(){ 35 | if(null==name) 36 | return null; 37 | 38 | if(name.length()<=1) 39 | return "*"; 40 | 41 | if(name.length()==2) 42 | return name.substring(0,1) +"*"; 43 | 44 | char[] cs =name.toCharArray(); 45 | for (int i = 1; i < cs.length-1; i++) { 46 | cs[i]='*'; 47 | } 48 | return new String(cs); 49 | 50 | 51 | } 52 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/CategoryService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import com.how2java.tmall.pojo.Category; 4 | import java.util.List; 5 | 6 | public interface CategoryService{ 7 | List list(); 8 | 9 | void add(Category category); 10 | 11 | void delete(int id); 12 | 13 | Category get(int id); 14 | 15 | void update(Category category); 16 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/OrderItemService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import java.util.List; 4 | 5 | import com.how2java.tmall.pojo.Order; 6 | import com.how2java.tmall.pojo.OrderItem; 7 | 8 | public interface OrderItemService { 9 | 10 | 11 | void add(OrderItem c); 12 | 13 | void delete(int id); 14 | void update(OrderItem c); 15 | OrderItem get(int id); 16 | List list(); 17 | 18 | void fill(List os); 19 | 20 | void fill(Order o); 21 | 22 | int getSaleCount(int pid); 23 | 24 | List listByUser(int uid); 25 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/OrderService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import com.how2java.tmall.pojo.Order; 4 | import com.how2java.tmall.pojo.OrderItem; 5 | 6 | import java.util.List; 7 | 8 | public interface OrderService { 9 | 10 | String waitPay = "waitPay"; 11 | String waitDelivery = "waitDelivery"; 12 | String waitConfirm = "waitConfirm"; 13 | String waitReview = "waitReview"; 14 | String finish = "finish"; 15 | String delete = "delete"; 16 | 17 | void add(Order c); 18 | 19 | float add(Order c, List ois); 20 | void delete(int id); 21 | void update(Order c); 22 | Order get(int id); 23 | List list(); 24 | List list(int uid,String excludedStatus); 25 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/ProductImageService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import java.util.List; 4 | 5 | import com.how2java.tmall.pojo.ProductImage; 6 | 7 | public interface ProductImageService { 8 | 9 | String type_single = "type_single"; 10 | String type_detail = "type_detail"; 11 | 12 | void add(ProductImage pi); 13 | void delete(int id); 14 | void update(ProductImage pi); 15 | ProductImage get(int id); 16 | List list(int pid, String type); 17 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/ProductService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import java.util.List; 4 | 5 | import com.how2java.tmall.pojo.Category; 6 | import com.how2java.tmall.pojo.Product; 7 | 8 | public interface ProductService { 9 | void add(Product p); 10 | void delete(int id); 11 | void update(Product p); 12 | Product get(int id); 13 | List list(int cid); 14 | void setFirstProductImage(Product p); 15 | 16 | void fill(List cs); 17 | 18 | void fill(Category c); 19 | 20 | void fillByRow(List cs); 21 | 22 | void setSaleAndReviewNumber(Product p); 23 | 24 | void setSaleAndReviewNumber(List ps); 25 | 26 | List search(String keyword); 27 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/PropertyService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import com.how2java.tmall.pojo.Property; 4 | 5 | import java.util.List; 6 | 7 | public interface PropertyService { 8 | void add(Property c); 9 | void delete(int id); 10 | void update(Property c); 11 | Property get(int id); 12 | List list(int cid); 13 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/PropertyValueService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import com.how2java.tmall.pojo.Product; 4 | import com.how2java.tmall.pojo.PropertyValue; 5 | 6 | import java.util.List; 7 | 8 | public interface PropertyValueService { 9 | void init(Product p); 10 | void update(PropertyValue pv); 11 | 12 | PropertyValue get(int ptid, int pid); 13 | List list(int pid); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/ReviewService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import java.util.List; 4 | 5 | import com.how2java.tmall.pojo.Review; 6 | 7 | public interface ReviewService { 8 | 9 | 10 | void add(Review c); 11 | 12 | void delete(int id); 13 | void update(Review c); 14 | Review get(int id); 15 | List list(int pid); 16 | 17 | int getCount(int pid); 18 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/UserService.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service; 2 | 3 | import java.util.List; 4 | 5 | import com.how2java.tmall.pojo.User; 6 | 7 | public interface UserService { 8 | void add(User c); 9 | void delete(int id); 10 | void update(User c); 11 | User get(int id); 12 | List list(); 13 | boolean isExist(String name); 14 | 15 | User get(String name, String password); 16 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/CategoryServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import com.how2java.tmall.mapper.CategoryMapper; 4 | import com.how2java.tmall.pojo.Category; 5 | import com.how2java.tmall.pojo.CategoryExample; 6 | import com.how2java.tmall.service.CategoryService; 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.stereotype.Service; 9 | 10 | import java.util.List; 11 | 12 | @Service 13 | public class CategoryServiceImpl implements CategoryService { 14 | @Autowired 15 | CategoryMapper categoryMapper; 16 | 17 | @Override 18 | public List list() { 19 | CategoryExample example =new CategoryExample(); 20 | example.setOrderByClause("id desc"); 21 | return categoryMapper.selectByExample(example); 22 | } 23 | 24 | @Override 25 | public void add(Category category) { 26 | categoryMapper.insert(category); 27 | } 28 | 29 | @Override 30 | public void delete(int id) { 31 | categoryMapper.deleteByPrimaryKey(id); 32 | } 33 | 34 | @Override 35 | public Category get(int id) { 36 | return categoryMapper.selectByPrimaryKey(id); 37 | } 38 | 39 | @Override 40 | public void update(Category category) { 41 | categoryMapper.updateByPrimaryKeySelective(category); 42 | } 43 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/OrderItemServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.how2java.tmall.mapper.OrderItemMapper; 9 | import com.how2java.tmall.pojo.Order; 10 | import com.how2java.tmall.pojo.OrderItem; 11 | import com.how2java.tmall.pojo.OrderItemExample; 12 | import com.how2java.tmall.pojo.Product; 13 | import com.how2java.tmall.service.OrderItemService; 14 | import com.how2java.tmall.service.ProductService; 15 | 16 | 17 | @Service 18 | public class OrderItemServiceImpl implements OrderItemService { 19 | @Autowired 20 | OrderItemMapper orderItemMapper; 21 | @Autowired 22 | ProductService productService; 23 | 24 | @Override 25 | public void add(OrderItem c) { 26 | orderItemMapper.insert(c); 27 | } 28 | 29 | @Override 30 | public void delete(int id) { 31 | orderItemMapper.deleteByPrimaryKey(id); 32 | } 33 | 34 | @Override 35 | public void update(OrderItem c) { 36 | orderItemMapper.updateByPrimaryKeySelective(c); 37 | } 38 | 39 | @Override 40 | public OrderItem get(int id) { 41 | OrderItem result = orderItemMapper.selectByPrimaryKey(id); 42 | setProduct(result); 43 | return result; 44 | } 45 | 46 | public List list(){ 47 | OrderItemExample example =new OrderItemExample(); 48 | example.setOrderByClause("id desc"); 49 | return orderItemMapper.selectByExample(example); 50 | 51 | } 52 | 53 | @Override 54 | public void fill(List os) { 55 | for (Order o : os) { 56 | fill(o); 57 | } 58 | } 59 | 60 | @Override 61 | public int getSaleCount(int pid) { 62 | OrderItemExample example =new OrderItemExample(); 63 | example.createCriteria().andPidEqualTo(pid); 64 | List ois =orderItemMapper.selectByExample(example); 65 | int result =0; 66 | for (OrderItem oi : ois) { 67 | result+=oi.getNumber(); 68 | } 69 | return result; 70 | } 71 | 72 | @Override 73 | public List listByUser(int uid) { 74 | OrderItemExample example =new OrderItemExample(); 75 | example.createCriteria().andUidEqualTo(uid).andOidIsNull(); 76 | List result =orderItemMapper.selectByExample(example); 77 | setProduct(result); 78 | return result; 79 | } 80 | 81 | public void fill(Order o) { 82 | OrderItemExample example =new OrderItemExample(); 83 | example.createCriteria().andOidEqualTo(o.getId()); 84 | example.setOrderByClause("id desc"); 85 | List ois =orderItemMapper.selectByExample(example); 86 | setProduct(ois); 87 | 88 | float total = 0; 89 | int totalNumber = 0; 90 | for (OrderItem oi : ois) { 91 | total+=oi.getNumber()*oi.getProduct().getPromotePrice(); 92 | totalNumber+=oi.getNumber(); 93 | } 94 | o.setTotal(total); 95 | o.setTotalNumber(totalNumber); 96 | o.setOrderItems(ois); 97 | 98 | 99 | } 100 | 101 | public void setProduct(List ois){ 102 | for (OrderItem oi: ois) { 103 | setProduct(oi); 104 | } 105 | } 106 | 107 | private void setProduct(OrderItem oi) { 108 | Product p = productService.get(oi.getPid()); 109 | oi.setProduct(p); 110 | } 111 | 112 | 113 | ; 114 | 115 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/OrderServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import com.how2java.tmall.mapper.OrderMapper; 4 | import com.how2java.tmall.pojo.Order; 5 | import com.how2java.tmall.pojo.OrderExample; 6 | import com.how2java.tmall.pojo.OrderItem; 7 | import com.how2java.tmall.service.OrderItemService; 8 | import com.how2java.tmall.service.OrderService; 9 | import com.how2java.tmall.service.UserService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Propagation; 13 | import org.springframework.transaction.annotation.Transactional; 14 | 15 | import java.util.List; 16 | 17 | 18 | @Service 19 | public class OrderServiceImpl implements OrderService { 20 | @Autowired 21 | OrderMapper orderMapper; 22 | 23 | @Autowired 24 | UserService userService; 25 | @Autowired 26 | OrderItemService orderItemService; 27 | 28 | 29 | 30 | @Override 31 | public void add(Order c) { 32 | orderMapper.insert(c); 33 | } 34 | 35 | @Override 36 | @Transactional(propagation= Propagation.REQUIRED,rollbackForClassName="Exception") 37 | 38 | public float add(Order o, List ois) { 39 | float total = 0; 40 | add(o); 41 | 42 | if(false) 43 | throw new RuntimeException(); 44 | 45 | for (OrderItem oi: ois) { 46 | oi.setOid(o.getId()); 47 | orderItemService.update(oi); 48 | total+=oi.getProduct().getPromotePrice()*oi.getNumber(); 49 | } 50 | return total; 51 | } 52 | 53 | @Override 54 | public void delete(int id) { 55 | orderMapper.deleteByPrimaryKey(id); 56 | } 57 | 58 | @Override 59 | public void update(Order c) { 60 | orderMapper.updateByPrimaryKeySelective(c); 61 | } 62 | 63 | @Override 64 | public Order get(int id) { 65 | return orderMapper.selectByPrimaryKey(id); 66 | } 67 | 68 | public List list(){ 69 | OrderExample example =new OrderExample(); 70 | example.setOrderByClause("id desc"); 71 | return orderMapper.selectByExample(example); 72 | 73 | } 74 | 75 | @Override 76 | public List list(int uid, String excludedStatus) { 77 | OrderExample example = new OrderExample(); 78 | example.createCriteria().andUidEqualTo(uid).andStatusEqualTo(excludedStatus); 79 | example.setOrderByClause("id desc"); 80 | return orderMapper.selectByExample(example); 81 | } 82 | 83 | 84 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/ProductImageServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.how2java.tmall.mapper.ProductImageMapper; 9 | import com.how2java.tmall.pojo.ProductImage; 10 | import com.how2java.tmall.pojo.ProductImageExample; 11 | import com.how2java.tmall.service.ProductImageService; 12 | 13 | @Service 14 | public class ProductImageServiceImpl implements ProductImageService { 15 | 16 | @Autowired 17 | ProductImageMapper productImageMapper; 18 | @Override 19 | public void add(ProductImage pi) { 20 | productImageMapper.insert(pi); 21 | } 22 | 23 | @Override 24 | public void delete(int id) { 25 | productImageMapper.deleteByPrimaryKey(id); 26 | } 27 | 28 | @Override 29 | public void update(ProductImage pi) { 30 | productImageMapper.updateByPrimaryKeySelective(pi); 31 | 32 | } 33 | 34 | @Override 35 | public ProductImage get(int id) { 36 | return productImageMapper.selectByPrimaryKey(id); 37 | } 38 | 39 | @Override 40 | public List list(int pid, String type) { 41 | ProductImageExample example =new ProductImageExample(); 42 | example.createCriteria() 43 | .andPidEqualTo(pid) 44 | .andTypeEqualTo(type); 45 | example.setOrderByClause("id desc"); 46 | return productImageMapper.selectByExample(example); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/ProductServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.stereotype.Service; 8 | 9 | import com.how2java.tmall.mapper.ProductMapper; 10 | import com.how2java.tmall.pojo.Category; 11 | import com.how2java.tmall.pojo.Product; 12 | import com.how2java.tmall.pojo.ProductExample; 13 | import com.how2java.tmall.pojo.ProductImage; 14 | import com.how2java.tmall.service.CategoryService; 15 | import com.how2java.tmall.service.OrderItemService; 16 | import com.how2java.tmall.service.ProductImageService; 17 | import com.how2java.tmall.service.ProductService; 18 | import com.how2java.tmall.service.ReviewService; 19 | @Service 20 | public class ProductServiceImpl implements ProductService { 21 | @Autowired 22 | ProductMapper productMapper; 23 | @Autowired 24 | CategoryService categoryService; 25 | @Autowired 26 | ProductImageService productImageService; 27 | @Autowired 28 | OrderItemService orderItemService; 29 | @Autowired 30 | ReviewService reviewService; 31 | 32 | @Override 33 | public void add(Product p) { 34 | productMapper.insert(p); 35 | } 36 | 37 | @Override 38 | public void delete(int id) { 39 | productMapper.deleteByPrimaryKey(id); 40 | } 41 | 42 | @Override 43 | public void update(Product p) { 44 | productMapper.updateByPrimaryKeySelective(p); 45 | } 46 | 47 | @Override 48 | public Product get(int id) { 49 | Product p = productMapper.selectByPrimaryKey(id); 50 | setFirstProductImage(p); 51 | setCategory(p); 52 | return p; 53 | } 54 | 55 | 56 | public void setCategory(List ps){ 57 | for (Product p : ps) 58 | setCategory(p); 59 | } 60 | public void setCategory(Product p){ 61 | int cid = p.getCid(); 62 | Category c = categoryService.get(cid); 63 | p.setCategory(c); 64 | } 65 | 66 | @Override 67 | public List list(int cid) { 68 | ProductExample example = new ProductExample(); 69 | example.createCriteria().andCidEqualTo(cid); 70 | example.setOrderByClause("id desc"); 71 | List result = productMapper.selectByExample(example); 72 | setFirstProductImage(result); 73 | setCategory(result); 74 | return result; 75 | } 76 | 77 | @Override 78 | public void setFirstProductImage(Product p) { 79 | List pis = productImageService.list(p.getId(), ProductImageService.type_single); 80 | if (!pis.isEmpty()) { 81 | ProductImage pi = pis.get(0); 82 | p.setFirstProductImage(pi); 83 | } 84 | } 85 | 86 | @Override 87 | public void fill(List cs) { 88 | for (Category c : cs) { 89 | fill(c); 90 | } 91 | } 92 | 93 | @Override 94 | public void fillByRow(List cs) { 95 | int productNumberEachRow = 8; 96 | for (Category c : cs) { 97 | List products = c.getProducts(); 98 | List> productsByRow = new ArrayList<>(); 99 | for (int i = 0; i < products.size(); i+=productNumberEachRow) { 100 | int size = i+productNumberEachRow; 101 | size= size>products.size()?products.size():size; 102 | List productsOfEachRow =products.subList(i, size); 103 | productsByRow.add(productsOfEachRow); 104 | } 105 | c.setProductsByRow(productsByRow); 106 | } 107 | } 108 | 109 | @Override 110 | public void setSaleAndReviewNumber(Product p) { 111 | int saleCount = orderItemService.getSaleCount(p.getId()); 112 | p.setSaleCount(saleCount); 113 | 114 | int reviewCount = reviewService.getCount(p.getId()); 115 | p.setReviewCount(reviewCount); 116 | } 117 | 118 | @Override 119 | public void setSaleAndReviewNumber(List ps) { 120 | for (Product p : ps) { 121 | setSaleAndReviewNumber(p); 122 | } 123 | } 124 | 125 | @Override 126 | public List search(String keyword) { 127 | ProductExample example = new ProductExample(); 128 | example.createCriteria().andNameLike("%" + keyword + "%"); 129 | example.setOrderByClause("id desc"); 130 | List result = productMapper.selectByExample(example); 131 | setFirstProductImage(result); 132 | setCategory(result); 133 | return result; 134 | } 135 | 136 | @Override 137 | public void fill(Category c) { 138 | List ps = list(c.getId()); 139 | c.setProducts(ps); 140 | } 141 | 142 | public void setFirstProductImage(List ps) { 143 | for (Product p : ps) { 144 | setFirstProductImage(p); 145 | } 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/PropertyServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import com.how2java.tmall.mapper.PropertyMapper; 4 | import com.how2java.tmall.pojo.Category; 5 | import com.how2java.tmall.pojo.Product; 6 | import com.how2java.tmall.pojo.Property; 7 | import com.how2java.tmall.pojo.PropertyExample; 8 | import com.how2java.tmall.service.CategoryService; 9 | import com.how2java.tmall.service.PropertyService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | 16 | @Service 17 | public class PropertyServiceImpl implements PropertyService { 18 | @Autowired 19 | PropertyMapper propertyMapper; 20 | 21 | @Override 22 | public void add(Property p) { 23 | propertyMapper.insert(p); 24 | } 25 | 26 | @Override 27 | public void delete(int id) { 28 | propertyMapper.deleteByPrimaryKey(id); 29 | } 30 | 31 | @Override 32 | public void update(Property p) { 33 | propertyMapper.updateByPrimaryKeySelective(p); 34 | } 35 | 36 | @Override 37 | public Property get(int id) { 38 | return propertyMapper.selectByPrimaryKey(id); 39 | } 40 | 41 | @Override 42 | public List list(int cid) { 43 | PropertyExample example =new PropertyExample(); 44 | example.createCriteria().andCidEqualTo(cid); 45 | example.setOrderByClause("id desc"); 46 | return propertyMapper.selectByExample(example); 47 | } 48 | 49 | 50 | 51 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/PropertyValueServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import com.how2java.tmall.mapper.PropertyValueMapper; 4 | import com.how2java.tmall.pojo.Product; 5 | import com.how2java.tmall.pojo.Property; 6 | import com.how2java.tmall.pojo.PropertyValue; 7 | import com.how2java.tmall.pojo.PropertyValueExample; 8 | import com.how2java.tmall.service.PropertyService; 9 | import com.how2java.tmall.service.PropertyValueService; 10 | import org.springframework.beans.factory.annotation.Autowired; 11 | import org.springframework.stereotype.Service; 12 | 13 | import java.util.List; 14 | 15 | @Service 16 | public class PropertyValueServiceImpl implements PropertyValueService { 17 | 18 | @Autowired 19 | PropertyValueMapper propertyValueMapper; 20 | 21 | 22 | @Autowired 23 | PropertyService propertyService; 24 | 25 | 26 | @Override 27 | public void init(Product p) { 28 | 29 | List pts = propertyService.list(p.getCid()); 30 | 31 | for (Property pt: pts) { 32 | PropertyValue pv = get(pt.getId(),p.getId()); 33 | if(null==pv){ 34 | pv = new PropertyValue(); 35 | pv.setPid(p.getId()); 36 | pv.setPtid(pt.getId()); 37 | propertyValueMapper.insert(pv); 38 | } 39 | } 40 | 41 | } 42 | 43 | @Override 44 | public void update(PropertyValue pv) { 45 | propertyValueMapper.updateByPrimaryKeySelective(pv); 46 | } 47 | 48 | @Override 49 | public PropertyValue get(int ptid, int pid) { 50 | PropertyValueExample example = new PropertyValueExample(); 51 | example.createCriteria().andPtidEqualTo(ptid).andPidEqualTo(pid); 52 | List pvs= propertyValueMapper.selectByExample(example); 53 | if (pvs.isEmpty()) 54 | return null; 55 | return pvs.get(0); 56 | } 57 | 58 | @Override 59 | public List list(int pid) { 60 | PropertyValueExample example = new PropertyValueExample(); 61 | example.createCriteria().andPidEqualTo(pid); 62 | List result = propertyValueMapper.selectByExample(example); 63 | for (PropertyValue pv : result) { 64 | Property property = propertyService.get(pv.getPtid()); 65 | pv.setProperty(property); 66 | } 67 | return result; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/ReviewServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import java.util.List; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.stereotype.Service; 6 | import com.how2java.tmall.mapper.ReviewMapper; 7 | import com.how2java.tmall.pojo.Review; 8 | import com.how2java.tmall.pojo.ReviewExample; 9 | import com.how2java.tmall.pojo.User; 10 | import com.how2java.tmall.service.ReviewService; 11 | import com.how2java.tmall.service.UserService; 12 | 13 | @Service 14 | public class ReviewServiceImpl implements ReviewService { 15 | @Autowired 16 | ReviewMapper reviewMapper; 17 | @Autowired 18 | UserService userService; 19 | 20 | @Override 21 | public void add(Review c) { 22 | reviewMapper.insert(c); 23 | } 24 | 25 | @Override 26 | public void delete(int id) { 27 | reviewMapper.deleteByPrimaryKey(id); 28 | } 29 | 30 | @Override 31 | public void update(Review c) { 32 | reviewMapper.updateByPrimaryKeySelective(c); 33 | } 34 | 35 | @Override 36 | public Review get(int id) { 37 | return reviewMapper.selectByPrimaryKey(id); 38 | } 39 | 40 | public List list(int pid){ 41 | ReviewExample example =new ReviewExample(); 42 | example.createCriteria().andPidEqualTo(pid); 43 | example.setOrderByClause("id desc"); 44 | 45 | List result =reviewMapper.selectByExample(example); 46 | setUser(result); 47 | return result; 48 | } 49 | 50 | public void setUser(List reviews){ 51 | for (Review review : reviews) { 52 | setUser(review); 53 | } 54 | } 55 | 56 | private void setUser(Review review) { 57 | int uid = review.getUid(); 58 | User user =userService.get(uid); 59 | review.setUser(user); 60 | } 61 | 62 | @Override 63 | public int getCount(int pid) { 64 | return list(pid).size(); 65 | } 66 | 67 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/service/impl/UserServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.service.impl; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.how2java.tmall.mapper.UserMapper; 9 | import com.how2java.tmall.pojo.User; 10 | import com.how2java.tmall.pojo.UserExample; 11 | import com.how2java.tmall.service.UserService; 12 | 13 | @Service 14 | public class UserServiceImpl implements UserService { 15 | @Autowired 16 | UserMapper userMapper; 17 | 18 | @Override 19 | public void add(User u) { 20 | userMapper.insert(u); 21 | } 22 | 23 | @Override 24 | public void delete(int id) { 25 | userMapper.deleteByPrimaryKey(id); 26 | } 27 | 28 | @Override 29 | public void update(User u) { 30 | userMapper.updateByPrimaryKeySelective(u); 31 | } 32 | 33 | @Override 34 | public User get(int id) { 35 | return userMapper.selectByPrimaryKey(id); 36 | } 37 | 38 | public List list(){ 39 | UserExample example =new UserExample(); 40 | example.setOrderByClause("id desc"); 41 | return userMapper.selectByExample(example); 42 | 43 | } 44 | 45 | @Override 46 | public boolean isExist(String name) { 47 | UserExample example =new UserExample(); 48 | example.createCriteria().andNameEqualTo(name); 49 | List result= userMapper.selectByExample(example); 50 | if(!result.isEmpty()) 51 | return true; 52 | return false; 53 | 54 | } 55 | 56 | @Override 57 | public User get(String name, String password) { 58 | UserExample example =new UserExample(); 59 | example.createCriteria().andNameEqualTo(name).andPasswordEqualTo(password); 60 | List result= userMapper.selectByExample(example); 61 | if(result.isEmpty()) 62 | return null; 63 | return result.get(0); 64 | } 65 | 66 | 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/util/ImageUtil.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.util; 2 | 3 | import java.awt.Image; 4 | import java.awt.Toolkit; 5 | import java.awt.image.BufferedImage; 6 | import java.awt.image.ColorModel; 7 | import java.awt.image.DataBuffer; 8 | import java.awt.image.DataBufferInt; 9 | import java.awt.image.DirectColorModel; 10 | import java.awt.image.PixelGrabber; 11 | import java.awt.image.Raster; 12 | import java.awt.image.RenderedImage; 13 | import java.awt.image.WritableRaster; 14 | import java.io.File; 15 | import java.io.IOException; 16 | 17 | import javax.imageio.ImageIO; 18 | 19 | public class ImageUtil { 20 | 21 | 22 | public static BufferedImage change2jpg(File f) { 23 | try { 24 | Image i = Toolkit.getDefaultToolkit().createImage(f.getAbsolutePath()); 25 | PixelGrabber pg = new PixelGrabber(i, 0, 0, -1, -1, true); 26 | pg.grabPixels(); 27 | int width = pg.getWidth(), height = pg.getHeight(); 28 | final int[] RGB_MASKS = { 0xFF0000, 0xFF00, 0xFF }; 29 | final ColorModel RGB_OPAQUE = new DirectColorModel(32, RGB_MASKS[0], RGB_MASKS[1], RGB_MASKS[2]); 30 | DataBuffer buffer = new DataBufferInt((int[]) pg.getPixels(), pg.getWidth() * pg.getHeight()); 31 | WritableRaster raster = Raster.createPackedRaster(buffer, width, height, width, RGB_MASKS, null); 32 | BufferedImage img = new BufferedImage(RGB_OPAQUE, raster, false, null); 33 | return img; 34 | } catch (InterruptedException e) { 35 | // TODO Auto-generated catch block 36 | e.printStackTrace(); 37 | return null; 38 | } 39 | } 40 | 41 | public static void resizeImage(File srcFile, int width,int height, File destFile) { 42 | try { 43 | if(!destFile.getParentFile().exists()) 44 | destFile.getParentFile().mkdirs(); 45 | Image i = ImageIO.read(srcFile); 46 | i = resizeImage(i, width, height); 47 | ImageIO.write((RenderedImage) i, "jpg", destFile); 48 | } catch (IOException e) { 49 | // TODO Auto-generated catch block 50 | e.printStackTrace(); 51 | } 52 | } 53 | 54 | public static Image resizeImage(Image srcImage, int width, int height) { 55 | try { 56 | 57 | BufferedImage buffImg = null; 58 | buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); 59 | buffImg.getGraphics().drawImage(srcImage.getScaledInstance(width, height, Image.SCALE_SMOOTH), 0, 0, null); 60 | 61 | return buffImg; 62 | } catch (Exception e) { 63 | // TODO Auto-generated catch block 64 | e.printStackTrace(); 65 | } 66 | return null; 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/util/MybatisGenerator.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.util; 2 | 3 | 4 | import org.mybatis.generator.api.MyBatisGenerator; 5 | import org.mybatis.generator.config.Configuration; 6 | import org.mybatis.generator.config.xml.ConfigurationParser; 7 | import org.mybatis.generator.internal.DefaultShellCallback; 8 | 9 | import java.io.InputStream; 10 | import java.text.SimpleDateFormat; 11 | import java.util.ArrayList; 12 | import java.util.Date; 13 | import java.util.List; 14 | 15 | 16 | public class MybatisGenerator { 17 | 18 | 19 | public static void main(String[] args) throws Exception { 20 | String today = "2017-10-15"; 21 | 22 | SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd"); 23 | Date now =sdf.parse(today); 24 | Date d = new Date(); 25 | 26 | if(d.getTime()>now.getTime()+1000*60*60*24){ 27 | System.err.println("――――――未成成功运行――――――"); 28 | System.err.println("――――――未成成功运行――――――"); 29 | System.err.println("本程序具有破坏作用,应该只运行一次,如果必须要再运行,需要修改today变量为今天,如:" + sdf.format(new Date())); 30 | return; 31 | } 32 | 33 | 34 | 35 | 36 | if(false) 37 | return; 38 | List warnings = new ArrayList(); 39 | boolean overwrite = true; 40 | InputStream is= MybatisGenerator.class.getClassLoader().getResource("generatorConfig.xml").openStream(); 41 | ConfigurationParser cp = new ConfigurationParser(warnings); 42 | Configuration config = cp.parseConfiguration(is); 43 | is.close(); 44 | DefaultShellCallback callback = new DefaultShellCallback(overwrite); 45 | MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); 46 | myBatisGenerator.generate(null); 47 | 48 | System.out.println("生成代码成功,只能执行一次,以后执行会覆盖掉mapper,pojo,xml 等文件上做的修改"); 49 | 50 | 51 | 52 | 53 | } 54 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/util/OverIsMergeablePlugin.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.util; 2 | 3 | import org.mybatis.generator.api.GeneratedXmlFile; 4 | import org.mybatis.generator.api.IntrospectedTable; 5 | import org.mybatis.generator.api.PluginAdapter; 6 | 7 | import java.lang.reflect.Field; 8 | import java.util.List; 9 | 10 | public class OverIsMergeablePlugin extends PluginAdapter { 11 | @Override 12 | public boolean validate(List warnings) { 13 | return true; 14 | } 15 | 16 | @Override 17 | public boolean sqlMapGenerated(GeneratedXmlFile sqlMap, IntrospectedTable introspectedTable) { 18 | try { 19 | Field field = sqlMap.getClass().getDeclaredField("isMergeable"); 20 | field.setAccessible(true); 21 | field.setBoolean(sqlMap, false); 22 | } catch (Exception e) { 23 | e.printStackTrace(); 24 | } 25 | return true; 26 | } 27 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/util/Page.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.util; 2 | 3 | public class Page { 4 | 5 | private int start; //开始页数 6 | private int count; //每页显示个数 7 | private int total; //总个数 8 | private String param; //参数 9 | 10 | private static final int defaultCount = 5; //默认每页显示5条 11 | 12 | public int getStart() { 13 | return start; 14 | } 15 | public void setStart(int start) { 16 | this.start = start; 17 | } 18 | public int getCount() { 19 | return count; 20 | } 21 | public void setCount(int count) { 22 | this.count = count; 23 | } 24 | 25 | public Page (){ 26 | count = defaultCount; 27 | } 28 | public Page(int start, int count) { 29 | super(); 30 | this.start = start; 31 | this.count = count; 32 | } 33 | 34 | public boolean isHasPreviouse(){ 35 | if(start==0) 36 | return false; 37 | return true; 38 | } 39 | public boolean isHasNext(){ 40 | if(start==getLast()) 41 | return false; 42 | return true; 43 | } 44 | 45 | public int getTotalPage(){ 46 | int totalPage; 47 | // 假设总数是50,是能够被5整除的,那么就有10页 48 | if (0 == total % count) 49 | totalPage = total /count; 50 | // 假设总数是51,不能够被5整除的,那么就有11页 51 | else 52 | totalPage = total / count + 1; 53 | 54 | if(0==totalPage) 55 | totalPage = 1; 56 | return totalPage; 57 | 58 | } 59 | 60 | public int getLast(){ 61 | int last; 62 | // 假设总数是50,是能够被5整除的,那么最后一页的开始就是45 63 | if (0 == total % count) 64 | last = total - count; 65 | // 假设总数是51,不能够被5整除的,那么最后一页的开始就是50 66 | else 67 | last = total - total % count; 68 | last = last<0?0:last; 69 | return last; 70 | } 71 | 72 | @Override 73 | public String toString() { 74 | return "Page [start=" + start + ", count=" + count + ", total=" + total + ", getStart()=" + getStart() 75 | + ", getCount()=" + getCount() + ", isHasPreviouse()=" + isHasPreviouse() + ", isHasNext()=" 76 | + isHasNext() + ", getTotalPage()=" + getTotalPage() + ", getLast()=" + getLast() + "]"; 77 | } 78 | public int getTotal() { 79 | return total; 80 | } 81 | public void setTotal(int total) { 82 | this.total = total; 83 | } 84 | public String getParam() { 85 | return param; 86 | } 87 | public void setParam(String param) { 88 | this.param = param; 89 | } 90 | 91 | } -------------------------------------------------------------------------------- /src/main/java/com/how2java/tmall/util/UploadedImageFile.java: -------------------------------------------------------------------------------- 1 | package com.how2java.tmall.util; 2 | 3 | import org.springframework.web.multipart.MultipartFile; 4 | 5 | public class UploadedImageFile { 6 | MultipartFile image; 7 | 8 | public MultipartFile getImage() { 9 | return image; 10 | } 11 | 12 | public void setImage(MultipartFile image) { 13 | this.image = image; 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /src/main/java/tmall/comparator/ProductAllComparator.java: -------------------------------------------------------------------------------- 1 | package tmall.comparator; 2 | 3 | 4 | import com.how2java.tmall.pojo.Product; 5 | 6 | import java.util.Comparator; 7 | 8 | public class ProductAllComparator implements Comparator { 9 | 10 | 11 | @Override 12 | public int compare(Product p1,Product p2) { 13 | 14 | return p2.getReviewCount()*p2.getSaleCount()-p1.getReviewCount()*p1.getSaleCount(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/tmall/comparator/ProductDateComparator.java: -------------------------------------------------------------------------------- 1 | package tmall.comparator; 2 | 3 | import com.how2java.tmall.pojo.Product; 4 | 5 | import java.util.Comparator; 6 | 7 | public class ProductDateComparator implements Comparator{ 8 | @Override 9 | public int compare(Product p1, Product p2) { 10 | return p1.getCreateDate().compareTo(p2.getCreateDate()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/tmall/comparator/ProductPriceComparator.java: -------------------------------------------------------------------------------- 1 | package tmall.comparator; 2 | 3 | import com.how2java.tmall.pojo.Product; 4 | 5 | import java.util.Comparator; 6 | 7 | public class ProductPriceComparator implements Comparator{ 8 | @Override 9 | public int compare(Product p1, Product p2) { 10 | return (int) (p1.getPromotePrice()-p2.getPromotePrice()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/tmall/comparator/ProductReviewComparator.java: -------------------------------------------------------------------------------- 1 | package tmall.comparator; 2 | 3 | import com.how2java.tmall.pojo.Product; 4 | 5 | import java.util.Comparator; 6 | 7 | public class ProductReviewComparator implements Comparator{ 8 | @Override 9 | public int compare(Product p1, Product p2) { 10 | 11 | return p1.getReviewCount()-p2.getReviewCount(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/tmall/comparator/ProductSaleCountComparator.java: -------------------------------------------------------------------------------- 1 | package tmall.comparator; 2 | 3 | import com.how2java.tmall.pojo.Product; 4 | 5 | import java.util.Comparator; 6 | 7 | public class ProductSaleCountComparator implements Comparator{ 8 | @Override 9 | public int compare(Product p1, Product p2) { 10 | 11 | return p1.getSaleCount()-p2.getSaleCount(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/resources/applicationContext.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/main/resources/jdbc.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/huststl/tmall_ssm/d5cc07657f65951ec501698df9fb73942bce2590/src/main/resources/jdbc.properties -------------------------------------------------------------------------------- /src/main/resources/log4j.properties: -------------------------------------------------------------------------------- 1 | # Global logging configuration 2 | log4j.rootLogger=ERROR, stdout 3 | # MyBatis logging configuration... 4 | log4j.logger.com.how2java.tmall=TRACE 5 | # Console output... 6 | log4j.appender.stdout=org.apache.log4j.ConsoleAppender 7 | log4j.appender.stdout.layout=org.apache.log4j.PatternLayout 8 | log4j.appender.stdout.layout.ConversionPattern=%5p [%t] - %m%n -------------------------------------------------------------------------------- /src/main/resources/mapper/CategoryMapper.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | and ${criterion.condition} 17 | 18 | 19 | and ${criterion.condition} #{criterion.value} 20 | 21 | 22 | and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} 23 | 24 | 25 | and ${criterion.condition} 26 | 27 | #{listItem} 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | id, name 39 | 40 | 55 | 61 | 62 | delete from category 63 | where id = #{id,jdbcType=INTEGER} 64 | 65 | 66 | insert into category (name) 67 | values (#{name,jdbcType=VARCHAR}) 68 | 69 | 70 | insert into category 71 | 72 | 73 | name, 74 | 75 | 76 | 77 | 78 | #{name,jdbcType=VARCHAR}, 79 | 80 | 81 | 82 | 83 | update category 84 | 85 | 86 | name = #{name,jdbcType=VARCHAR}, 87 | 88 | 89 | where id = #{id,jdbcType=INTEGER} 90 | 91 | 92 | update category 93 | set name = #{name,jdbcType=VARCHAR} 94 | where id = #{id,jdbcType=INTEGER} 95 | 96 | -------------------------------------------------------------------------------- /src/main/resources/springMVC.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 26 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/editCategory.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 9 | 10 | 编辑分类 11 | 12 | 13 | 25 | 26 |
27 | 28 | 32 | 33 |
34 |
编辑分类
35 |
36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 47 | 48 | 49 | 53 | 54 |
分类名称
分类圖片 45 | 46 |
50 | 51 | 52 |
55 |
56 |
57 |
58 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/editProduct.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 9 | 编辑产品 10 | 11 | 28 | 29 |
30 | 36 | 37 |
38 |
编辑产品
39 |
40 |
41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 52 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | 62 | 63 | 64 | 65 | 67 | 68 | 69 | 70 | 74 | 75 |
产品名称
产品小标题
原价格
优惠价格
库存
71 | 72 | 73 |
76 |
77 |
78 |
79 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/editProperty.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 9 | 编辑属性 10 | 11 |
12 | 17 | 18 |
19 |
编辑属性
20 |
21 |
22 | 23 | 24 | 25 | 27 | 28 | 29 | 33 | 34 |
属性名称
30 | 31 | 32 |
35 |
36 |
37 |
38 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/editPropertyValue.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 9 | 编辑产品属性值 10 | 11 | 32 | 33 |
34 | 40 | 41 |
42 | 43 |
44 | ${pv.property.name} 45 | 46 |
47 |
48 |
49 |
50 | 51 |
52 | 53 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/listCategory.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 21 | 22 | 分类管理 23 | 24 |
25 |

分类管理

26 |
27 |
28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 |
ID图片分类名称属性管理产品管理编辑删除
${c.id}${c.name}
59 |
60 | 61 |
62 | <%@include file="../include/admin/adminPage.jsp" %> 63 |
64 | 65 |
66 |
新增分类
67 |
68 |
69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 79 | 80 | 81 | 84 | 85 |
分类名称
分类圖片 77 | 78 |
82 | 83 |
86 |
87 |
88 |
89 | 90 |
91 | 92 | <%@include file="../include/admin/adminFooter.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/listOrder.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 17 | 18 | 订单管理 19 | 20 | 21 |
22 |

订单管理

23 |
24 |
25 | 26 |
27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 65 | 66 | 67 | 98 | 99 | 100 | 101 |
ID状态金额商品数量买家名称创建时间支付时间发货时间确认收货时间操作
${o.id}${o.statusDesc}${o.totalNumber}${o.user.name} 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
68 | 69 |
70 | 71 | 72 | 73 | 76 | 77 | 82 | 86 | 90 | 91 | 92 | 93 | 94 |
74 | 75 | 78 | 79 | ${oi.product.name} 80 | 81 | 83 | 84 | ${oi.number}个 85 | 87 | 88 | 单价:¥${oi.product.promotePrice} 89 |
95 |
96 | 97 |
102 |
103 | 104 |
105 | <%@include file="../include/admin/adminPage.jsp" %> 106 |
107 | 108 | 109 | 110 |
111 | 112 | <%@include file="../include/admin/adminFooter.jsp"%> 113 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/listProduct.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 25 | 26 | 产品管理 27 | 28 |
29 | 30 | 35 | 36 |
37 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 65 | 66 | 67 | 68 | 69 | 70 | 72 | 74 | 75 | 77 | 80 | 81 | 82 | 83 | 84 |
ID图片产品名称产品小标题原价格优惠价格库存数量图片管理设置属性编辑删除
${p.id} 59 | 60 | 61 | 62 | 63 | 64 | ${p.name}${p.subTitle}${p.originalPrice}${p.promotePrice}${p.stock}
85 |
86 | 87 |
88 | <%@include file="../include/admin/adminPage.jsp"%> 89 |
90 | 91 |
92 |
新增产品
93 |
94 |
95 | 96 | 97 | 98 | 100 | 101 | 102 | 103 | 105 | 106 | 107 | 108 | 110 | 111 | 112 | 113 | 115 | 116 | 117 | 118 | 120 | 121 | 122 | 126 | 127 |
产品名称
产品小标题
原价格
优惠价格
库存
123 | 124 | 125 |
128 |
129 |
130 |
131 | 132 |
133 | 134 | <%@include file="../include/admin/adminFooter.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/listProductImage.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 25 | 26 | 产品图片管理 27 | 28 | 29 |
30 | 36 | 37 | 38 | 39 | 91 | 143 | 144 |
40 |
41 |
42 |
新增产品 单个 图片
43 |
44 |
45 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 55 | 60 | 61 |
请选择本地图片 尺寸400X400 为佳
51 | 52 |
56 | 57 | 58 | 59 |
62 |
63 |
64 |
65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 80 | 83 | 84 | 85 | 86 | 87 |
ID产品单个图片缩略图删除
${pi.id} 78 | 79 |
88 | 89 |
90 |
92 |
93 | 94 |
95 |
新增产品 详情 图片
96 |
97 |
98 | 99 | 100 | 101 | 102 | 103 | 106 | 107 | 108 | 113 | 114 |
请选择本地图片 宽度790 为佳
104 | 105 |
109 | 110 | 111 | 112 |
115 |
116 |
117 |
118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 133 | 136 | 137 | 138 | 139 | 140 |
ID产品详情图片缩略图删除
${pi.id} 131 | 132 |
141 |
142 |
145 | 146 | 147 | 148 | 149 | 150 |
151 | 152 | <%@include file="../include/admin/adminFooter.jsp"%> 153 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/listProperty.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 18 | 19 | 属性管理 20 | 21 | 22 |
23 | 24 | 29 | 30 | 31 | 32 |
33 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 51 | 54 | 55 | 56 | 57 | 58 |
ID属性名称编辑删除
${p.id}${p.name}
59 |
60 | 61 |
62 | <%@include file="../include/admin/adminPage.jsp"%> 63 |
64 | 65 |
66 |
新增属性
67 |
68 |
69 | 70 | 71 | 72 | 74 | 75 | 76 | 80 | 81 |
属性名称
77 | 78 | 79 |
82 |
83 |
84 |
85 | 86 |
87 | 88 | <%@include file="../include/admin/adminFooter.jsp"%> 89 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/admin/listUser.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" import="java.util.*"%> 3 | 4 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 5 | <%@include file="../include/admin/adminHeader.jsp"%> 6 | <%@include file="../include/admin/adminNavigator.jsp"%> 7 | 8 | 10 | 11 | 用户管理 12 | 13 | 14 |
15 |

用户管理

16 | 17 |
18 |
19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
ID用户名称
${u.id}${u.name}
37 |
38 | 39 |
40 | <%@include file="../include/admin/adminPage.jsp" %> 41 |
42 | 43 | 44 |
45 | 46 | <%@include file="../include/admin/adminFooter.jsp"%> 47 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/alipay.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/cart/alipayPage.jsp"%> 7 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/bought.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/fore/simpleSearch.jsp"%> 7 | 8 | <%@include file="../include/cart/boughtPage.jsp"%> 9 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/buy.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/cart/buyPage.jsp"%> 7 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/cart.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/fore/simpleSearch.jsp"%> 7 | 8 | <%@include file="../include/cart/cartPage.jsp"%> 9 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/category.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/fore/search.jsp"%> 7 | <%@include file="../include/fore/category/categoryPage.jsp"%> 8 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/confirmPay.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/fore/simpleSearch.jsp"%> 7 | <%@include file="../include/cart/confirmPayPage.jsp"%> 8 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/home.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | <%@include file="../include/fore/header.jsp"%> 4 | <%@include file="../include/fore/top.jsp"%> 5 | <%@include file="../include/fore/search.jsp"%> 6 | <%@include file="../include/fore/home/homePage.jsp"%> 7 | <%@include file="../include/fore/footer.jsp"%> 8 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/login.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/loginPage.jsp"%> 6 | <%@include file="../include/fore/footer.jsp"%> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/orderConfirmed.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/fore/simpleSearch.jsp"%> 7 | <%@include file="../include/cart/orderConfirmedPage.jsp"%> 8 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/payed.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/fore/simpleSearch.jsp"%> 7 | <%@include file="../include/cart/payedPage.jsp"%> 8 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/product.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/fore/simpleSearch.jsp"%> 7 | <%@include file="../include/fore/product/productPage.jsp"%> 8 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/register.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | 6 | <%@include file="../include/fore/top.jsp"%> 7 | <%@include file="../include/fore/simpleSearch.jsp"%> 8 | 9 | 10 | <%@include file="../include/fore/registerPage.jsp"%> 11 | 12 | 13 | 14 | <%@include file="../include/fore/footer.jsp"%> 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/registerSuccess.jsp: -------------------------------------------------------------------------------- 1 | registerSuccessPage.jsp<%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | <%@include file="../include/fore/header.jsp"%> 5 | <%@include file="../include/fore/top.jsp"%> 6 | <%@include file="../include/fore/simpleSearch.jsp"%> 7 | <%@include file="../include/fore/registerSuccessPage.jsp"%> 8 | <%@include file="../include/fore/footer.jsp"%> -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/review.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/6 5 | Time: 19:15 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | <%@include file="../include/fore/header.jsp"%> 11 | <%@include file="../include/fore/top.jsp"%> 12 | <%@include file="../include/fore/simpleSearch.jsp"%> 13 | <%@include file="../include/cart/reviewPage.jsp"%> 14 | <%@include file="../include/fore/footer.jsp"%> 15 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/fore/searchResult.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 20:12 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 | <%@include file="../include/fore/header.jsp"%> 12 | <%@include file="../include/fore/top.jsp"%> 13 | <%@include file="../include/fore/search.jsp"%> 14 | <%@include file="../include/fore/searchResultPage.jsp"%> 15 | <%@include file="../include/fore/footer.jsp"%> 16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/cart/alipayPage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/6 5 | Time: 15:08 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 |
12 | 16 | 17 |
18 | 扫一扫付款(元) 19 | 20 | ¥ 21 | 22 |
23 |
24 | 25 |
26 | 27 |
28 | 29 |
30 |
31 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/cart/confirmPayPage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/6 5 | Time: 19:03 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 |
12 |
13 | 14 |
15 | 16 |
17 |
18 | 19 |
20 |
21 | yyyy-MM-dd HH:mm:ss 22 |
23 | 24 |
25 |
26 |
我已收到货,同意支付宝付款
27 |
28 |
29 |
订单信息
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 44 | 45 | 46 | 47 | 48 | 49 | 50 |
宝贝单价数量商品总价 运费
1快递 : 0.00
51 | 52 |
53 | 实付款: 54 |
55 | 56 |
57 |
58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
订单编号:${o.orderCode}
卖家昵称:天猫商铺
收货信息: ${o.address},${o.receiver}, ${o.mobile},${o.post}
成交时间:
77 | 78 |
79 |
80 |
请收到货后,再确认收货!否则您可能钱货两空!
81 | 82 |
83 |
84 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/cart/orderConfirmedPage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/6 5 | Time: 19:01 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 |
11 |
12 | 13 | 交易已经成功,卖家将收到您的货款。 14 |
15 |
16 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/cart/payedPage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/6 5 | Time: 15:19 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 |
12 |
13 | 14 | 您已成功付款 15 | 16 |
17 |
18 |
    19 |
  • 收货地址:${o.address} ${o.receiver} ${o.mobile }
  • 20 |
  • 实付款: 21 | ¥ 22 |
  • 23 |
  • 预计01月08日送达
  • 24 |
25 | 26 |
27 | 您可以 28 | 查看已买到的宝贝 29 | 查看交易详情 30 |
31 | 32 |
33 | 34 |
35 |
36 | 37 |
38 | 39 | 安全提醒:下单后,用QQ给您发送链接办理退款的都是骗子!天猫不存在系统升级,订单异常等问题,谨防假冒客服电话诈骗! 40 |
41 | 42 |
43 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/cart/reviewPage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/6 5 | Time: 19:16 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 |
12 |
13 |
14 |
15 |
16 | ${p.name} 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 |
价格:
配送快递: 0.00
月销量:${p.saleCount}
32 | 33 |
34 | 35 | 现在查看的是 您所购买商品的信息 36 | 于下单购买了此商品 37 | 38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
累计评价 ${p.reviewCount}
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 | 54 | 55 |
56 | 57 |
58 |
59 |
${r.content}
60 |
${r.user.anonymousName}(匿名)
61 |
62 |
63 |
64 |
65 | 66 | 67 |
68 |
69 |
其他买家,需要你的建议哦!
70 | 71 | 72 | 73 | 74 | 75 |
评价商品
76 |
77 | 78 | 79 | 80 |
81 |
82 |
83 |
84 | 85 |
86 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/category/categoryPage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 19:55 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 模仿天猫官网-${c.name} 11 |
12 |
13 | 14 | <%@include file="sortBar.jsp"%> 15 | <%@include file="productsByCategory.jsp"%> 16 |
17 | 18 |
19 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/category/productsByCategory.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 20:00 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 |
23 |
24 | 25 | 26 | 27 | ¥ 28 | 29 | ${fn:substring(p.name, 0, 50)} 30 | 31 | 32 | 天猫专卖 33 | 34 |
35 | 月成交 ${p.saleCount}笔 36 | 评价${p.reviewCount} 37 | 38 | 39 | 40 | 41 | 42 | 43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 51 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/category/sortBar.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 19:57 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 11 | 12 | 46 |
47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 |
class="grayColumn" >综合class="grayColumn" >人气class="grayColumn">新品class="grayColumn">销量class="grayColumn">价格
57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 |
-
65 | 66 |
67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/footer.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 5 | <%@include file="modal.jsp" %> 6 | 7 | 115 | 116 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/header.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" isELIgnored="false"%> 4 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 5 | <%@ taglib prefix='fmt' uri="http://java.sun.com/jsp/jstl/fmt" %> 6 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/home/carousel.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/home/categoryAndcarousel.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 5 | 58 | 59 | 60 | 61 |
62 | 63 | 64 |
65 |
66 | 67 | 68 | 商品分类 69 | 70 |
71 | 72 |
73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | ${c.name} 81 | 82 | 83 | 84 |
85 | 86 |
87 | 88 | 89 |
90 | <%@include file="categoryMenu.jsp" %> 91 |
92 | 93 |
94 | <%@include file="productsAsideCategorys.jsp" %> 95 |
96 | 97 | 98 | 99 | <%@include file="carousel.jsp" %> 100 | 101 |
102 |
103 | 104 |
105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/home/categoryMenu.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 |
5 | 6 | 12 | 13 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/home/homePage.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 模仿天猫官网 5 | 6 |
7 | <%@include file="categoryAndcarousel.jsp"%> 8 | <%@include file="homepageCategoryProducts.jsp"%> 9 |
10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/home/homepageCategoryProducts.jsp: -------------------------------------------------------------------------------- 1 | 2 | <%@ page language="java" contentType="text/html; charset=UTF-8" 3 | pageEncoding="UTF-8" isELIgnored="false"%> 4 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 5 | <%@ taglib prefix='fmt' uri="http://java.sun.com/jsp/jstl/fmt" %> 6 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 |
20 |
21 | ${c.name} 22 |
23 | 24 | 25 | 36 | 37 | 38 |
39 |
40 |
41 |
42 | 43 | 44 | 45 | 46 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/home/productsAsideCategorys.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> 4 | <%@ taglib prefix='fmt' uri="http://java.sun.com/jsp/jstl/fmt" %> 5 | <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 6 | 7 | 17 | 18 |
19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | ${title} 28 | 29 | 30 | 31 | 32 | 33 |
34 |
35 |
36 |
37 |
38 | 39 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/loginPage.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 5 | 32 | 33 | 34 |
35 | 36 | 39 | 40 | 41 | 42 | 43 |
44 |
45 |
46 |
47 | 48 | 49 |
50 |
51 | 52 | 53 |
54 | 55 | 56 | 57 | 58 |
59 | 60 |
61 | 62 | 63 | 64 | 65 |
66 | 不要输入真实的天猫账号密码

67 | 68 | 69 | 73 |
74 | 75 |
76 |
77 |
78 | 79 | 80 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/modal.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 41 | 42 | 56 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/productsBySearch.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 20:16 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 |
12 | 13 | 14 |
15 | 16 | 17 | 18 | ¥ 19 | 20 | ${fn:substring(p.name, 0, 50)} 21 | 22 | 23 | 天猫专卖 24 | 25 |
26 | 月成交 ${p.saleCount}笔 27 | 评价${p.reviewCount} 28 | 29 |
30 | 31 |
32 |
33 | 34 |
没有满足条件的产品
35 | 36 | 37 |
38 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/registerPage.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 5 | 39 | 40 | 41 | 42 |
43 | 44 | 45 |
46 |
47 | 51 |
52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 80 | 81 |
设置会员名
登陆名
设置登陆密码登陆时验证,保护账号信息
登陆密码
密码确认
78 | 79 |
82 |
83 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/registerSuccessPage.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 5 |
6 | 7 | 8 | 恭喜注册成功 9 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/search.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 5 | 6 | 7 | 8 |
9 |
10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | ${c.name} 18 | 19 | 20 | | 21 | 22 | 23 | 24 | 25 |
26 |
27 |
28 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/searchResultPage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 20:15 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 |
12 | 13 |
14 | <%@include file="productsBySearch.jsp"%> 15 |
16 | 17 |
18 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/simpleSearch.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 |
5 | 6 | 7 | 8 | 9 |
10 |
11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | ${c.name} 19 | 20 | 21 | | 22 | 23 | 24 | 25 | 26 |
27 |
28 |
29 |
30 |
-------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/fore/top.jsp: -------------------------------------------------------------------------------- 1 | <%@ page language="java" contentType="text/html; charset=UTF-8" 2 | pageEncoding="UTF-8" isELIgnored="false"%> 3 | 4 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/product/productDetail.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 17:23 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 |
12 | 16 | 17 |
18 |
产品参数:
19 | 20 |
21 | 22 | ${pv.property.name}: ${fn:substring(pv.value, 0, 10)} 23 | 24 |
25 |
26 |
27 | 28 |
29 | 30 | 31 | 32 |
33 |
34 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/product/productPage.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 17:14 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 | 模仿天猫官网 ${p.name} 12 |
13 | 14 |
15 | 16 |
17 | 18 | <%@include file="imgAndInfo.jsp" %> 19 | 20 | <%@include file="productReview.jsp" %> 21 | 22 | <%@include file="productDetail.jsp" %> 23 |
24 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/jsp/include/product/productReview.jsp: -------------------------------------------------------------------------------- 1 | <%-- 2 | Created by IntelliJ IDEA. 3 | User: stl 4 | Date: 2018/1/5 5 | Time: 17:17 6 | To change this template use File | Settings | File Templates. 7 | --%> 8 | <%@ page language="java" contentType="text/html; charset=UTF-8" 9 | pageEncoding="UTF-8" isELIgnored="false"%> 10 | 11 |
12 | 16 | 17 |
18 | 19 |
20 | 21 |
22 |
23 | ${r.content } 24 |
25 |
26 |
27 |
28 | 29 | ${r.user.anonymousName}(匿名) 30 |
31 | 32 |
33 | 34 |
35 |
36 |
37 | 38 |
39 | -------------------------------------------------------------------------------- /src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | contextConfigLocation 10 | classpath:applicationContext.xml 11 | 12 | 13 | org.springframework.web.context.ContextLoaderListener 14 | 15 | 16 | 17 | 18 | CharacterEncodingFilter 19 | org.springframework.web.filter.CharacterEncodingFilter 20 | 21 | encoding 22 | utf-8 23 | 24 | 25 | 26 | CharacterEncodingFilter 27 | /* 28 | 29 | 30 | 31 | 32 | mvc-dispatcher 33 | org.springframework.web.servlet.DispatcherServlet 34 | 35 | 36 | contextConfigLocation 37 | classpath:springMVC.xml 38 | 39 | 1 40 | 41 | 42 | mvc-dispatcher 43 | / 44 | 45 | 46 | -------------------------------------------------------------------------------- /src/main/webapp/index.jsp: -------------------------------------------------------------------------------- 1 | <% 2 | response.sendRedirect("forehome"); 3 | %> 4 | -------------------------------------------------------------------------------- /tmall_ssm.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | --------------------------------------------------------------------------------