Author homepage: Source Space Station 2022
Introduction: High-quality creators in the Java field, Java projects, learning materials, technical mutual assistance
Get the source code at the end of the article
Project Introduction
Youmi online shopping experience system
1. The platform has two main functions:
(1) Browse the basketball-related information provided by the official platform and certified authors. The types of information include: videos, news, commentary articles, and game results
(2) Basketball Peripheral Mall, product classification: sneakers, jerseys, basketballs, sports equipment, casual clothes
(3) Special function: Each piece of information and each product has a special type: label (multiple labels are possible). When a user is browsing a certain piece of information (for example, when watching a certain video to the end), the platform will push products with the same label to the user according to the label. Conversely, when a user browses a product, the same information as the product label is also pushed to the user according to the label.
2. The platform has three types of users: platform administrators, platform certified authors, and ordinary users
(1) Platform Administrator:
① It can manage the store officially operated by the platform, add, delete, check and modify the products in the store, and regularly launch activities
② Information release on the management platform, which can add, delete, modify and check information
(2) Platform certified author:
① You can publish your own articles or edited videos
② You can add product links under the information you publish, and users can get commissions if they purchase
(3) User:
① You can browse information about basketball on the platform without advertising
② You can browse products and purchase
③ Can apply to become an officially certified author
environmental needs
1. Operating environment: preferably java jdk 1.8, we run on this platform. Other versions are also theoretically possible.
2.IDE environment: IDEA, Eclipse,Myeclipse are all available. Recommend IDEA;
3.tomcat environment: Tomcat 7.x,8.x,9.x versions are available
4. Hardware environment: Windows 7/8/10 with 1G memory or more; or Mac OS;
5. Whether it is a Maven project: Yes; check whether pom.xml is included in the source code directory; if it is included, it is a maven project, otherwise it is a non-maven project
6. Database: MySql version 5.7;
technology stack
1. Backend: Springboot
2. Front end: html+bootstrap+jQuery+layui+ueditor
Instructions for use
1. Use Navicat or other tools to create a database with the corresponding name in mysql, and import the sql file of the project;
2. Change the database configuration in the application.yml configuration file in the project to your own configuration
3. Use IDEA/Eclipse/MyEclipse to import the project. When importing Eclipse/MyEclipse, if it is a maven project, please select maven; if it is a maven project, please execute the maven clean;maven install command after the import is successful, configure tomcat, and then run;
4. Run the project Front desk address: http://localhost:8080/
Background browsing address: http://localhost:8080/login.html
run screenshot
code related
Event Management Controller
/** * Activity */ @Controller @RequestMapping("activity") public class ActivityController { @Autowired private ActivityService service; /** * interface * @param model * @return */ @RequestMapping("list.htm") public String list(Model model){ List<ActivityEntity> list = service.selectList(new EntityWrapper<>()); model.addAttribute("list",list); return "activity/list"; } /** * save interface * @param model * @param id * @return * @throws Exception */ @RequestMapping("save.htm") public String save(Model model,String id)throws Exception{ ActivityEntity entity = new ActivityEntity(); if(!StringUtils.isEmpty(id)){ entity = service.selectById(id); } model.addAttribute("entity",entity); return "activity/save"; } /** * save * @param model * @return * @throws Exception */ @RequestMapping("saveData.htm") @ResponseBody public Result save(Model model, ActivityEntity entity)throws Exception{ if(StringUtils.isEmpty(entity.getId())){ entity.setId(IdWorker.get32UUID()); entity.setTime(new Date()); service.insert(entity); }else{ service.updateById(entity); } return Result.success("Successfully saved"); } /** * delete * @param id * @return * @throws Exception */ @PostMapping("del.htm") @ResponseBody public Result del(String id)throws Exception{ service.deleteById(id); return Result.success("Successfully saved"); } }
Order Management Controller
@Controller @RequestMapping("order") public class OrderController { @Autowired private OrderShopService orderShopService; @Autowired private OrderService orderService; /** * interface * @param model * @return * @throws Exception */ @RequestMapping("page.htm") public String page(Model model)throws Exception{ EntityWrapper entityWrapper = new EntityWrapper(); entityWrapper.orderBy(OrderTable.TIME,false); List<OrderEntity> list = orderService.selectList(entityWrapper); if(list!=null){ for (OrderEntity orderEntity : list) { entityWrapper = new EntityWrapper(); entityWrapper.eq("order_id",orderEntity.getId()); List<OrderShopEntity> shoppingGatEntities = orderShopService.selectList(entityWrapper); orderEntity.setOrderShops(shoppingGatEntities); } } model.addAttribute("list",list); return "order/list"; } /** * Revise * @param orderEntity * @return * @throws Exception */ @RequestMapping("update.htm") @ResponseBody @NoAdminLogin public Result update(OrderEntity orderEntity)throws Exception{ orderService.updateById(orderEntity); return Result.success("1"); } }
Merchandise Management Controller
/** * commodity management */ @Controller @RequestMapping("shop") public class ShopController { @Autowired private ShopService service; @Autowired private ShopTypeService shopTypeService; /** * interface * @param model * @return */ @RequestMapping("list.htm") public String list(Model model){ List<ShopEntity> list = service.selectList(new EntityWrapper<>()); model.addAttribute("list",list); return "shop/list"; } /** * save interface * @param model * @param id * @return * @throws Exception */ @RequestMapping("save.htm") public String save(Model model,String id)throws Exception{ ShopEntity entity = new ShopEntity(); entity.setStatus(true); entity.setHot(false); if(!StringUtils.isEmpty(id)){ entity = service.selectById(id); } model.addAttribute("entity",entity); List<ShopTypeEntity> types = shopTypeService.selectList(new EntityWrapper<>()); model.addAttribute("types",types); return "shop/save"; } /** * save * @param model * @return * @throws Exception */ @RequestMapping("saveData.htm") @ResponseBody public Result save(Model model, ShopEntity entity)throws Exception{ if(StringUtils.isEmpty(entity.getId())){ entity.setId(IdWorkerUtil.getId()); entity.setStock(0); entity.setScore(0.0); service.insert(entity); }else{ service.updateById(entity); } return Result.success("Successfully saved"); } /** * delete * @param id * @return * @throws Exception */ @PostMapping("del.htm") @ResponseBody public Result del(String id)throws Exception{ service.deleteById(id); return Result.success("Successfully saved"); } /** * save * @param model * @return * @throws Exception */ @RequestMapping("stock.htm") @ResponseBody public Result stock(Model model, Integer stock,String id ,Integer type)throws Exception{ ShopEntity entity = service.selectById(id); if(entity.getStock()==null){ entity.setStock(0); } if(type==1){ //add inventory entity.setStock(entity.getStock()+stock); }else{ //decrease stock if(entity.getStock()-stock<0){ return Result.error("Insufficient stock"); } entity.setStock(entity.getStock()-stock); } service.updateById(entity); return Result.success("Successfully saved"); } }
If you also want to learn this system, get it below. Reply: 042springboot