package org.linlinjava.jz.admin.web;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.linlinjava.jz.core.util.ResponseUtil;
import org.linlinjava.jz.db.service.CustomerClientService;
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.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/admin/dashboard")
@Validated
public class AdminDashbordController {
    private final Log logger = LogFactory.getLog(AdminDashbordController.class);

    @Autowired
    private CustomerClientService userService;



    @GetMapping("")
    public Object info() {
        int userTotal = userService.count();
        int goodsTotal = 0;
        int starTotal = userService.starCount();
        int orderTotal = 0;
        Map<String, Integer> data = new HashMap<>();
        data.put("userTotal", userTotal);
        data.put("goodsTotal", goodsTotal);//在售商品
        data.put("starTotal", starTotal);//行星数量
        data.put("orderTotal", orderTotal);

        return ResponseUtil.ok(data);
    }

}
