whycxzp
2024-03-07 2cb95a87ab7f14fdfeefd1e079307e47d011a317
src/main/java/com/whyc/service/StationInfService.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
import com.whyc.dto.Response;
import com.whyc.dto.result.SystemGrdoupBatt;
import com.whyc.mapper.*;
@@ -970,4 +971,29 @@
        mapper.insertBatchSomeColumn(stationListToBeAdded);
    }
    /**
     * 按省份查询数量
     * @param userId
     * @return
     */
    public Response getProvinceCountMap(int userId) {
        try {
            //所有站点的省份
            List<String> stationName1List = mapper.getProvinceCountMap(userId);
            Map<String, Integer> resMap = new HashMap<>();
            for (String stationName1 : stationName1List) {
                Integer count = resMap.get(stationName1);
                if (count == null) {
                    resMap.put(stationName1, 1);
                } else {
                    resMap.put(stationName1, count + 1);
                }
            }
            return new Response().setII(1, true,resMap,null);
        }catch (Exception e){
            return new Response().set(1, false,"发生异常:"+e.getCause());
        }
    }
}