BaseCountryServeController.java 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package edu.travel.country.web;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import edu.travel.country.entity.BaseCountryServe;
  4. import edu.travel.country.service.BaseCountryServeService;
  5. import edu.travel.dto.BaseCountryServeDto;
  6. import edu.travel.remote.BaseCountryServeRemoteController;
  7. import edu.travel.rpc.RPCBaseResponse;
  8. import edu.travel.vo.BaseCountryServeVo;
  9. import edu.travel.web.BaseController;
  10. import org.springframework.beans.BeanUtils;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.*;
  13. import java.util.List;
  14. /**
  15. * 服务国家表(base_country_serve)表控制层
  16. *
  17. * @author xxxxx
  18. */
  19. @RestController
  20. @RequestMapping("/baseCountryServe")
  21. public class BaseCountryServeController extends BaseController<BaseCountryServe> implements BaseCountryServeRemoteController {
  22. /**
  23. * 服务国家表(base_country_serve)表控制层
  24. *
  25. */
  26. @Autowired
  27. private BaseCountryServeService baseCountryServeService;
  28. /**
  29. * 分页
  30. * @param dto
  31. * @return
  32. */
  33. @GetMapping("/getCountryServePage")
  34. public RPCBaseResponse<IPage<BaseCountryServeVo>> getCountryServePage(BaseCountryServeDto dto) {
  35. return baseCountryServeService.getCountryServePage(dto);
  36. }
  37. /**
  38. * 服务国家树
  39. */
  40. @GetMapping("/getCountryServeTree")
  41. public RPCBaseResponse<List<BaseCountryServeVo>> getCountryServeTree(){
  42. System.out.println("获取服务国家树");
  43. return baseCountryServeService.getCountryServeTree();
  44. }
  45. /**
  46. * 获取服务国家信息
  47. * @param id
  48. * @return
  49. */
  50. @Override
  51. @GetMapping("/getCountryServeFormId")
  52. public RPCBaseResponse<BaseCountryServeVo> getFormId(String id) {
  53. RPCBaseResponse<BaseCountryServe> baseCountryServeRPCBaseResponse = super.getId(id);
  54. RPCBaseResponse<BaseCountryServeVo> baseCountryServeVoPRCBaseResponse = new RPCBaseResponse<>();
  55. BeanUtils.copyProperties(baseCountryServeRPCBaseResponse, baseCountryServeVoPRCBaseResponse);
  56. return baseCountryServeVoPRCBaseResponse;
  57. }
  58. /**
  59. * 更新服务国家信息
  60. * @param entity
  61. * @return
  62. */
  63. @Override
  64. @PostMapping("/updateCountryServeFormId")
  65. public RPCBaseResponse<BaseCountryServeVo> updateTargetFormId(@RequestBody BaseCountryServeDto entity) {
  66. BaseCountryServe baseCountryServe = new BaseCountryServe();
  67. BeanUtils.copyProperties(entity, baseCountryServe);
  68. RPCBaseResponse<BaseCountryServe> baseCountryServeRPCBaseResponse = super.updateTargetById(baseCountryServe);
  69. RPCBaseResponse<BaseCountryServeVo> baseCountryServeVoRPCBaseResponse = new RPCBaseResponse<>();
  70. BeanUtils.copyProperties(baseCountryServeRPCBaseResponse, baseCountryServeVoRPCBaseResponse);
  71. return baseCountryServeVoRPCBaseResponse;
  72. }
  73. /**
  74. * 新增服务国家信息
  75. * @param entity
  76. * @return
  77. */
  78. @Override
  79. @PostMapping("/saveCountryServeForm")
  80. public RPCBaseResponse<BaseCountryServeVo> saveFormTarget(@RequestBody BaseCountryServeDto entity) {
  81. BaseCountryServe baseCountryServe = new BaseCountryServe();
  82. BeanUtils.copyProperties(entity, baseCountryServe);
  83. RPCBaseResponse<BaseCountryServe> baseCountryServeRPCBaseResponse = super.saveTarget(baseCountryServe);
  84. RPCBaseResponse<BaseCountryServeVo> baseCountryServeVoRPCBaseResponse = new RPCBaseResponse<>();
  85. BeanUtils.copyProperties(baseCountryServeRPCBaseResponse, baseCountryServeVoRPCBaseResponse);
  86. return baseCountryServeVoRPCBaseResponse;
  87. }
  88. /**
  89. * 删除服务国家信息
  90. * @param ids
  91. * @return
  92. */
  93. @Override
  94. @PostMapping("/deleteCountryServeFormId")
  95. public RPCBaseResponse<BaseCountryServeVo> deleteTargetFormId(@RequestBody List<String> ids) {
  96. RPCBaseResponse<BaseCountryServe> baseCountryServeRPCBaseResponse = super.deleteTargetById(ids);
  97. RPCBaseResponse<BaseCountryServeVo> baseCountryServeVoRPCBaseResponse = new RPCBaseResponse<>();
  98. BeanUtils.copyProperties(baseCountryServeRPCBaseResponse, baseCountryServeVoRPCBaseResponse);
  99. return baseCountryServeVoRPCBaseResponse;
  100. }
  101. /**
  102. * 获取服务国家列表
  103. * @return
  104. */
  105. @Override
  106. @GetMapping("/listForm")
  107. public RPCBaseResponse<List<BaseCountryServeVo>> getAllForm() {
  108. RPCBaseResponse<List<BaseCountryServe>> listRPCBaseResponse = super.listAll();
  109. RPCBaseResponse<List<BaseCountryServeVo>> baseCountryServeVoRPCBaseResponse = new RPCBaseResponse<>();
  110. BeanUtils.copyProperties(listRPCBaseResponse, baseCountryServeVoRPCBaseResponse);
  111. return baseCountryServeVoRPCBaseResponse;
  112. }
  113. }