/**
 * Copyright 2019 DH
 * All right reserved.
 * 项目名称: 大恒泰山系统
 * 创建日期:2023/10/11
 */
package org.springblade.modules.baseinfo.warn.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
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.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.baseinfo.warn.entity.WarnSettingEntity;
import org.springblade.modules.baseinfo.warn.service.IWarnSettingService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
 * Date:2023/10/11
 * Title:预警配置管理模块
 * Description：按机构进行预警配置
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
@RestController
@RequestMapping("galaxy-business/base/warn/setting")
@AllArgsConstructor
@Api(value = "预警配置管理模块", tags = "各机构预警配置功能")
public class WarnSettingController extends BladeController {
    private final IWarnSettingService warnSettingService;

    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "")
    public R<WarnSettingEntity> detail(WarnSettingEntity dto) {
        BladeUser user = AuthUtil.getUser();
        if (dto.getOrgId() == null) {
            dto.setOrgId(Func.toLong(user.getDeptId()));
        }
        WarnSettingEntity detail = warnSettingService.getOne(Condition.getQueryWrapper(dto));
        return R.data(detail);
    }
}
