package com.ruoyi.ibs.draw.controller;


import com.github.pagehelper.Page;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataPageInfo;
import com.ruoyi.ibs.draw.domain.dto.PassAuditDTO;
import com.ruoyi.ibs.draw.domain.dto.draw.LayerListDTO;
import com.ruoyi.ibs.draw.domain.entity.DrawLayerAudit;
import com.ruoyi.ibs.draw.domain.vo.DrawLayerVO;
import com.ruoyi.ibs.draw.service.DrawLayerAuditService;
import com.ruoyi.ibs.grid.domain.vo.AnchorVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "区域审核接口")
@RestController
@RequestMapping("/draw/audit")
public class DrawLayerAuditController extends BaseController {

    @Autowired
    DrawLayerAuditService service;

    @ApiOperation("获取区域审核信息列表")
    @Log(title = "审批中心-区域审批获取区域审核信息列表")
    @GetMapping("/list")
    public TableDataPageInfo<DrawLayerAudit> getDrawLayerList() {
        Page<Object> page = startPage();
        return getDataTable( service.selectAuditList(),page);
    }

    @ApiOperation("获取区域审核信息列表数量")
    @Log(title = "审批中心-区域审批获取区域审核信息列表数量")
    @GetMapping("/count")
    public AjaxResult getDrawLayerAuditCount() {
        return AjaxResult.success(service.selectAuditCount());
    }

    @ApiOperation("审核区域")
    @Log(title = "审批中心-区域审批审核区域")
    @PostMapping("/pass")
    public AjaxResult passDrawLayerAudit(@RequestBody List<PassAuditDTO> passAuditDTOs) throws Exception {
        return AjaxResult.success(service.passAudit(passAuditDTOs));
    }
}
