package com.sckw.address.controller;

import com.sckw.address.entity.vo.req.KwBusinessAddressTypeInsertParam;
import com.sckw.address.service.KwBusinessAddressTypeService;
import com.sckw.core.web.response.HttpResult;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @desc: 地址类型
 * @author: Lt
 * @date: 2024-04-12
 */
@Validated
@RestController
@RequestMapping(value = "/addressType")
public class AddressTypeController {

    @Autowired
    KwBusinessAddressTypeService kwBusinessAddressTypeService;

    /**
    * @Description: 地址类型新增
    * @Author: Lt
    * @Date: 2024/4/12 8:58
    */
    @PostMapping(value = "/addressTypeInsert")
    public HttpResult addressTypeInsert(@RequestBody @Valid KwBusinessAddressTypeInsertParam kwBusinessAddressTypeInsertParam)
    {
        return kwBusinessAddressTypeService.addressTypeInsert(kwBusinessAddressTypeInsertParam);
    }

    /**
     * @Description: 地址类型编辑
     * @Author: Lt
     * @Date: 2024/4/12 8:58
     */
    @PostMapping(value = "/addressTypeUpdate")
    public HttpResult addressTypeUpdate(@RequestBody @Valid KwBusinessAddressTypeInsertParam kwBusinessAddressTypeInsertParam)
    {
        return kwBusinessAddressTypeService.addressTypeUpdate(kwBusinessAddressTypeInsertParam);
    }

    /**
     * @Description: 地址类型删除
     * @Author: Lt
     * @Date: 2024/4/12 8:58
     */
    @PostMapping(value = "/delete")
    public HttpResult addressTypeDelete(@RequestParam(value = "id", required = false) String id)
    {
        return kwBusinessAddressTypeService.addressTypeDelete(id);
    }

    /**
     * @Description: 地址List
     * @Author: Lt
     * @Date: 2024/4/11 16:51
     */
    @PostMapping(value = "/list")
    public HttpResult list(@RequestParam(value = "name", required = false) String name)
    {
        return HttpResult.ok(kwBusinessAddressTypeService.selectList(name));
    }





}
