package org.springblade.person.feign;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.plugins.Page;
import io.swagger.annotations.ApiParam;
import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.person.dto.HouseUserDTO;
import org.springblade.person.dto.MemberDTO;
import org.springblade.person.entity.HouseUser;
import org.springblade.person.vo.HouseUserVO;
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-04-14
 */
@FeignClient(value = "cyzh-person",path = "/feign/houseuser")
public interface IHouseUserClient {


	@PostMapping("logout")
	Boolean logout(@RequestParam Long memberId);
	/**
	 * 详情
	 */
	@GetMapping("/detail")
    HouseUserVO detail(@SpringQueryMap HouseUser houseUser);

	/**
	 * 查询
	 */
	@GetMapping("/list")
    List<HouseUserVO> list(@SpringQueryMap HouseUser houseUser);

	/**
	 * 查询
	 */
	@PostMapping("/listInRoomIds")
	List<HouseUser> listInRoomIds(@RequestBody List<Long> roomIds);
	/**
	 * 查询
	 */
	@GetMapping("/listMap")
	List<HouseUserVO> listMap(@RequestParam Map<String,Object> houseUser);

	/**
	 * 查询
	 */
	@PostMapping("/getListByUserIds")
	List<HouseUserVO> getListByUserIds(@RequestParam List<Long> userIds);

	/**
	 * 根据房间id集合查询住户列表
	 */
	@PostMapping("/getPageByRoomIds")
	Page<HouseUserVO> getPageByRoomIds(@RequestParam List<Long> roomIds, @RequestBody Query query);



	/**
	 * 新增
	 */
	@PostMapping("/save")
	boolean save(@Valid @RequestBody HouseUser houseUser);

	/**
	 * 修改
	 */
	@PostMapping("/update")
    boolean update(@Valid @RequestBody HouseUser houseUser);

	/**
	 * 新增或修改
	 */
	@PostMapping("/submit")
    boolean submit(@Valid @RequestBody HouseUser houseUser);


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

	/**
	 * 删除user，而且删除与会员的关系，修改会员的状态
	 */
	@PostMapping("/deleteUserAndRelationship")
	boolean deleteUserAndRelationship(@RequestBody HouseUserDTO userDto);

	@GetMapping("/getById")
	HouseUser getById(@RequestParam Long id);

	/**
	 * 新增
	 */
	@PostMapping("/applySave")
	R<HouseUser> applySave(@Valid @RequestBody HouseUser houseUser);

	/***
	 * 住户数量
	 * @param houseUser
	 * @return
	 */
	@PostMapping("/houseUserCount")
	Integer houseUserCount(@RequestBody HouseUser houseUser);

	/***
	 * 【web端 人脸权限】获取常住人员人脸权限已下发的数量
	 * @param ids
	 * @return
	 */
	@PostMapping("/yxfCount")
	Integer yxfCount(@RequestBody List<Long> ids);

	/**
	 * 数量统计
	 * @param houseUser
	 * @return
	 */
	@PostMapping("/count")
	int count(@Valid @RequestBody HouseUser houseUser);

	@GetMapping("/getListByMember")
	List<HouseUserVO> getListByMember(@RequestParam(value = "memberId") Long memberId, @RequestParam(value = "residentialId", required = false) Long residentialId, @RequestParam(value = "roomId") Long roomId);

	@PostMapping("/getPageByMember")
	R<BladePage<HouseUserVO>> getPageByMember(@RequestBody MemberDTO memberDTO);

	@PostMapping("/updateUserByIds")
    Boolean updateUserByIds(@RequestBody List<Long> ids,@RequestParam String memberId);
}
