package com.njcn.csdevice.controller.equipment;


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.common.utils.LogUtil;
import com.njcn.csdevice.pojo.param.GroupArrParam;
import com.njcn.csdevice.service.ICsGroArrService;
import com.njcn.web.controller.BaseController;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 组和指标关系表 前端控制器
 * </p>
 *
 * @author xuyang
 * @since 2023-06-19
 */
@Slf4j
@RestController
@RequestMapping("/csGroArr")
@Api(tags = "组和指标关系")
@AllArgsConstructor
public class CsGroArrController extends BaseController {

    private final ICsGroArrService csGroArrService;

    @PostMapping("/updateGroArr")
    @OperateInfo(info = LogEnum.SYSTEM_COMMON)
    @ApiOperation("更新组和指标关系")
    @ApiImplicitParam(name = "groupArrParam", value = "重新分组信息", required = true)
    public HttpResult<String> updateGroArr(@RequestBody GroupArrParam groupArrParam) {
        String methodDescribe = getMethodDescribe("updateGroArr");
        LogUtil.njcnDebug(log, "{}，分组信息为：{}", methodDescribe, groupArrParam);
        csGroArrService.updateGroArr(groupArrParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
    }
}

