HelpController.java 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package com.chelvc.cloud.admin.controller;
  2. import com.chelvc.cloud.vehicle.api.dto.HelpDTO;
  3. import com.chelvc.cloud.vehicle.api.param.HelpModifyParam;
  4. import com.chelvc.cloud.vehicle.api.param.HelpPagingParam;
  5. import com.chelvc.cloud.vehicle.api.service.IHelpService;
  6. import com.chelvc.framework.base.annotation.ResponseWrapping;
  7. import com.chelvc.framework.common.model.Pagination;
  8. import org.apache.dubbo.config.annotation.DubboReference;
  9. import org.springframework.security.access.prepost.PreAuthorize;
  10. import org.springframework.validation.annotation.Validated;
  11. import org.springframework.web.bind.annotation.GetMapping;
  12. import org.springframework.web.bind.annotation.PathVariable;
  13. import org.springframework.web.bind.annotation.PostMapping;
  14. import org.springframework.web.bind.annotation.PutMapping;
  15. import org.springframework.web.bind.annotation.RequestBody;
  16. import org.springframework.web.bind.annotation.RestController;
  17. import javax.validation.Valid;
  18. import javax.validation.constraints.Min;
  19. /**
  20. * 问题接口
  21. *
  22. * @author liude
  23. * @date 2024/3/4
  24. */
  25. @Validated
  26. @RestController
  27. @ResponseWrapping
  28. @PreAuthorize("isScope('EMPLOYEE')")
  29. public class HelpController {
  30. @DubboReference
  31. private IHelpService helpService;
  32. /**
  33. * 新增问题配置
  34. *
  35. * @param param 新增参数
  36. * @return 问题配置主键
  37. */
  38. @PostMapping("/help")
  39. public void addHelp(@RequestBody @Valid HelpModifyParam param) {
  40. this.helpService.insertHelp(param);
  41. }
  42. /**
  43. * 修改问题配置
  44. *
  45. * @param id 问题配置主键
  46. * @param param 修改参数
  47. */
  48. @PutMapping("/help/{id}")
  49. public void updateHelp(@PathVariable("id") @Min(value = 1, message = "问题配置主键不能小于1") Long id,
  50. @RequestBody @Valid HelpModifyParam param) {
  51. this.helpService.updateHelp(id,param);
  52. }
  53. /**
  54. * 查询问题配置分页
  55. *
  56. * @param param 查询参数
  57. * @return 问题配置分页信息
  58. */
  59. @GetMapping("/help/paging")
  60. public Pagination<HelpDTO> getHelpPaging(@Valid HelpPagingParam param) {
  61. return this.helpService.getHelpPaging(param);
  62. }
  63. /**
  64. * 修改问题配置
  65. *
  66. * @param id 问题配置主键
  67. */
  68. @PutMapping("/help/delete/{id}")
  69. public void deleteHelp(@PathVariable("id") @Min(value = 1, message = "问题配置主键不能小于1") Long id) {
  70. this.helpService.deleteHelpById(id);
  71. }
  72. }