package com.muyu.warning.controller;

import com.muyu.common.core.domain.Result;
import com.muyu.warning.domain.WarnRule;
import com.muyu.warning.domain.WarnRuleDTO;
import com.muyu.warning.service.IWarRulesService;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @ClassName WarnRulesController
 * @Description 描述
 * @Author Chen
 * @Date 2024/9/23 21:07
 */
@RestController
@RequestMapping("/rules")
public class WarnRulesController {
    @Autowired
    private IWarRulesService warnRulesService;

    /**
     * 联查策略规则 联查
     */

    @GetMapping("/list")
    public Result<List<WarnRuleDTO>> list() {
        List<WarnRuleDTO> list = warnRulesService.selectWarnRulesList();
        return Result.success(list);
    }

    /**
     * 联查
     *
     * @param warnRuleDTO
     * @return
     */
    @PostMapping("/listAll")
    public Result<List<WarnRuleDTO>> listAll(WarnRuleDTO warnRuleDTO) {
        List<WarnRuleDTO> list = warnRulesService.selectWarnRulesListAll(warnRuleDTO);
        return Result.success(list);
    }
}
