package thyyxxk.webserver.controller.lc.project;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.config.auth.PassToken;
import thyyxxk.webserver.config.exception.ExceptionEnum;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.lc.company.LcCompany;
import thyyxxk.webserver.entity.lc.company.LcCompanyParam;
import thyyxxk.webserver.entity.lc.project.LcProjectType;
import thyyxxk.webserver.service.lc.project.LcProjectTypeService;
import thyyxxk.webserver.utils.ResultVoUtil;
import thyyxxk.webserver.utils.StringUtil;

import java.util.List;


@RestController
@RequestMapping("/LcProjectType")
public class LcProjectTypeController {

    @Autowired
    private LcProjectTypeService lcProjectTypeService;

    /**
     * 通过id获取项目分类信息
     * @param id
     * @return
     */
    @GetMapping("/getLcProjectTypeById")
    public ResultVo<LcProjectType> getLcProjectTypeById(@RequestParam("id") String id) {
        if (StringUtil.isBlank(id)) {
            return ResultVoUtil.fail(ExceptionEnum.INVALID_PARAM, "id不能为空！");
        }
        return ResultVoUtil.success(lcProjectTypeService.getLcProjectTypeById(id));
    }

    /**
     * 查询所有项目分类
     * @return
     */
    @PostMapping("/getAllLcProjectTypes")
    public ResultVo<List<LcProjectType>> getAllLcProjectTypes() {
        return ResultVoUtil.success(lcProjectTypeService.getAllLcProjectTypes());
    }
}
