package com.muyu.system.controller;

import com.muyu.common.core.domain.Result;
import com.muyu.common.system.domain.Firm;
import com.muyu.system.service.FirmService;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 企业信息控制层
 * @Author：weiran
 * @Package：com.muyu.system.controller
 * @Project：cloud-server-8
 * @name：FirmController
 * @Date：2024/9/25 22:18
 */
@RestController
@RequestMapping("/firm")
@AllArgsConstructor
public class FirmController {

    private final FirmService firmService;

    /**
     * 根据企业名称查询企业信息
     * @return
     */
    @RequestMapping("/selectAll")
    public Result<List<Firm>> selectAll(){
        List<Firm> firmList = firmService.selectAll();
        return Result.success(firmList);
    }

    /**
     * 根据企业名称查询企业信息
     * @param firmName
     * @return
     */
    @RequestMapping("/findByFirmName/{firmName}")
    public Result<Firm> findByFirmName(@PathVariable("firmName") String firmName){
        Firm firmServiceByFirmName = firmService.findByFirmName(firmName);
        return Result.success(firmServiceByFirmName);
    }



}
