package com.yuchen.saas.park.service.controller.basic;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yuchen.saas.park.api.dto.park.PmgBatParkCompanyRentDto;
import com.yuchen.saas.park.api.vo.park.PmgBatParkCompanyRentVo;
import com.yuchen.saas.park.service.service.IPmgBatParkCompanyRentService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nest.springwrap.core.mp.support.Query;
import org.nest.springwrap.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

/**
 * <p>
 * 人员中心+-企业租客-企业租客 前端控制器
 * </p>
 *
 * @author baichaojie
 * @since 2024-11-05
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@RequestMapping("/pmgBatParkCompany")
public class PmgBatParkCompanyRentController {

    private final IPmgBatParkCompanyRentService baseService;


    /**
     * 人员中心+-企业租客-企业租客 列表查询
     *
     * @param pmgBatParkCompanyRentDto
     * @param query
     * @return
     */
    @GetMapping("/pageByParam")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "人员中心+-企业租客-企业租客  列表查询", notes = "人员中心+-企业租客-企业租客  列表查询")
    public R<IPage<PmgBatParkCompanyRentVo>> pageByParam(@Valid PmgBatParkCompanyRentDto pmgBatParkCompanyRentDto, Query query) {
        R<IPage<PmgBatParkCompanyRentVo>> pages = baseService.getList(pmgBatParkCompanyRentDto, query);
        return pages;
    }


    /**
     * 人员中心+-企业租客-企业租客 新增或修改
     *
     * @param req
     * @return
     */
    @PostMapping("/saveOrUpdate")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "人员中心+-企业租客-企业租客  新增或修改", notes = "人员中心+-企业租客-企业租客  新增或修改")
    public R saveOrUpdate(@Valid @RequestBody PmgBatParkCompanyRentDto req) {
        return R.data(baseService.saveOrUpdateByParam(req));
    }


    /**
     * 人员中心+-企业租客-企业租客  删除
     *
     * @param pmgBatParkCompanyRentDto
     * @return
     */
    @PostMapping("/removeId")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "人员中心+-企业租客-企业租客  删除", notes = "人员中心+-企业租客-企业租客  删除")
    public R removeId(@RequestBody PmgBatParkCompanyRentDto pmgBatParkCompanyRentDto) {
        return R.data(baseService.removeById(pmgBatParkCompanyRentDto.getId()));
    }


    /**
     * 人员中心+-企业租客-企业租客  导出
     *
     * @param reqDTO
     * @param response
     * @tag
     */
    @PostMapping("/export")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "人员中心+-企业租客-企业租客 导出", notes = "人员中心+-企业租客-企业租客 导出")
    public void export(@RequestBody PmgBatParkCompanyRentDto reqDTO, HttpServletResponse response) {
        baseService.export(reqDTO, response);
    }

}