package com.microservices.pms.repository.controller;

import com.alibaba.fastjson2.JSONObject;
import com.microservices.common.core.web.controller.BaseController;
import com.microservices.common.core.web.page.GenericsTableDataInfo;
import com.microservices.common.security.annotation.RequiresPermissions;
import com.microservices.pms.repository.domain.PmsRepositorySearchVo;
import com.microservices.pms.repository.service.IPmsRepositoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 代码块功能Controller
 *
 * @author otto
 * @date 2023-11-07
 */
@RestController
@RequestMapping("/{enterpriseIdentifier}/pmsRepository")
@Api(tags = "项目管理-代码库相关接口")
@ApiImplicitParams({
        @ApiImplicitParam(name = "enterpriseIdentifier", value = "企业标识", paramType = "path", dataType = "String")
})
public class PmsRepositoryController extends BaseController {
    @Autowired
    private IPmsRepositoryService pmsRepositoryService;

    /**
     * 查询代码库列表
     */
    @RequiresPermissions("pms:pmsRepository:show")
    @GetMapping("/list")
    @ApiOperation(value = "查询代码库列表(url为仓库访问地址)")
    public GenericsTableDataInfo<JSONObject> list(@Validated PmsRepositorySearchVo pmsRepositorySearchVo) {
        return pmsRepositoryService.selectGitlinkProjectList(pmsRepositorySearchVo);
    }
}
