/*
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2022 . All rights reserved.
*
*/
package net.northking.cctp.scriptcase.api.casedesign;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.northking.cctp.common.http.ResultWrapper;
import net.northking.cctp.scriptcase.api.casedesign.service.AtuProjectEnvApiService;
import net.northking.cctp.scriptcase.dto.casedesign.AtuProjectEnvDetailDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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;

/**
 * 系统用例环境表 => Restful 类型 HTTP/HTTPS 接口
 *
 * @author maven-cctp-plugin
 * @since 1.0
 */
@Api(tags = "系统用例环境表")
@RequestMapping("/v1/AtuProjectEnvs")
@RestController
public class AtuProjectEnvRestfulCtrl
{
  /**
   * 日志
   */
  private final static Logger logger = LoggerFactory.getLogger(AtuProjectEnvRestfulCtrl.class);

  @Autowired
  private AtuProjectEnvApiService apiService;


  /**
   * Restful接口-get： 根据系统id查询用例环境信息
   *
   * @param projectIds       系统id集合
   * @return 接口数据传输对象
   */
  @ApiOperation(value = "环境列表查询")
  @PostMapping(
      consumes = MediaType.APPLICATION_JSON_UTF8_VALUE,
      produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  public ResultWrapper<List<AtuProjectEnvDetailDto>> findByProjectIds(
      @RequestBody List<String> projectIds)
  {
    logger.info("环境列表查询接口开始执行");
    ResultWrapper<List<AtuProjectEnvDetailDto>> wrapper = new ResultWrapper<>();
    List<AtuProjectEnvDetailDto> dto= apiService.findByPK(projectIds);
    logger.info("环境列表查询接口结束执行");
    return wrapper.success(dto);
  }



}
