package vip.xiaonuo.write.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.common.pojo.CommonResult;
import vip.xiaonuo.write.entity.WriteIndex;
import vip.xiaonuo.write.param.WriteListPageParam;
import vip.xiaonuo.write.service.IWriteIndexService;

import java.util.Map;

/**
 * <p>
 * 通用预警指标管理 前端控制器
 * </p>
 *
 * @author author
 * @since 2025-03-01
 */
@RestController
@RequestMapping("/write-index")
@Api(tags = "通用预警指标管理")
@ApiSupport(author = "wang", order = 1)
@Validated
public class WriteIndexController {

    @Autowired
    private IWriteIndexService indexService;

    @ApiOperationSupport(order = 1)
    @ApiOperation("通用预警指标列表")
    @PostMapping("/write-index/list")
    public CommonResult page(@RequestBody Map<String, String> paramsMap) {
//        String orgId = paramsMap.get("orgId");
        String type = paramsMap.get("type");
        return CommonResult.data(indexService.list(new QueryWrapper<WriteIndex>().eq("module_type", Integer.parseInt(type))));
    }
}
