package com.njcn.csharmonic.controller;


import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.csharmonic.service.ICsSysExcelRelationService;
import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO;
import com.njcn.harmonic.pojo.param.excel.ExcelParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import com.njcn.web.controller.BaseController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xy
 * @since 2026-01-27
 */
@RequestMapping("/sysExcelRelation")
@Slf4j
@RestController
@Api(tags = "模板关系配置")
@AllArgsConstructor
public class SysExcelRelationController extends BaseController {

    private final ICsSysExcelRelationService sysExcelService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/queryList")
    @ApiOperation("查询")
    public HttpResult<List<ReportTemplateVO>> queryList(@RequestParam("id") String id) {
        String methodDescribe = getMethodDescribe("queryList");
        List<ReportTemplateVO> result = sysExcelService.queryList(id);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/bandRelation")
    @ApiOperation("绑定关系")
    public HttpResult<Boolean> bandRelation(@RequestBody ExcelParam.ListExcelParam param) {
        String methodDescribe = getMethodDescribe("bandRelation");
        Boolean result = sysExcelService.bandRelation(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }


}

