HotelOderRefundController.java 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package com.chuanghai.ihotel.controller;
  2. import java.util.Arrays;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.web.bind.annotation.DeleteMapping;
  5. import org.springframework.web.bind.annotation.PathVariable;
  6. import org.springframework.web.bind.annotation.PostMapping;
  7. import org.springframework.web.bind.annotation.PutMapping;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.GetMapping;
  11. import org.springframework.web.bind.annotation.RestController;
  12. import com.chuanghai.ihotel.entity.HotelOderRefundEntity;
  13. import com.chuanghai.ihotel.service.HotelOderRefundService;
  14. import com.chuanghai.ihotel.common.utils.PageUtils;
  15. import com.chuanghai.ihotel.common.utils.CommonResult;
  16. import com.chuanghai.ihotel.common.utils.PageParam;
  17. /**
  18. * 订单退款表
  19. *
  20. * @author codingliang
  21. * @email codingliang@gmail.com
  22. * @date 2022-07-27 10:02:04
  23. */
  24. @RestController
  25. @RequestMapping("hotelOderRefund")
  26. public class HotelOderRefundController {
  27. @Autowired
  28. private HotelOderRefundService hotelOderRefundService;
  29. /**
  30. * 列表
  31. */
  32. @GetMapping("/list")
  33. public CommonResult<PageUtils<HotelOderRefundEntity>> list(PageParam pageParam){
  34. PageUtils page = hotelOderRefundService.queryPage(pageParam);
  35. return CommonResult.ok().setResult(page);
  36. }
  37. /**
  38. * 信息
  39. */
  40. @GetMapping("/info/{id}")
  41. public CommonResult<HotelOderRefundEntity> info(@PathVariable("id") Long id){
  42. HotelOderRefundEntity hotelOderRefund = hotelOderRefundService.getById(id);
  43. return CommonResult.ok().setResult(hotelOderRefund);
  44. }
  45. /**
  46. * 保存
  47. */
  48. @PostMapping("/save")
  49. public CommonResult<String> save(@RequestBody HotelOderRefundEntity hotelOderRefund){
  50. hotelOderRefundService.save(hotelOderRefund);
  51. return CommonResult.ok();
  52. }
  53. /**
  54. * 修改
  55. */
  56. @PutMapping("/update")
  57. public CommonResult<String> update(@RequestBody HotelOderRefundEntity hotelOderRefund){
  58. boolean flag = hotelOderRefundService.updateById(hotelOderRefund);
  59. if (flag) {
  60. return CommonResult.ok();
  61. } else {
  62. return CommonResult.fail();
  63. }
  64. }
  65. /**
  66. * 删除
  67. */
  68. @DeleteMapping("/delete")
  69. public CommonResult<String> delete(@RequestBody Long[] ids){
  70. boolean flag = hotelOderRefundService.removeByIds(Arrays.asList(ids));
  71. if (flag) {
  72. return CommonResult.ok();
  73. } else {
  74. return CommonResult.fail();
  75. }
  76. }
  77. }