package com.dsk.cscec.controller;


import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.domain.R;
import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.DCustomer;
import com.dsk.cscec.domain.bo.CustomerInfoBo;
import com.dsk.cscec.domain.vo.CustomerInfoVo;
import com.dsk.cscec.service.ICustomerInfoService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotEmpty;

/**
 * 供应商相关
 *
 * @author
 * @since 2023-12-10
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/customerInfo")
public class CustomerInfoController extends BaseController {
    /**
     * 服务对象
     */
    private final ICustomerInfoService iCustomerInfoService;


    /**
     * 供应商分类列表
     */
    @PostMapping("/list")
    public TableDataInfo<CustomerInfoVo> list(@Validated @RequestBody CustomerInfoBo bo,@RequestBody PageQuery query) {
        return iCustomerInfoService.queryPageList(bo, query);
    }

    /**
     * 合作记录-供应商准入情况
     */
    @GetMapping("/getByName/{name}")
    public R<DCustomer> list(@NotEmpty(message = "企业名称不能为空") @PathVariable String name) {
        return R.ok(iCustomerInfoService.queryByName(name));
    }

}

