zoukankan      html  css  js  c++  java
  • 根据地区进行统计人数,如果没有显示为0

    //Controller 层
    /**
    * @Description
    * 根据地区查询所有用户信息
    * @author luying
    *
    */

    @RequestMapping(value = "/toShiCountPage")
    @ResponseBody
    public ModelAndView toShiCountPage(Integer cid) {
    ModelAndView mv = new ModelAndView("admin/tosignup/toShiCountPage");
    // 查询到所有地市级的人数统计
    Map<String,Object> areaPersonMap = toSignUpService.areaPersonNum(cid);
    mv.addObject("cid",cid);
    mv.addObject("areaPersonMap",areaPersonMap);
    return mv;
    }


    //service 层

    /**
    * @Description
    *
    * 根据地区进行人员数量统计
    * @author luying
    *
    */
    public Map<String,Object> areaPersonNum(Integer cid){
    List<ApplyParticipants> areaNum=null;
    Map mapArea = new HashMap<>();

    mapArea.put("桂林市","0");
    mapArea.put("北海市","0");
    mapArea.put("梧州市","0");
    mapArea.put("贵港市","0");
    mapArea.put("玉林市","0");
    mapArea.put("河池市","0");
    mapArea.put("百色市","0");
    mapArea.put("钦州市","0");
    mapArea.put("崇左市","0");
    mapArea.put("柳州市","0");
    mapArea.put("贺州市","0");
    mapArea.put("防城港市","0");
    mapArea.put("来宾市","0");
    try {
    areaNum=participantsMapper.countArea(cid);
    for(ApplyParticipants applyParticipants:areaNum){
    mapArea.put(applyParticipants.getArea(),applyParticipants.getNum());
    }

    } catch (Exception e) {
    e.printStackTrace();
    }
    return mapArea;
    }
  • 相关阅读:
    IP通信基础学习第八周
    IP通信基础学习第七周(下)
    IP通信基础学习第七周(上)
    IP通信基础学习第六周(下)
    mysql 笔记
    一个不错的MYSQL数据库备份类,PHP版,一个文件,精简版
    Linux下apache日志(按日期存放)分析与状态查看方法
    呵呵
    docker-compose常用命令
    mysql 数据备份
  • 原文地址:https://www.cnblogs.com/luYing666/p/11590646.html
Copyright © 2011-2022 走看看