package com.benyun.core.controller;

import com.benyun.core.entity.vo.BrandListQueryBody;
import com.benyun.core.service.WdInfoService;
import com.ruoyi.common.core.domain.R;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;

import java.util.List;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/WdInfo")
public class WdInfoController {
    @Autowired
    WdInfoService wdInfoService;

//    获取各地区网点分类分布情况
    @GetMapping("/categoryDistribution")
    public R categoryDistribution(BrandListQueryBody body){
        List<String> addrCodes = body.getAddrCode();
        List<String> typeCodes = body.getTypeCode();
        return R.ok(wdInfoService.searchAddrTypeDistribution(addrCodes,typeCodes));
    }

//    获取各地区网点类型分布情况
    @GetMapping("/wdTypeDistribution")
    public R wdTypeDistribution(BrandListQueryBody body){
        List<String> addrCodes = body.getAddrCode();
        List<String> typeCodes = body.getTypeCode();
        return R.ok(wdInfoService.searchWdTypeDistribution(addrCodes,typeCodes));
    }

//    获取所有网点类型网点数量(降序)
    @GetMapping("/total")
    public R total(){
        return R.ok(wdInfoService.searchWdTotal());
    }
}
