package com.bonus.material.lease.controller;

import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.lease.domain.LeaseAgreementRecord;
import com.bonus.material.lease.domain.LeaseAgreementSlt;
import com.bonus.material.lease.domain.vo.LeaseApplyRequestVo;
import com.bonus.material.lease.service.ILeaseAgreementRecordService;
import com.bonus.material.lease.service.ILeaseAgreementSltService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 项目领退Controller
 *
 * @author xsheng
 * @date 2024-10-16
 */
@Api(tags = "结算列表接口")
@RestController
@RequestMapping("/lease_agreement_slt")
public class LeaseAgreementSltController extends BaseController {
    @Autowired
    private ILeaseAgreementSltService leaseAgreementSltService;

    /**
     * 查询列表
     */
    @ApiOperation(value = "查询列表")
    @GetMapping("/list")
    public TableDataInfo list(LeaseAgreementSlt leaseAgreementSlt) {
        startPage();
        List<LeaseAgreementSlt> list = leaseAgreementSltService.selectLeaseAgreementSltList(leaseAgreementSlt);
        return getDataTable(list);
    }

    /**
     * 获取单据详细信息
     * @param leaseAgreementSlt
     * @return
     */
    @ApiOperation(value = "获取单据详细信息")
    //@RequiresPermissions("lease:info:query")
    @GetMapping(value = "/getInfo")
    public AjaxResult getInfo(LeaseAgreementSlt leaseAgreementSlt) {
        return success(leaseAgreementSltService.getInfo(leaseAgreementSlt));
    }


    /**
     * 修改数据
     */
    @ApiOperation(value = "修改数据")
    @PreventRepeatSubmit
    //@RequiresPermissions("lease:info:edit")
    @PostMapping(value = "/updateInfo")
    public AjaxResult edit(@RequestBody @NotNull LeaseAgreementSlt leaseAgreementSlt) {
        try {
            return toAjax(leaseAgreementSltService.updateLeaseSltInfo(leaseAgreementSlt));
        } catch (Exception e) {
            return error("系统错误, " + e.getMessage());
        }
    }
}
