PushProjectController.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package com.chuanghai.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.chuanghai.entity.PushProject;
  4. import com.chuanghai.service.PushProjectService;
  5. import com.chuanghai.utils.CommonResult;
  6. import com.chuanghai.vo.PushProjectVO;
  7. import org.apache.ibatis.annotations.Param;
  8. import org.springframework.beans.BeanUtils;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.*;
  11. import sun.awt.image.VolatileSurfaceManager;
  12. import java.util.List;
  13. /**
  14. * 推送项目设置
  15. *
  16. * @Author: binguo
  17. * @Date: 2022/12/28 星期三 10:48
  18. * @Description: 推送项目设置
  19. * @Version: 1.0
  20. */
  21. @RestController
  22. @RequestMapping("/push")
  23. public class PushProjectController {
  24. @Autowired
  25. private PushProjectService pushProjectService;
  26. // @PostMapping("jjjj")
  27. // public void ss(){
  28. // System.out.println("11111");
  29. // }
  30. /**
  31. * 查询推送项目
  32. * @return
  33. */
  34. @GetMapping("queryPushProject")
  35. public CommonResult queryPushProject() {
  36. QueryWrapper<PushProject> wrapper = new QueryWrapper<>();
  37. wrapper.eq("statu", "0");
  38. List<PushProject> pushProjectList = pushProjectService.list(wrapper);
  39. return CommonResult.ok().setResult(pushProjectList);
  40. }
  41. /**
  42. * 添加推送项目
  43. * @param url 推送服务接口:post请求 json参数
  44. * @param project 服务名称
  45. * @return
  46. */
  47. @PostMapping("addPushProject")
  48. public CommonResult addPushProject(@Param("url") String url, @Param("project") String project) {
  49. pushProjectService.addPushProject(url, project);
  50. return CommonResult.ok();
  51. }
  52. /**
  53. * 修改推送项目
  54. * @param pushProjectVo
  55. * @return
  56. */
  57. @PutMapping("updatePushProject")
  58. public CommonResult updatePushProject(@RequestBody PushProjectVO pushProjectVo){
  59. PushProject pushProject = new PushProject();
  60. BeanUtils.copyProperties(pushProjectVo, pushProject);
  61. pushProjectService.updateById(pushProject);
  62. return CommonResult.ok();
  63. }
  64. /**
  65. * 删除推送项目
  66. * @param id
  67. * @return
  68. */
  69. @DeleteMapping("deletePushProject")
  70. public CommonResult deletePushProject(Long id){
  71. pushProjectService.deletePushProject(id);
  72. return CommonResult.ok();
  73. }
  74. }