AddressApi.java 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package com.caimei.controller.auth;
  2. import com.caimei.model.ResponseJson;
  3. import com.caimei.model.vo.AddressSelectVo;
  4. import com.caimei.service.auth.AddressService;
  5. import io.swagger.annotations.Api;
  6. import io.swagger.annotations.ApiImplicitParam;
  7. import io.swagger.annotations.ApiImplicitParams;
  8. import io.swagger.annotations.ApiOperation;
  9. import lombok.RequiredArgsConstructor;
  10. import org.springframework.web.bind.annotation.*;
  11. import java.util.List;
  12. /**
  13. * 地址Api
  14. *
  15. * @author : Aslee
  16. * @date : 2021/7/2
  17. */
  18. @Api(tags = "地址API")
  19. @RestController
  20. @RequiredArgsConstructor
  21. @RequestMapping("/address")
  22. public class AddressApi {
  23. private final AddressService addressService;
  24. /**
  25. * 收货地址下拉选项列表
  26. */
  27. @ApiOperation("收货地址下拉选项列表(旧:/club/province(city)(town))")
  28. @ApiImplicitParams({
  29. @ApiImplicitParam(required = false, name = "type", value = "选项类型:0省(默认),1市,2区"),
  30. @ApiImplicitParam(required = false, name = "parentId", value = "父级地址Id")
  31. })
  32. @GetMapping("/select")
  33. public ResponseJson<List<AddressSelectVo>> getSelectAddress(Integer type, Integer parentId) {
  34. if (null == type) {
  35. type = 0;
  36. } else {
  37. if (null == parentId) {
  38. return ResponseJson.error("父级地址Id不能为空!", null);
  39. }
  40. }
  41. return addressService.getSelectAddress(type, parentId);
  42. }
  43. /**
  44. * 所有地址下拉完整数据
  45. */
  46. @ApiOperation("所有地址完整数据(旧:/club/address)")
  47. @GetMapping("/select/all")
  48. public ResponseJson<List<AddressSelectVo>> getAllSelectAddress() {
  49. return addressService.getAllSelectAddress();
  50. }
  51. }