package com.zd.laboratory.controller;

import com.zd.common.core.domain.R;
import com.zd.common.core.domain.per.PerFun;
import com.zd.common.core.domain.per.PerPrefix;
import com.zd.common.core.web.controller.BaseController;
import com.zd.common.core.web.domain.ResultData;
import com.zd.common.log.annotation.Log;
import com.zd.common.log.enums.BusinessType;
import com.zd.common.security.annotation.PreAuthorize;
import com.zd.laboratory.domain.LabCheckConfig;
import com.zd.laboratory.service.ILabCheckConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 检查推送信息配置Controller
 *
 * @author liubo
 * @date 2021-12-30
 */
@RestController
@Api(tags = "【检查推送信息配置】")
@RequestMapping("/checkConfig")
public class LabCheckConfigController extends BaseController {
    @Autowired
    private ILabCheckConfigService labCheckConfigService;

    /**
     * 查询检查推送信息配置
     */
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_CHECKCONFIG + PerFun.LIST)
    @GetMapping("/info")
    @ApiOperation(value = "查询检查推送信息配置列表")
    public R<LabCheckConfig> info() {
        return R.ok(labCheckConfigService.getCheckConfigInfo());
    }

    /**
     * 修改检查推送信息配置
     */
    @ApiOperation(value = "修改检查推送信息配置")
    @PreAuthorize(hasPermi = PerPrefix.LABORATORY_CHECKCONFIG + PerFun.EDIT)
    @Log(title = "检查推送信息配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public ResultData edit(@RequestBody LabCheckConfig labCheckConfig) {
        return ResultData.result(labCheckConfigService.updateLabCheckConfig(labCheckConfig));
    }

}
