——————————DescriptionStart——————————
运行环境 Java≥8、MySQL≥5.7、Node.js≥14
开发工具 后端:eclipse/idea/myeclipse/sts等均可配置运行 前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用 课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb的SpringBoot农资商城购物商城(java+springboot+vue+mybatis+mysql+maven)
启动步骤:
1 双击打开【Redis-64bit/redis-server.exe】
2 启动后端:com.alex.shopping.StartApplication
3 启动前端:npm run serve
1 2 3 4 5 6 7 8 9 管理员 admin@qq.com 123456 卖家 business@qq.com 123456 business1@qq.com 123456 买家 buyer@qq.com 123456
——————————CodeStart——————————
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 @PutMapping("/password") public Result updatePassword (@RequestBody String password) { return userService.updatePassword(password); } } @Service @Transactional public class ImageServiceImpl implements ImageService { public static SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy_MM_dd" ); @Value("${shopping.image.savePath}") private String IMAGE_PATH; @Value("${shopping.image.maxSize}") private long IMAGE_MAXSIZE; @Autowired private ImageMapper imageMapper; @Autowired private UserService userService; @Override public Result uploadImage (MultipartFile file) {
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 public static void setCookie (String key, String value, HttpServletResponse response) { setCookie(key,value,DEFAULT_AGE,response); } public static void setCookie (String key, String value, int age,HttpServletResponse response) { Cookie cookie = new Cookie(key,value); cookie.setDomain(DOMAIN); cookie.setPath("/" ); cookie.setMaxAge(age); response.addCookie(cookie); } public static Cookie getCookie (String key, HttpServletRequest request) { if (request.getCookies()==null ){ return null ; } for (Cookie cookie : request.getCookies()) { if (cookie.getName().equals(key)){ return cookie; } } return null ; }
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 * 审核通过 * @param productId * @return */ @PostMapping("/examine_on/{productId}") public Result examineOn (@PathVariable("productId") String productId) { return productService.examineOn(productId); } @PostMapping("/examine_off/{productId}") public Result examineOff (@PathVariable("productId") String productId) { return productService.examineOff(productId); } @PostMapping("/add") public Result addProduct (@RequestBody Product product) { return productService.addProduct(product); } @PostMapping("/update") public Result updateProduct (@RequestBody Product product) { return productService.updateProduct(product); } @DeleteMapping("/delete/{productId}") public Result deleteProduct (@PathVariable("productId") String productId) { return productService.deleteProductById(productId); }
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 } os.flush(); }catch (Exception e){ e.printStackTrace(); }finally { if (os!=null ){ os.close(); } if (fis!=null ){ fis.close(); } } } } @RestController @RequestMapping("/product") public class ProductController { @Autowired private ProductService productService; @GetMapping("/list") public Result list () { return productService.list(); } @GetMapping("/list/admin/{page}/{size}") public Result listAdmin (@PathVariable("page") int page,@PathVariable("size") int size, @RequestParam(value = "name",required = false) String name, @RequestParam(value="email",required=false) String email) { return productService.listAdmin(page,size,name,email); }
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 QueryWrapper<User> wrapper = new QueryWrapper<>(); if (userName!=null ){ wrapper.like("user_name" ,userName); } if (email!=null ) { wrapper.like("email" ,email); } IPage<User> userPage = userMapper.selectPage(pageDB, wrapper); if (userPage.getRecords().size()==0 ){ return Result.FAILED("无数据" ); } return Result.SUCCESS("获取成功" ).setData(userPage); } @Override public Result banUserByEmail (String email) { User user = getUserByEmail(email); if (user==null ||user.getRoles()==0 ){ return Result.FAILED("封禁失败" ); } user.setStatus(Constants.User.STATUS_ABNORMAL); userMapper.updateById(user); return Result.SUCCESS("封禁成功" ); } @Override public Result removeBanUserByEmail (String email) { User user = getUserByEmail(email); if (user==null ){ return Result.FAILED("解禁失败" ); } user.setStatus(Constants.User.STATUS_NORMAL); userMapper.updateById(user); return Result.SUCCESS("解禁成功" ); } @Override public Result resetPassword (String email) { User user = getUserByEmail(email); if (user==null ){ return Result.FAILED("重置失败" ); } user.setPassword(resetPassword); userMapper.updateById(user); return Result.SUCCESS("重置成功!重置密码为" +resetPassword);
——————————PayStart——————————
项目链接: https://javayms.github.io?id=541923582708201co https://javayms.pages.dev?id=541923582708201co