package com.huatek.busi.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.huatek.busi.service.*;
import com.huatek.busi.vo.*;
import com.huatek.busi.where.*;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@Api(tags={"离线报告参数管理接口"})
@RestController
@RequestMapping("/api/rParamBasicData")
public class RParamBasicDataController {

    @Reference(check = false)
    IRParamBasicDataService rParamBasicDataService;

    @Reference(check = false)
    IRParamAttrBasicDataService rParamAttrBasicDataService;

    @ApiOperation(value = "报告参数列表",httpMethod="POST", notes= "报告参数列表", produces = "application/json;charset=utf-8",response= Map.class)
    @PostMapping(value = "/mainList", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> mainList(@RequestBody RParamBasicDataSelectVo rParamBasicDataSelectVo){
        return rParamBasicDataService.mainList(rParamBasicDataSelectVo);
    }

    @ApiOperation(value = "报告参数新增或修改",httpMethod="POST", notes= "报告参数新增或修改", produces = "application/json;charset=utf-8",response= Map.class)
    @PostMapping(value = "/saveOrUpdate", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> saveOrUpdate(@RequestHeader("token") String token, @RequestBody RParamBasicDataVo rParamBasicDataVo){
        return rParamBasicDataService.saveOrUpdate(token, rParamBasicDataVo);
    }

    @ApiOperation(value = "根据主键查询报告参数",httpMethod="GET", notes= "根据主键查询报告参数", produces = "application/json;charset=utf-8",response= Map.class)
    @GetMapping(value = "/findOne/{id}", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> findOne(@RequestHeader("token") String token, @PathVariable("id") String id){
        return rParamBasicDataService.findOne(token, id);
    }

    @ApiOperation(value = "报告参数删除",httpMethod="GET", notes= "报告参数删除", produces = "application/json;charset=utf-8",response= Map.class)
    @GetMapping(value = "/delete/{ids}", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> delete(@RequestHeader("token") String token, @PathVariable("ids") List<String> ids){
        return rParamBasicDataService.delete(token, ids);
    }

    @ApiOperation(value = "根据报告参数主键查询报告参数属性列表",httpMethod="POST", notes= "根据报告参数主键查询报告参数属性列表", produces = "application/json;charset=utf-8",response= Map.class)
    @PostMapping(value = "/findChildList", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> findChildList(@RequestBody RParamAttrBasicDataSelectVo rParamAttrBasicDataSelectVo){
        return rParamAttrBasicDataService.findChildList(rParamAttrBasicDataSelectVo);
    }

    @ApiOperation(value = "报告参数属性新增或修改",httpMethod="POST", notes= "报告参数属性新增或修改", produces = "application/json;charset=utf-8",response= Map.class)
    @PostMapping(value = "/saveOrUpdateChild", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> saveOrUpdateChild(@RequestHeader("token") String token, @RequestBody RParamAttrBasicDataVo rParamAttrBasicDataVo){
        return rParamAttrBasicDataService.saveOrUpdateChild(token, rParamAttrBasicDataVo);
    }

    @ApiOperation(value = "根据主键查询报告参数属性",httpMethod="GET", notes= "根据主键查询报告参数属性", produces = "application/json;charset=utf-8",response= Map.class)
    @GetMapping(value = "/findOneChild/{id}", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> findOneChild(@RequestHeader("token") String token, @PathVariable("id") String id){
        return rParamAttrBasicDataService.findOneChild(token, id);
    }

    @ApiOperation(value = "报告参数属性删除",httpMethod="GET", notes= "报告参数属性删除", produces = "application/json;charset=utf-8",response= Map.class)
    @GetMapping(value = "/deleteChild/{ids}", produces = { "application/json;charset=utf-8" })
    public Map<String, Object> deleteChild(@RequestHeader("token") String token, @PathVariable("ids") List<String> ids){
        return rParamAttrBasicDataService.deleteChild(token, ids);
    }
}
