package com.zhgd.xmgl.modules.basicdata.controller.project;

import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.basicdata.entity.Enterprise;
import com.zhgd.xmgl.modules.basicdata.entity.EnterpriseMain;
import com.zhgd.xmgl.modules.basicdata.service.IEnterpriseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * @Title: Controller
 * @Description: 企业信息
 * @author： pds
 * @date： 2023-02-15
 * @version： V1.0
 */
@RestController
@RequestMapping("/project/enterprise")
@Slf4j
@Api(tags = "企业信息")
public class EnterpriseController {
    @Autowired
    private IEnterpriseService enterpriseService;

    /**
     * 列表查询相对应资质的企业
     *
     * @return
     */
    @OperLog(operModul = "企业管理", operType = "列表查询", operDesc = "列表查询相对应资质的企业")
    @ApiOperation(value = "列表查询相对应资质的企业", notes = "列表查询相对应资质的企业", httpMethod = "POST")
    @ApiImplicitParam(name = "mainType", value = "企业主体类型(1:建设;2:监理;3:施工;4:勘察;5:设计;)", paramType = "query", required = true, dataType = "Integer")
    @PostMapping(value = "/listByMainType")
    public Result<List<Enterprise>> listByMainType(@RequestBody EnterpriseMain enterpriseMain) {
        Result<List<Enterprise>> result = new Result<List<Enterprise>>();
        List<Enterprise> enterpriseList = enterpriseService.listByMainType(enterpriseMain.getMainType());
        result.setResult(enterpriseList);
        result.setSuccess(true);
        return result;
    }
}
