package com.lantone.daqe.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lantone.common.api.CommonResult;
import com.lantone.daqe.dto.GetByIdColumnResultDTO;
import com.lantone.daqe.dto.GetColumnResultNumberDTO;
import com.lantone.daqe.dto.GetColumnResultPageDTO;
import com.lantone.daqe.facade.ColumnResultManagementFacade;
import com.lantone.daqe.vo.DataCheckVO;
import com.lantone.daqe.vo.GetColumnResultNumberVO;
import com.lantone.daqe.vo.GetColumnResultPageVO;
import com.lantone.daqe.vo.UpdateColumnResultVO;
import com.lantone.daqe.vo.GetByIdColumnResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
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 java.util.List;

/**
 * @Description: 字段校验问题明细API
 * @author： zhanghang
 * @time: 2022/3/8 14:24
 */
@RestController
@Api(value = "字段校验问题明细API", tags = { "字段校验问题明细API" })
@RequestMapping("/columnResultManagement")
public class ColumnResultManagmentController {

    @Autowired
    private ColumnResultManagementFacade columnResultManagementFacade;


    @ApiOperation(value = "获取字段校验问题明细分页列表 [by:zhanghang]")
    @PostMapping("/getColumnResultPage")
    public CommonResult<IPage<GetColumnResultPageDTO>> getColumnResultPage(@RequestBody GetColumnResultPageVO getColumnResultPageVO) {
        return CommonResult.success(columnResultManagementFacade.getColumnResultPage(getColumnResultPageVO));
    }

    @ApiOperation(value = "获取字段校验问题明细数量 [by:zhanghang]")
    @PostMapping("/getColumnResultNumber")
    public CommonResult<GetColumnResultNumberDTO> getColumnResultNumber(@RequestBody GetColumnResultNumberVO getColumnResultNumberVO) {
        return CommonResult.success(columnResultManagementFacade.getColumnResultNumber(getColumnResultNumberVO));
    }

    @ApiOperation(value = "修改字段校验问题明细 [by:zhanghang]")
    @PostMapping("/updateColumnResult")
    @Transactional
    public CommonResult<Boolean> updateColumnResult(@RequestBody UpdateColumnResultVO updateColumnResultVO) {
        return CommonResult.success(columnResultManagementFacade.updateColumnResult(updateColumnResultVO));
    }

    @ApiOperation(value = "根据ID查看字段校验问题明细 [by:zhanghang]")
    @PostMapping("/getByIdColumnResult")
    public CommonResult<GetByIdColumnResultDTO> getByIdColumnResult(@RequestBody GetByIdColumnResultVO getByIdColumnResultVO) {
        return CommonResult.success(columnResultManagementFacade.getByIdColumnResult(getByIdColumnResultVO));
    }

    @ApiOperation(value = "数据校验接口 [by:zhanghang]")
    @PostMapping("/dataCheck")
    @Transactional
    public CommonResult<Boolean> dataCheck(@RequestBody DataCheckVO dataCheckVO) {
        return CommonResult.success(columnResultManagementFacade.dataCheck(dataCheckVO));
    }

    @ApiOperation(value = "获取质控模块名称 [by:zhanghang]")
    @PostMapping("/getModeName")
    @Transactional
    public CommonResult<List<String>> getModeName() {
        return CommonResult.success(columnResultManagementFacade.getModeName());
    }
}
