package org.springblade.party.feign;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.party.dto.BranchDTO;
import org.springblade.party.entity.Branch;
import org.springblade.party.vo.BranchVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
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 javax.validation.Valid;
import java.util.List;
import java.util.Map;

/**
 *  Feign
 *
 * @author lianghanqiang
 * @since 2021-03-30
 */
@FeignClient(value = "cyzh-smart-party",path = "/feign/branch")
public interface IBranchClient  {

	/**
	 * 详情
	 */
	@GetMapping("/detail")
    BranchVO detail(@SpringQueryMap Branch branch);

	/**
	 * 查询
	 */
	@GetMapping("/list")
	R<IPage<BranchVO>> list(@RequestParam Map<String,Object> branch, Query query, BladeUser bladeUser);



	/**
	 * 新增
	 */
	@PostMapping("/save")
	boolean save(@Valid @RequestBody Branch branch);

	/**
	 * 修改
	 */
	@PostMapping("/update")
    boolean update(@Valid @RequestBody Branch branch);

	/**
	 * 新增或修改
	 */
//	@PostMapping("/submit")
//    R submit(@Valid @RequestBody Branch branch);


	@PostMapping("/submit")
	R submit(@Valid @RequestBody BranchDTO branch, BladeUser bladeUser);

	/**
	 * 删除
	 */
	@PostMapping("/remove")
    boolean remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids);

	/**
	 * app园区小程序员工获取党支部列表
	 */
	@GetMapping("/app/list")
	R<List<BranchVO>> appList(Long enterpriseStaffId);

	/**
	 * app园区小程序获取园区内的党支部列表
	 */
	@GetMapping("/app/getListForAgency")
	R<List<Branch>> getListForAgency(BladeUser bladeUser);

}
