package com.wansenai.api.support;

import com.wansenai.dto.support.BasAddressDto;
import com.wansenai.service.support.BasAddressService;
import com.wansenai.utils.response.Response;
import com.wansenai.vo.support.BasAddressVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * <p>地址档案</p>
 * @author clunt
 */
@RestController
@RequestMapping("basAddress")
@Tag(name = "地址档案", description = "地址档案")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class BasAddressController {

    private final BasAddressService basAddressService;

    @PostMapping("addOrUpdate")
    @Operation(summary = "新增or更新地址", description = "新增or更新地址")
    public Response<String> addOrUpdate(@RequestBody BasAddressDto basAddressDto) {
        return Response.responseData(basAddressService.addOrUpdate(basAddressDto));
    }

    @GetMapping("getDetail")
    @Operation(summary = "详情查询", description = "详情查询")
    public Response<BasAddressVo> getDetail(@RequestParam(value = "id") Long id){
        return Response.responseData(basAddressService.getDetail(id));
    }

}
