package com.muyu.enterprise.controller;

import com.muyu.enterprise.domain.CarCompany;
import com.muyu.enterprise.service.CarCompanyService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 车辆企业--控制层
 * @ClassName CarCompanyController
 * @Description 车辆企业 Controller 层
 * @author  MingWei.Zong
 * @Date 2024/9/28 16:52
 */
@RestController
@RequestMapping("/company")
@Tag(name = "CarCompanyController", description = "企业表")
public class CarCompanyController extends BaseController {

    @Autowired
    private CarCompanyService sysCarCompanyService;

    /**
     * 查询企业表
     */
    @PostMapping("selectCompany")
    public Result<List<CarCompany>> selectCompany(){
        return Result.success(sysCarCompanyService.list());
    }

    /**
     * 通过ID查询企业
     */
    @PostMapping("selectCompanyByCompanyId")
    public Result<CarCompany> selectCompanyByCompanyId(@RequestParam("companyId") Long companyId){
        return Result.success(sysCarCompanyService.getById(companyId));
    }

}
