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

import com.cusc.nirvana.common.result.PageResult;
import com.cusc.nirvana.common.result.Response;
import com.cusc.nirvana.user.rnr.fp.dto.FpRnrProtocolManageDTO;
import com.cusc.nirvana.user.rnr.fp.service.IFpRnrProtocolManageService;
import io.swagger.annotations.ApiOperation;
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;

/**
 * (FpRnrProtocolManage)表控制层
 *
 * @author yuy336
 * @since 2022-06-01 10:52:44
 */
@RestController
@RequestMapping("/fpRnrProtocolManage")
public class FpRnrProtocolManageController {
    /**
     * 服务对象
     */
    @Autowired
    private IFpRnrProtocolManageService fpRnrProtocolManageService;

    /**
     * 分页查询
     *
     * @param bean 筛选条件
     * @return 查询结果
     */
    @PostMapping("/queryByPage")
    @ApiOperation(value = "分页查询", notes = "分页查询")
    public Response<PageResult<FpRnrProtocolManageDTO>> queryByPage(@RequestBody FpRnrProtocolManageDTO bean) {
        return Response.createSuccess(fpRnrProtocolManageService.queryByPage(bean));
    }

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

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

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

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

}

