package com.njcn.gather.storage.controller;

import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.gather.storage.service.TableGenService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.utils.HttpResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Api(tags = "生成表")
@RestController
@RequestMapping("/genTable")
@RequiredArgsConstructor
public class TableGenController extends BaseController {

    private final TableGenService tableGenService;


    @GetMapping("genAdHarmonicTable")
    @ApiOperation("生成表")
    @OperateInfo
    public HttpResult<Object> genAdHarmonicTable(@RequestParam("code") String code, @RequestParam("isContrast") boolean isContrast) {
        String methodDescribe = getMethodDescribe("genAdHarmonicTable");
        tableGenService.genTable(code, isContrast);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
    }
}
