/**
 * Copyright 2019 DH
 * All right reserved.
 * 项目名称: 运维系统
 * 创建日期:2023/11/12
 */
package org.springblade.modules.yjxt.business.warn.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.modules.yjxt.business.warn.entity.OriginalWarningInfoEntity;
import org.springblade.modules.yjxt.business.warn.service.IOriginalWarningService;
import org.springblade.modules.yjxt.business.warn.vo.OriginalWarningInfoVO;
import org.springblade.modules.yjxt.business.warn.wrapper.YjWarnInfoWrapper;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

/***
 * Date:2023/11/12
 * Title:文件所属模块（必须填写）
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
@RestController
@RequestMapping("galaxy-business/yj/warn")
@AllArgsConstructor
@Api(value = "应急系统预警信息管理接口", tags = "查")
public class YjWarnController extends BladeController {

    private final IOriginalWarningService originalWarningService;

    @GetMapping("/page")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warnStatus", value = "预警状态", paramType = "query", dataType = "int"),
    })
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "分页")
    public R<IPage<OriginalWarningInfoVO>> page(@ApiIgnore OriginalWarningInfoEntity entity, Query query) {
        BladeUser user = AuthUtil.getUser();
        entity.setReviewStatus("1");
        entity.setType("4");
        IPage<OriginalWarningInfoEntity> pages = originalWarningService.selectPage(Condition.getPage(query), entity);
        return R.data(YjWarnInfoWrapper.build().pageVO(pages));
    }

}
