package com.css.txw.gxzx.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.css.ggzc.framework.common.pojo.CommonResult;
import com.css.txw.gxzx.pojo.vo.*;
import com.css.txw.gxzx.service.TxwGxzxGxscbService;
import com.css.txw.gxzx.service.TxwGxzxGxxxbService;
import com.css.txw.gxzx.service.TxwGxzxShqkbService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/gxdt")
@Tag(name = "供需大厅")
@Validated
public class GxdtController {

    @Resource
    private TxwGxzxGxxxbService gxxxbService;

    @Resource
    private TxwGxzxShqkbService shqkbService;

    @Resource
    private TxwGxzxGxscbService gxscbService;

    @PostMapping("/gxfb")
    public CommonResult<String> gxfb(@RequestBody GxfbReqVO reqVO){
        return CommonResult.success(gxxxbService.gxfb(reqVO));
    }

    @PostMapping("/gxfbList")
    public CommonResult<List<ShqkxxVO>> gxfbList(){
        return CommonResult.success(shqkbService.gxfbList());
    }

    @PostMapping("/gxfbSp")
    public CommonResult<String> gxfbSp(@RequestBody GxspReqVO reqVO){
        return CommonResult.success(shqkbService.gxfbSp(reqVO));
    }

    @PostMapping("/getQyuuidsByBq")
    public CommonResult<List<String>> getQyuuidsByBq(@RequestBody GxxxReqVO reqVO){
        return CommonResult.success(shqkbService.getQyuuidsByBq(reqVO));
    }

    @PostMapping("/gxxxList")
    public CommonResult<Page<GxxxVO>> gxxxList(@RequestBody GxxxReqVO reqVO){
        return CommonResult.success(shqkbService.gxxxList(reqVO));
    }

    @PostMapping("/gxxxListByYh")
    public CommonResult<Page<GxxxVO>> gxxxListByYh(@RequestBody GxxxReqVO reqVO){
        return CommonResult.success(shqkbService.gxxxListByYh(reqVO));
    }

    @Operation(summary = "供需上架",description = "供需上架")
    @PostMapping("/gxsj")
    public CommonResult<String> gxsj(@RequestBody GxsjReqVO reqVO){
        return CommonResult.success(gxxxbService.gxsj(reqVO));
    }

    @Operation(summary = "供需收藏",description = "供需收藏")
    @PostMapping("/gxsc")
    public CommonResult<String> gxsc(@RequestBody GxscReqVO reqVO){
        return CommonResult.success(gxscbService.gxsc(reqVO));
    }

    @PostMapping("/getGxSqList")
    public CommonResult<Page<GxxxVO>> getGxSqList(@RequestBody GetGxSqListReqVO reqVO){
        return CommonResult.success(shqkbService.getGxSqList(reqVO));
    }

    @PostMapping("/gxsp")
    public CommonResult<String> gxsp(@RequestBody GxspReqVO reqVO){
        gxxxbService.gxsp(reqVO);
        return CommonResult.success("success");
    }

    @GetMapping("/getGxxx")
    public CommonResult<GxxxVO> getGxxx(@RequestParam("gxuuid") String gxuuid){
        return CommonResult.success(gxxxbService.getGxxx(gxuuid));
    }

}
