package com.persagy.dmp.migrate.client;

import com.persagy.dmp.basic.config.DigitalFeignConfig;
import com.persagy.dmp.basic.model.QueryCriteria;
import com.persagy.dmp.common.model.response.CommonResult;
import com.persagy.dmp.rwd.migrate.entity.SyncData;
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;

/**
 * @author lvxianyun
 * @title: DigitalMigrateLogClient
 * @projectName digital-twin
 * @description:
 * @date 2021/12/20 19:05
 */
@FeignClient(name = "dmp-rwd", configuration = DigitalFeignConfig.class,
        url = "${persagy.bdtp.rwd.service:}",path = "/log/migrate/")
public interface DigitalMigrateLogClient {

    /**
     * 查询数据迁移日志
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param criteria: 查询条件
     * @return 对象数组
     */
    @PostMapping("query")
    CommonResult<List<SyncData>> 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 nodes: 新增对象集合
     * @return 对象数组
     */
    @PostMapping("create")
    CommonResult<List<SyncData>> create(@RequestParam("groupCode") String groupCode,
                                             @RequestParam("projectId") String projectId,
                                             @RequestParam("appId") String appId,
                                             @RequestParam("userId") String userId,
                                             @RequestBody List<SyncData> nodes);

    /**
     * 新增数据迁移日志-根据条件删除
     * @param groupCode: 集团编码
     * @param projectId: 项目ID
     * @param appId: 应用ID
     * @param userId: 用户ID
     * @param criteria: 条件
     * @return
     */
    @PostMapping("/deleteAllLog")
    CommonResult deleteAllLog(@RequestParam("groupCode") String groupCode,
                                     @RequestParam("projectId") String projectId,
                                     @RequestParam("appId") String appId,
                                     @RequestParam("userId") String userId,
                                     @RequestBody QueryCriteria criteria) ;
}
