package org.springblade.manager.feign;


import org.springblade.core.tool.api.R;
import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
import org.springblade.manager.entity.ContractInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
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;

import static org.springblade.core.launch.constant.AppConstant.APPLICATION_NAME_PREFIX;

@FeignClient(value = APPLICATION_NAME_PREFIX + "manager")
public interface ContractClient {

    /**
     * 接口前缀
     */
    String API_PREFIX = "/api/manager/contract";

    /**
     * 根据ID获取合同段信息
     * @param id 合同段ID
     * @return 结果
     */
    @PostMapping(API_PREFIX + "/getContractById")
    ContractInfo getContractById(@RequestParam Long id);

    /**
     * 根据项目ID获取合同段
     *
     * @param ids ID集合
     * @return 结果集
     */
    @GetMapping(API_PREFIX + "/queryContractListByIds")
    List<ContractInfo> queryContractListByIds(@RequestParam List<Long> ids);


    /**
     * 项目分配用户批量保存-项目合同分配人员
     */
    @PostMapping(API_PREFIX + "/saveUserInfoByProjectTow")
    @Transactional(rollbackFor = Exception.class)
    R saveUserInfoByProjectTow(@RequestBody List<SaveUserInfoByProjectDTO> list);



    /**
     * 项目分配用户批量保存-项目合同分配人员
     */
    @PostMapping(API_PREFIX + "/saveUserInfoByProjectThree")
    @Transactional(rollbackFor = Exception.class)
    R saveUserInfoByProjectThree(@RequestBody List<SaveUserInfoByProjectDTO> list);


}
