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

import cn.gjing.tools.auth.annotation.RequiredPermissions;
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.constants.BaseDefineDependencyConstants;
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.northking.cctp.common.db.Pagination;
import net.northking.cctp.common.dto.AdvancedQueryOptions;
import net.northking.cctp.common.http.QueryByPage;
import net.northking.cctp.common.http.ResultWrapper;
import net.northking.cctp.scriptcase.api.comLib.service.LibraryBusComInfoApiService;
import net.northking.cctp.scriptcase.dto.comLib.LibraryBusComInfoDetailDto;
import net.northking.cctp.scriptcase.dto.comLib.LibraryBusComInfoQueryDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(tags = "业务组件库组件列表")
@RequestMapping("/v1")
@RestController
public class LibraryBusComInfoQueryCtrl
{
  /**
   * 日志
   */
  private final static Logger logger = LoggerFactory.getLogger(LibraryBusComInfoQueryCtrl.class);

  @Autowired
  private LibraryBusComInfoApiService apiService;

  /**
   * 分页查询 业务组件库组件列表 列表
   *
   * @param queryByPage  查询条件
   * @return 数据列表
   */
  @ApiOperation(value = "分页查询列表：业务组件库组件列表")
  @RequiredPermissions("businessComponent")
  @PostMapping(value = "/paging/query/LibraryBusComInfos",
      produces = MediaType.APPLICATION_JSON_UTF8_VALUE,
      consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
  public ResultWrapper<Pagination<LibraryBusComInfoDetailDto>> pagingQuery(
      @RequestBody @Validated QueryByPage<LibraryBusComInfoQueryDto> queryByPage)
  {
    ResultWrapper<Pagination<LibraryBusComInfoDetailDto>> wrapper = new ResultWrapper<>();
    Pagination<LibraryBusComInfoDetailDto> page = apiService.pagingQuery(queryByPage);

    return wrapper.success(page);
  }

  @ApiOperation(value = "获取高级查询相关配置数据:创建人，更新人，责任人")
  @GetMapping(value = "/LibraryBusComInfos/advancedQueryOptions")
  public ResponseVO<AdvancedQueryOptions> advancedQueryOptions() {
    logger.debug("start advancedQueryOptions");
    ResponseVO<AdvancedQueryOptions> responseVO = new ResponseVO<>();
    AdvancedQueryOptions result = apiService.advancedQueryOptions();
    responseVO.setCode(BaseDefineDependencyConstants.SYSTEM_RESPONSE_CODE_SUCCESS);
    responseVO.setData(result);
    responseVO.setMessage("获取成功");
    logger.debug("end advancedQueryOptions");
    return responseVO;
  }
}


