feat(customer):新增查询地址信息的内部接口

This commit is contained in:
JIAN
2024-09-02 22:20:18 +08:00
parent c2d0d9b647
commit 2781689e77
2 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
package com.jzo2o.api.customer;
import com.jzo2o.api.customer.dto.response.AddressBookResDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
* 内部接口 - 地址簿相关接口
* @author JIAN
*/
@FeignClient(contextId = "jzo2o-customer", value = "jzo2o-customer", path = "/customer/inner/address-book")
public interface AddressBookApi {
/**
* 获取指定id对应的地址信息
*/
@GetMapping("/{id}")
AddressBookResDTO getById(@PathVariable Long id);
}

View File

@@ -0,0 +1,34 @@
package com.jzo2o.customer.controller.inner;
import com.jzo2o.api.customer.AddressBookApi;
import com.jzo2o.api.customer.dto.response.AddressBookResDTO;
import com.jzo2o.common.utils.BeanUtils;
import com.jzo2o.customer.service.IAddressBookService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* 内部接口 - 地址簿相关接口
* @author JIAN
*/
@RestController
@RequestMapping("/inner/address-book")
@Api(tags = "内部接口 - 地址簿相关接口")
public class InnerAddressBookController implements AddressBookApi {
@Resource
private IAddressBookService addressBookService;
/**
* 获取指定id对应的地址信息
*/
@Override
@GetMapping("/{id}")
public AddressBookResDTO getById(@PathVariable Long id) {
return BeanUtils.toBean(addressBookService.getById(id), AddressBookResDTO.class);
}
}