package com.sptg.estate.biz.controller;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.sptg.common.core.beans.ResultBean;
import com.sptg.estate.api.entity.MemberAndUser;
import com.sptg.estate.api.feigns.MemberAndUserFeign;
import com.sptg.estate.biz.service.MemberAndUserInterface;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * title: MemberController
 * package: com.sptg.estate.biz.consumer
 * description: 会员与住户关系 - 控制器
 *
 *               
 *                
 */
@RestController
public class MemberAndUserController implements MemberAndUserFeign {

    private final MemberAndUserInterface memberAndUserInterface;

    public MemberAndUserController(
            MemberAndUserInterface memberAndUserInterface
    ) {
        this.memberAndUserInterface = memberAndUserInterface;
    }

    @Override
    @PostMapping(value = "/memberAndUser/getByCondition")
    public List<MemberAndUser> getByCondition(@RequestBody MemberAndUser memberAndUser) {
        return this.memberAndUserInterface.getByCondition(memberAndUser);
    }

    @Override
    @PostMapping(value = "/memberAndUser/checkRelationship")
    public ResultBean<Boolean> checkRelationship(@RequestBody MemberAndUser memberAndUser) {
        return this.memberAndUserInterface.checkRelationship(memberAndUser);
    }

    @Override

    public boolean addEntity(MemberAndUser memberAndUser) {
        return this.memberAndUserInterface.insert(memberAndUser);
    }

    @Override
    @GetMapping(value = "/getListByMemberId")
    public List<MemberAndUser> getListByMemberId(@RequestParam(value = "memberId") Long memberId) {
        return this.memberAndUserInterface.getListByMemberId(memberId);
    }

    @Override
    @PostMapping(value = "/deleteMemberAndUser")
    public boolean deleteMemberAndUser(@RequestBody MemberAndUser memberAndUser) {
        return this.memberAndUserInterface.deleteMemberAndUser(memberAndUser);
    }
}
