package com.srs.web.controller.dormitory;


import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.core.page.TableDataInfo;
import com.srs.common.utils.SecurityUtils;
import com.srs.dormitory.domain.Dto.AddDelayApplicationDto;
import com.srs.dormitory.domain.Dto.ApplicationListDto;
import com.srs.dormitory.domain.Dto.CheckoutApplicationDto;
import com.srs.dormitory.domain.Dto.UpdateTransferApplicationDto;
import com.srs.dormitory.service.IDmsDelayApplicationService;
import com.srs.dormitory.utils.DmsOperationLog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 延迟退宿申请表 前端控制器
 * </p>
 *
 * @author szz
 * @since 2023年08月01日
 */
@Api(tags = "延迟退宿申请表")
@RestController
@RequestMapping("/dormitory/dms-delay-application")
public class DmsDelayApplicationController extends BaseController {
    @Autowired
    private IDmsDelayApplicationService dmsDelayApplicationService;

//    @PreAuthorize("@ss.hasPermi('dormitory:dms-delay-application:add')")
    @ApiOperation("提交延迟退宿申请表")
    @PostMapping("/add")
    public AjaxResult addDelayApplication(@RequestBody @Validated AddDelayApplicationDto applicationDto){
        return dmsDelayApplicationService.addDelayApplication(applicationDto);
    }
//    @PreAuthorize("@ss.hasPermi('dormitory:dms-delay-application:list')")
    @ApiOperation("查看延迟退宿申请表列表")
    @PostMapping("/list")
    public TableDataInfo getDelayApplicationList(@RequestBody ApplicationListDto params){
        startPage();
        return getDataTable(dmsDelayApplicationService.getDelayApplicationList(params));
    }
//    @PreAuthorize("@ss.hasPermi('dormitory:dms-delay-application:query')")
    @ApiOperation("查看延迟退宿申请表详情")
    @GetMapping("/{id}")
    public AjaxResult getDelayApplicationInfo(@ApiParam(value = "延迟退宿申请表Id") @PathVariable Long id){
        return dmsDelayApplicationService.getDelayApplicationInfo(id);
    }
//    @PreAuthorize("@ss.hasPermi('dormitory:dms-delay-application:remove')")
    @ApiOperation("删除延迟退宿申请表")
    @PostMapping("/delete/{id}")
    public AjaxResult deleteDelayApplication(@PathVariable Long id){
        List<Long> ids = new ArrayList<>();
        ids.add(id);
        return dmsDelayApplicationService.batchDeleteDelayApplication(ids);
    }
//    @PreAuthorize("@ss.hasPermi('dormitory:dms-delay-application:remove')")
    @ApiOperation("批量删除延迟退宿申请表")
    @PostMapping("/batch/delete")
    public AjaxResult batchDeleteDelayApplication(@RequestBody List<Long> ids){
        return dmsDelayApplicationService.batchDeleteDelayApplication(ids);
    }
}

