package com.lutao.cloud.admin.controller;

import com.lutao.cloud.admin.api.entity.SysCompany;
import com.lutao.cloud.admin.service.SysCompanyService;
import com.lutao.cloud.common.core.util.MessageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 
 *
 * @author guoyc
 * @date 2022-05-30 10:00:45
 */
@RestController
@AllArgsConstructor
@RequestMapping("/sys/company" )
@Api(value = "sys/company", tags = "公司管理")
public class SysCompanyController {

    private final SysCompanyService sysCompanyService;

    /**
     * 通过id查询
     * @param id id
     * @return R
     */
    @ApiOperation(value = "通过id查询", notes = "通过id查询")
    @GetMapping("/{id}" )
    @PreAuthorize("@pms.hasPermission('admin_syscompany_view')" )
    public MessageInfo<SysCompany> getById(@PathVariable("id" ) Integer id){
        return MessageInfo.ok(sysCompanyService.getById(id));
    }

    /**
     * 通过公司名模糊查询
     * @param companyName companyName
     * @return R
     *//*
    @ApiOperation(value = "通过公司名模糊查询", notes = "通过公司名模糊查询")
    @GetMapping("/list" )
//    @PreAuthorize("@pms.hasPermission('admin_syscompany_view')" )
    public MessageInfo<List<SysCompany>> getById(@RequestParam("companyName" ) String companyName){
        return MessageInfo.ok(sysCompanyService.getSysCompanyListByName(companyName));
    }*/


}
