package com.ruoyi.szxc.controller;

import com.ruoyi.szxc.service.ISzxcJmInfoService;
import com.ruoyi.szxc.service.ISzxcPublicActivilyService;
import com.ruoyi.szxc.service.ISzxcWishManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
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;
import java.util.Map;

/**
 * 数据大屏Controller
 *
 * @author hs
 * @date 2024-03-15
 */
@RestController
@RequestMapping("/szxc/data")
public class SzxcDataScreenController {
    @Autowired
    private ISzxcJmInfoService szxcJmInfoService;

    @Autowired
    private ISzxcPublicActivilyService szxcPublicActivilyService;

    @Autowired
    private ISzxcWishManageService szxcWishManageService;

    /**
     * 按dept_id分组 查询性别数据
     * @return
     */
    @PreAuthorize("@ss.hasPermi('szxc:sjdp:sex')")
    @GetMapping("/sex")
    public List<Map<String, Object>> getDataBySex()
    {
        List<Map<String, Object>> result = szxcJmInfoService.getDataBySex();
        return result;
    }

    /**
     * 按dept_id分年龄段查询数据
     * @return
     */
    @GetMapping("/age")
    @PreAuthorize("@ss.hasPermi('szxc:sjdp:age')")
    public List<Map<String, Object>> getDataByAge()
    {
        List<Map<String, Object>> result = szxcJmInfoService.getDataByAge();
        return result;
    }

    /**
     * 按dept_id分组，查询人员标签数据
     * @return
     */
    @GetMapping("/tag")
    @PreAuthorize("@ss.hasPermi('szxc:sjdp:tag')")
    public List<Map<String, Object>> getDataByTag()
    {
        List<Map<String, Object>> result = szxcJmInfoService.getDataByTag();
        return result;
    }
    /**
     * 按dept_id分组，查询活动情况
     * @return
     */
    @GetMapping("/active")
    @PreAuthorize("@ss.hasPermi('szxc:sjdp:active')")
    public List<Map<String, Object>> getActiveData()
    {
        List<Map<String, Object>> result = szxcPublicActivilyService.getActiveData();
        return result;
    }
    /**
     * 按dept_id分组，查询心愿类型情况
     * @return
     */
    @GetMapping("/wish")
    @PreAuthorize("@ss.hasPermi('szxc:sjdp:wish')")
    public List<Map<String, Object>> getWishData()
    {
        List<Map<String, Object>> result = szxcWishManageService.getWishData();
        return result;
    }
}
