package com.sptg.statistics.biz.controller;

import com.sptg.common.core.beans.ResultBean;
import com.sptg.common.core.beans.ResultEnum;
import com.sptg.statistics.api.entity.StatisticsCount;
import com.sptg.statistics.api.feigns.StatisticsCountFeign;
import com.sptg.statistics.biz.service.StatisticsCountServiceInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * title: StatisticsCountController
 * package: com.sptg.statistics.biz.controller
 * description: 统计数量-控制器
 *
 *                
 *                 
 */
@RestController
public class StatisticsCountController implements StatisticsCountFeign {

    private final StatisticsCountServiceInterface statisticsCountServiceInterface;

    @Autowired
    public StatisticsCountController(StatisticsCountServiceInterface statisticsCountServiceInterface) {
        this.statisticsCountServiceInterface = statisticsCountServiceInterface;
    }

    @Override
    @PostMapping("/statistics/statisticsCount/addCount")
    public ResultBean<Boolean> addCount(@RequestBody StatisticsCount addStatisticsCount){
        return new ResultBean<>(ResultEnum.SUCCESS,statisticsCountServiceInterface.addCount(addStatisticsCount));
    }

    @Override
    @PostMapping("/statistics/statisticsCount/addCountLcn")
    public ResultBean<Boolean> addCountLcn(@RequestBody StatisticsCount addStatisticsCount){
        return new ResultBean<>(ResultEnum.SUCCESS,statisticsCountServiceInterface.addCountLcn(addStatisticsCount));
    }

    @Override
    @PostMapping("/statistics/statisticsCount/selectCountOne")
    public ResultBean<StatisticsCount> selectCountOne(@RequestParam(value = "orgPosition") String orgPosition){
        return new ResultBean<>(ResultEnum.SUCCESS,statisticsCountServiceInterface.selectCountOne(orgPosition));
    }
}
