——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Node.js≥14
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
❗没学过node.js的不要搞前后端分离项目
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SpringBoot电影购票管理系统(java+springboot+vue+maven+mysql)
一、项目运行 环境配置:
Jdk1.8 + Mysql + HBuilderX(Webstorm也行)+ Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)。
项目技术:
Spring + SpringBoot+ mybatis + Maven + Vue 等等组成,B/S模式 + Maven管理等等。
——————————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 31 32 33 34 35 36 37
|
@RestController @Api(tags = "电影接口") @RequestMapping("/api/film") public class FilmController {
@Resource private FilmService filmService;
@PostMapping("") @ApiOperation(value = "保存电影") public void save(@RequestBody Film film) { filmService.save(film); }
@GetMapping("") @ApiOperation("列出所有电影") public List<Film> list(String region, String type) { if (region != null && type != null) { return filmService.findByRegionAndType(region, type); } return filmService.findAll(); }
@GetMapping("/hot/{limit}") @ApiOperation("获取热榜电影") public List<Film> listHots(@PathVariable Integer limit) { return filmService.findHots(limit); }
@GetMapping("/name/{name}") @ApiOperation("搜索电影") public List<Film> search(@PathVariable String name) { return filmService.findLikeName(name); }
|
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
| @RestController @Api(tags = "留言接口") @RequestMapping("/api/lm") public class LeavingMessageController {
@Resource private LeavingMessageService leavingMessageService;
@PostMapping("") @ApiOperation(value = "新增留言接口") public void save(@RequestBody LeavingMessage leavingMessage) { leavingMessageService.save(leavingMessage); }
@PutMapping("") @ApiOperation("回复留言") public void reply(@RequestBody LeavingMessage leavingMessage) { leavingMessageService.reply(leavingMessage); }
@GetMapping("") @ApiOperation("获取所有影院留言") public List<LeavingMessageVO> list() { return leavingMessageService.findAll(); }
@GetMapping("/active") @ApiOperation("获取活跃留言的用户") public List<ActiveUserVO> findActiveUsers() { return leavingMessageService.findActiveUsers(); }
} package com.movie.api.controller;
|
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
| SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken(username, null, authorities)); super.doFilterInternal(request, response, chain); }
} package com.movie.api.controller;
@RestController @Api(tags = "电影排片场次接口") @RequestMapping("/api/arrangement") public class ArrangementController {
@Resource private ArrangementService arrangementService;
@Resource private FilmService filmService;
@PostMapping("") @ApiOperation("新增电影场次") public void save(@RequestBody Arrangement arrangement) { arrangementService.save(arrangement); }
@PutMapping("") @ApiOperation("修改排片信息") public Arrangement update(@RequestBody Arrangement arrangement) { return arrangementService.Update(arrangement); }
|
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
| } package com.movie.api.controller;
@RestController @Api(tags = "电影排片场次接口") @RequestMapping("/api/arrangement") public class ArrangementController {
@Resource private ArrangementService arrangementService;
@Resource private FilmService filmService;
@PostMapping("") @ApiOperation("新增电影场次") public void save(@RequestBody Arrangement arrangement) { arrangementService.save(arrangement); }
@PutMapping("") @ApiOperation("修改排片信息") public Arrangement update(@RequestBody Arrangement arrangement) { return arrangementService.Update(arrangement); }
@DeleteMapping("") @ApiOperation("根据id删除排片") public void delete(@RequestParam String id) { arrangementService.deleteById(id); }
|
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
| @Value("${server.port}") private String serverPort;
@Resource private UploadService uploadService;
@Resource private UploadMapper uploadMapper;
@PostMapping("") @ApiOperation(value = "上传图片") @PreAuthorize("hasAnyRole('ROLE_ADMIN', 'ROLE_USER', 'ROLE_WORKER')") @DisableBaseResponse public String upload(MultipartFile file) throws Exception { if (file == null) throw new Exception("请求参数缺失"); if (file.isEmpty()) { throw new Exception("上传失败,请选择文件"); } return "http://localhost:" + serverPort + "/api/upload?id=" + uploadService.checkAndSaveUpload(file); }
@DeleteMapping("") @ApiOperation(value = "删除图片") public void delete(@RequestParam("id") String id) { uploadService.deleteById(id); }
@GetMapping("") @ApiOperation(value = "获取图片") @PermitAll @DisableBaseResponse public void get(@RequestParam("id") String id, HttpServletResponse response) throws Exception { if ("".equals(id)) { return; } Upload upload = uploadMapper.selectById(id); if (upload == null) { throw new Exception("图片不存在"); } byte[] data = upload.getBytes(); response.setContentType("image/jpeg"); response.setCharacterEncoding("UTF-8"); OutputStream outputStream = response.getOutputStream(); InputStream in = new ByteArrayInputStream(data); int len; byte[] buf = new byte[1024];
|
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
| }
@GetMapping("/{id}") @ApiOperation("根据id查询员工") public Worker findById(@PathVariable String id){ return workerService.findById(id); }
@DeleteMapping("/{id}") @ApiOperation("根据id删除员工") public void deleteById(@PathVariable String id){ workerService.deleteById(id); }
@PutMapping("") @ApiOperation("更新员工信息") public void update(@RequestBody Worker worker) throws Exception { workerService.update(worker); }
} package com.movie.api.auth;
public class AuthorizationFilter extends BasicAuthenticationFilter {
public AuthorizationFilter(AuthenticationManager authenticationManager) { super(authenticationManager); }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=501122532008200ri
https://javayms.pages.dev?id=501122532008200ri