package com.cusc.nirvana.user.rnr.fp.controller;

import com.cusc.nirvana.common.result.Response;
import com.cusc.nirvana.user.rnr.fp.dto.FpRnrRelationInfoDTO;
import com.cusc.nirvana.user.rnr.fp.service.IFpRnrRelationInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 实名关联信息(FpRnrRelationInfo)表控制层
 *
 * @author yuy336
 * @since 2022-04-14 20:43:07
 */
@RestController
@RequestMapping("/fpRnrRelationInfo")
public class FpRnrRelationInfoController {
    /**
     * 服务对象
     */
    @Autowired
    private IFpRnrRelationInfoService fpRnrRelationInfoService;

    /**
     * 通过主键查询单条数据
     *
     * @param bean 实体
     * @return 单条数据
     */
   @PostMapping("/getByUuid")
    public Response<FpRnrRelationInfoDTO> getByUuid(@RequestBody FpRnrRelationInfoDTO bean) {
        return Response.createSuccess(fpRnrRelationInfoService.getByUuid(bean));
    }
    
     /**
     * 通过主键查询单条数据
     *
     * @param bean 实体
     * @return 单条数据
     */
   @PostMapping("/queryByList")
    public Response<List<FpRnrRelationInfoDTO>> queryByList(@RequestBody FpRnrRelationInfoDTO bean) {
        return Response.createSuccess(fpRnrRelationInfoService.queryByList(bean));
    }

    /**
     * 新增数据
     *
     * @param bean 实体
     * @return 新增结果
     */
    @PostMapping("/add")
    public Response add(@RequestBody FpRnrRelationInfoDTO bean) {
       return Response.createSuccess(fpRnrRelationInfoService.insert(bean));
    }

    /**
     * 编辑数据
     *
     * @param bean 实体
     * @return 编辑结果
     */
    @PostMapping("/update")
    public Response update(@RequestBody FpRnrRelationInfoDTO bean) {
        return Response.createSuccess(fpRnrRelationInfoService.update(bean));
    }

    /**
     * 删除数据
     *
     * @param bean 实体
     * @return 删除是否成功
     */
    @PostMapping("/deleteById")
    public Response<Boolean> deleteById(@RequestBody FpRnrRelationInfoDTO bean) {
        return Response.createSuccess(fpRnrRelationInfoService.deleteById(bean));
    }

    /**
     * 通过用户id查询数据
     *
     * @param bean 实体
     * @return 数据
     */
    @PostMapping("/getByUserId")
    public Response getByIdUserId(@RequestBody FpRnrRelationInfoDTO bean) {
        return Response.createSuccess(fpRnrRelationInfoService.queryByUserId(bean));
    }

    /*@PostMapping("/bindByUserId")
    public Response bindByUserId(@RequestBody BindUserInfoDTO bean){
        //return Response.createSuccess(fpRnrRelationInfoService.bindByUserId(bean));
        return Response.createSuccess(true);
    }*/


    @PostMapping("/bindByUserId")
    public Response disableBindByUserId(@RequestBody FpRnrRelationInfoDTO bean){
        return Response.createSuccess(fpRnrRelationInfoService.disableBindByUserId(bean));
    }

}

