ServiceUpTipController.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. package com.fdkankan.manage.controller;
  2. import cn.dev33.satoken.stp.StpUtil;
  3. import com.fdkankan.manage.common.ResultCode;
  4. import com.fdkankan.manage.common.ResultData;
  5. import com.fdkankan.manage.entity.ServiceUpTip;
  6. import com.fdkankan.manage.exception.BusinessException;
  7. import com.fdkankan.manage.service.IServiceUpTipService;
  8. import com.fdkankan.manage.vo.request.ServiceUPTipParam;
  9. import org.springframework.beans.factory.annotation.Autowired;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.RequestBody;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. /**
  15. * <p>
  16. * 前端控制器
  17. * </p>
  18. *
  19. * @author
  20. * @since 2023-04-03
  21. */
  22. @RestController
  23. @RequestMapping("/service/manage/serviceUpTip")
  24. public class ServiceUpTipController extends BaseController{
  25. @Autowired
  26. IServiceUpTipService serviceUpTipService;
  27. @PostMapping("/list")
  28. public ResultData list(@RequestBody ServiceUPTipParam param){
  29. if(param.getType() == null){
  30. throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
  31. }
  32. return ResultData.ok(serviceUpTipService.pageList(param));
  33. }
  34. @PostMapping("/saveOrUpdate")
  35. public ResultData saveOrUpdate(@RequestBody ServiceUpTip param){
  36. if(param.getId() != null){
  37. ServiceUpTip entity = serviceUpTipService.getById(param.getId());
  38. param.setType(entity.getType());
  39. }
  40. param.setCreateTime(null);
  41. param.setUpdateTime(null);
  42. param.setSysUserId(Long.valueOf((String)StpUtil.getLoginId()));
  43. if(param.getBanStatus() !=null && param.getBanStatus() == 0){
  44. serviceUpTipService.banOther(param.getType());
  45. }
  46. serviceUpTipService.saveOrUpdate(param);
  47. return ResultData.ok();
  48. }
  49. @PostMapping("/delete")
  50. public ResultData delete(@RequestBody ServiceUpTip param){
  51. if(param.getId() == null){
  52. throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
  53. }
  54. serviceUpTipService.removeById(param.getId());
  55. return ResultData.ok();
  56. }
  57. }