package com.njcn.csdevice.controller.project;

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.csdevice.pojo.param.CsTouristDataParm;
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
import com.njcn.csdevice.service.CsTouristDataPOService;
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.validation.annotation.Validated;
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;

/**
* (cs_tourist_data)表控制层
*
* @author xxxxx
*/
@RestController
@Slf4j
@Api(tags = "游客数据配置")
@AllArgsConstructor
@RequestMapping("/csTouristData")
public class CsTouristDataPOController  extends BaseController {

    private final CsTouristDataPOService csTouristDataPOService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/add")
    @ApiOperation("新增游客数据")
    @ApiImplicitParam(name = "csTouristDataParms", value = "新增工程参数", required = true)
    public HttpResult<Boolean> add(@Validated @RequestBody List<CsTouristDataParm> csTouristDataParms){
        String methodDescribe = getMethodDescribe("add");

        Boolean flag = csTouristDataPOService.add(csTouristDataParms);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/remove")
    @ApiOperation("移除游客数据")
    @ApiImplicitParam(name = "csTouristDataParms", value = "新增工程参数", required = true)
    public HttpResult<Boolean> remove(@Validated @RequestBody List<CsTouristDataParm> csTouristDataParms){
        String methodDescribe = getMethodDescribe("remove");

        Boolean flag = csTouristDataPOService.remove(csTouristDataParms);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
    }
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/queryAll")
    @ApiOperation("查询游客数据")
    public HttpResult<List<CsTouristDataParmVO>> queryAll(){
        String methodDescribe = getMethodDescribe("queryAll");

        List<CsTouristDataParmVO> list = csTouristDataPOService.queryAll();
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }


}
