package cn.iocoder.yudao.module.crm.controller.admin.crmindex;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.crm.controller.admin.crmindex.vo.CrmIndexRespVO;
import cn.iocoder.yudao.module.crm.service.crmindex.CrmIndexService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;

@Tag(name = "管理后台 - 首页统计")
@RestController
@RequestMapping("/crm/index")
@Validated
public class CrmIndexController {
    @Resource
    private CrmIndexService crmIndexService;

    @GetMapping("/getCount")
    @Operation(summary = "首页统计")
    public CommonResult<CrmIndexRespVO> getCount(@RequestParam(name = "relation", defaultValue = "my", required = false) String relation,
                                                 @RequestParam(name = "userId", required = false) Long userId) {
        return success(crmIndexService.getIndexCount(relation, userId));
    }


}
