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



import com.yh.saas.plugin.yiliangyiyun.service.IStorageFeeRecordService;
import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.StorageFeeRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 * 记录代储费信息 前端控制器
 * </p>
 *
 * @author Gdc
 * @since 2022-01-18
 */
@RestController
@RequestMapping("/storageFeeRecord")
public class StorageFeeRecordController {

    @Autowired
    private IStorageFeeRecordService storageFeeRecordService;

    /**
     * 添加
     * @param example
     * @return
     */
    @PostMapping("/api/addStorageFeeRecord")
    public String addStorageFeeRecord(@RequestBody StorageFeeRecord example) {
        return storageFeeRecordService.addStorageFeeRecord(example.getContractNo());
    }
    /**
     * 信息分页列表查询
     *
     * @param storageFeeRecord
     * @return
     */
    @GetMapping("/selectInfo")
    public Page<StorageFeeRecord> selectInfo(StorageFeeRecord storageFeeRecord) {
        return storageFeeRecordService.selectInfo(storageFeeRecord);
    }
    /**
     * 编辑
     */
    @PostMapping("/editInfo")
    public String editInfo(@RequestBody StorageFeeRecord storageFeeRecord) {
        return storageFeeRecordService.editInfo(storageFeeRecord);
    }
    /**
     * 导出
     *
     * @return
     * @throws Exception
     */
    @PostMapping("/export")
    public void export(@RequestBody StorageFeeRecord storageFeeRecord, HttpServletResponse response) throws Exception {
        storageFeeRecordService.export(storageFeeRecord,response);
    }
}

