package com.yh.saas.plugin.yiliangyiyun.controller;


import com.yh.saas.plugin.yiliangyiyun.entity.AcquisitionInfo;
import com.yh.saas.plugin.yiliangyiyun.service.IAcquisitionInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 记录收购信息 前端控制器
 * </p>
 *
 * @author Gdc
 * @since 2021-11-26
 */
@RestController
@RequestMapping("/acquisitionInfo")
public class AcquisitionInfoController {
    @Autowired
    private IAcquisitionInfoService iAcquisitionInfoService;

    /**
     * 添加收购信息
     * @param acquisitionInfo
     * @return
     */
    @PostMapping("/api/addAcquisition")
    public String addAcquisition(@RequestBody AcquisitionInfo acquisitionInfo){
        return iAcquisitionInfoService.addAcquisition(acquisitionInfo);
    }

    /**
     * 收购信息列表
     * @param acquisitionInfo
     * @return
     */
    @GetMapping("/selectAcquisitionPage")
    public List<AcquisitionInfo> selectAcquisitionPage(AcquisitionInfo acquisitionInfo){
        return iAcquisitionInfoService.selectAcquisitionPage(acquisitionInfo);
    }

    /**
     * 关注
     * @param acquisitionInfo
     * @return
     */
    @PostMapping("/api/follow")
    public String follow(@RequestBody AcquisitionInfo acquisitionInfo){
        return iAcquisitionInfoService.follow(acquisitionInfo);
    }

    /**
     * 取消关注
     * @param acquisitionInfo
     * @return
     */
    @PostMapping("/api/followNot")
    public String followNot(@RequestBody AcquisitionInfo acquisitionInfo){
        return iAcquisitionInfoService.followNot(acquisitionInfo);
    }

    /**
     * 查看收购信息
     * @param acquisitionInfo
     * @return
     */
    @GetMapping("/getAcquisition")
    public AcquisitionInfo getAcquisition(AcquisitionInfo acquisitionInfo){
        return iAcquisitionInfoService.getAcquisition(acquisitionInfo.getId());
    }

    /**
     * 收购业务查看
     * @param acquisitionInfo
     * @return
     */
    @GetMapping("/getInfo")
    public AcquisitionInfo getInfo(AcquisitionInfo acquisitionInfo){
        return iAcquisitionInfoService.getInfo(acquisitionInfo);
    }

    /**
     * 审核
     *
     * @param acquisitionInfo
     * @return
     */
    @PostMapping("/api/examine")
    public String examine(@RequestBody AcquisitionInfo acquisitionInfo) {
        return iAcquisitionInfoService.examine(acquisitionInfo);
    }
}

