package net.northking.cctp.scriptcase.pub.workbench;

import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.constants.BaseDefineDependencyConstants;
import com.hzbank.testteam.autotest.dependencies.baseDefineDependency.vo.ResponseVO;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.northking.cctp.scriptcase.pub.workbench.service.WorkbenchDataService;
import net.northking.cctp.scriptcase.pub.workbench.vo.WorkbenchUIScriptNumVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Slf4j
@RestController
@RequestMapping("/pub")
public class WorkbenchDataPub {

    @Resource
    private WorkbenchDataService workbenchDataService;

    /**
     * 根据用户id, 查询用户负责脚本信息
     * @param principalId 脚本id集合
     * @return 结果集
     */
    @ApiOperation(value = "根据用户id, 查询用户负责脚本信息")
    @GetMapping(value = "/getScriptNumByPrincipalId")
    ResponseVO<WorkbenchUIScriptNumVO> getScriptNumByPrincipalId(@RequestParam(name = "principalId") String principalId){
        ResponseVO<WorkbenchUIScriptNumVO> responseVO = new ResponseVO<WorkbenchUIScriptNumVO>();

        WorkbenchUIScriptNumVO workbenchUIScriptNumVO = workbenchDataService.getScriptNumByPrincipalId(principalId);
        responseVO.setData(workbenchUIScriptNumVO);
        responseVO.setMessage("获取数据成功");
        responseVO.setCode(BaseDefineDependencyConstants.SYSTEM_RESPONSE_CODE_SUCCESS);


        return responseVO;
    }

}
