package com.persagy.dmp.define.client;

import com.persagy.dmp.basic.config.DigitalFeignConfig;
import com.persagy.dmp.basic.dto.DefineRequestData;
import com.persagy.dmp.basic.model.QueryCriteria;
import com.persagy.dmp.common.model.response.CommonResult;
import com.persagy.dmp.define.entity.DigitalEquipClassRel;
import com.persagy.dmp.define.entity.ObjectTypeDefine;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 文件管理Client
 * @author Charlie Yu
 * @date 2021-05-15
 */
@FeignClient(name = "dmp-rwd", configuration = DigitalFeignConfig.class,
        url = "${persagy.bdtp.rwd.service:}",path = "/rwd/def/equipClassRel")
public interface DigitalEquipClassRelClient {

    /**
     * 查询项目对象类型关系
     * @param groupCode 集团编码
     * @param projectId 项目ID
     * @param appId 应用ID
     * @param userId 用户ID
     * @param criteria 查询条件
     * @return 项目对象类型关系
     */
    @PostMapping("query")
    CommonResult<List<DigitalEquipClassRel>> query(
            @RequestParam("groupCode") String groupCode,
            @RequestParam("projectId") String projectId,
            @RequestParam("appId") String appId,
            @RequestParam("userId") String userId,
            @RequestBody QueryCriteria criteria);

    /**
     * 新增项目对象类型关系-批量新增
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param voList: 新增项目对象类型关系对象数组
     * @return 项目对象类型关系对象数组
     */
    @PostMapping("create")
    CommonResult<List<DigitalEquipClassRel>> createBatch(@RequestParam("groupCode") String groupCode,
                                                         @RequestParam("projectId") String projectId,
                                                         @RequestParam("appId") String appId,
                                                         @RequestParam("userId") String userId,
                                                         @RequestBody List<DigitalEquipClassRel> voList);
    /**
     * 根据关系名称批量查询项目对象类型关系
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param requestData: 请求参数
     * @return 项目对象类型关系对象数组
     */
    @PostMapping("queryListByRelNames")
    CommonResult<List<DigitalEquipClassRel>> queryListByRelNames(@RequestParam("groupCode") String groupCode,
                                                         @RequestParam("projectId") String projectId,
                                                         @RequestParam("appId") String appId,
                                                         @RequestParam("userId") String userId,
                                                         @RequestBody DefineRequestData requestData);
}
