linwe
2023-12-20 80d384b639f7bdc9f325d9b1fa51a95beb3093c1
统计接口优化
4 files modified
46 ■■■■ changed files
src/main/java/org/springblade/modules/house/controller/HouseController.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseMapper.java 8 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml 16 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java 18 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/house/controller/HouseController.java
@@ -205,8 +205,8 @@
                                @RequestParam("roleType") String roleType,
                                @RequestParam(value = "aoiCode", required = false) String aoiCode,
                                @RequestParam(value = "buildingCode", required = false) String buildingCode,
                                @RequestParam(value = "uniCode", required = false) String uniCode) {
        Map<String, Object> result = houseService.getHouseStatistics(code, roleType,aoiCode,buildingCode,uniCode);
                                @RequestParam(value = "unitCode", required = false) String unitCode) {
        Map<String, Object> result = houseService.getHouseStatistics(code, roleType,aoiCode,buildingCode,unitCode);
        return R.data(result);
    }
src/main/java/org/springblade/modules/house/mapper/HouseMapper.java
@@ -70,8 +70,8 @@
    Map<String, HouseTree> getHouseTree(@Param("houseParam") HouseParam houseParam,
                                        @Param("list") List<String> list);
    Integer getHouseStatisticsOne(String code, Long userId,String aoiCode,String buildingCode,String uniCode);
    Integer getHouseStatisticsTwo(String code, Long userId,String aoiCode,String buildingCode,String uniCode);
    Integer getHouseStatisticsThree(String code, Long userId,String aoiCode,String buildingCode,String uniCode);
    Integer getHouseStatisticsFour(String code, Long userId,String aoiCode,String buildingCode,String uniCode);
    Integer getHouseStatisticsOne(String code, Long userId,String aoiCode,String buildingCode,String unitCode);
    Integer getHouseStatisticsTwo(String code, Long userId,String aoiCode,String buildingCode,String unitCode);
    Integer getHouseStatisticsThree(String code, Long userId,String aoiCode,String buildingCode,String unitCode);
    Integer getHouseStatisticsFour(String code, Long userId,String aoiCode,String buildingCode,String unitCode);
}
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -267,8 +267,8 @@
            and jda.building_code=#{buildingCode}
        </if>
        <if test="uniCode != null  and uniCode != ''">
            and jda.unit_code=#{uniCode}
        <if test="unitCode != null  and unitCode != ''">
            and jda.unit_code=#{unitCode}
        </if>
        <if test="aoiCode != null  and aoiCode != ''">
@@ -310,8 +310,8 @@
            and jda.building_code=#{buildingCode}
        </if>
        <if test="uniCode != null  and uniCode != ''">
            and jda.unit_code=#{uniCode}
        <if test="unitCode != null  and unitCode != ''">
            and jda.unit_code=#{unitCode}
            AND jda.unit_code is not null
        </if>
@@ -349,8 +349,8 @@
            and jda.building_code=#{buildingCode}
        </if>
        <if test="uniCode != null  and uniCode != ''">
            and jda.unit_code=#{uniCode}
        <if test="unitCode != null  and unitCode != ''">
            and jda.unit_code=#{unitCode}
            AND jda.unit_code is not null
        </if>
@@ -391,8 +391,8 @@
            and jda.building_code=#{buildingCode}
        </if>
        <if test="uniCode != null  and uniCode != ''">
            and jda.unit_code=#{uniCode}
        <if test="unitCode != null  and unitCode != ''">
            and jda.unit_code=#{unitCode}
        </if>
        <if test="aoiCode != null  and aoiCode != ''">
src/main/java/org/springblade/modules/house/service/impl/HouseServiceImpl.java
@@ -301,23 +301,23 @@
    }
    @Override
    public Map<String, Object> getHouseStatistics(String code, String roleType,String aoiCode,String buildingCode,String uniCode) {
    public Map<String, Object> getHouseStatistics(String code, String roleType,String aoiCode,String buildingCode,String unitCode) {
        Map<String, Object> objectObjectHashMap = new HashMap<>();
        if (roleType.equals("1")) {
        //     result1 查询楼栋数  result2 查询房屋套数 result3 查询住户数  result4 查询单元数
            Integer result1 = baseMapper.getHouseStatisticsOne(code, AuthUtil.getUserId(),aoiCode,buildingCode,uniCode);
            Integer result2 = baseMapper.getHouseStatisticsTwo(code, AuthUtil.getUserId(),aoiCode,buildingCode,uniCode);
            Integer result3 = baseMapper.getHouseStatisticsThree(code, AuthUtil.getUserId(),aoiCode,buildingCode,uniCode);
            Integer result4 = baseMapper.getHouseStatisticsFour(code, AuthUtil.getUserId(),aoiCode,buildingCode,uniCode);
            Integer result1 = baseMapper.getHouseStatisticsOne(code, AuthUtil.getUserId(),aoiCode,buildingCode,unitCode);
            Integer result2 = baseMapper.getHouseStatisticsTwo(code, AuthUtil.getUserId(),aoiCode,buildingCode,unitCode);
            Integer result3 = baseMapper.getHouseStatisticsThree(code, AuthUtil.getUserId(),aoiCode,buildingCode,unitCode);
            Integer result4 = baseMapper.getHouseStatisticsFour(code, AuthUtil.getUserId(),aoiCode,buildingCode,unitCode);
            objectObjectHashMap.put("result1", result1);
            objectObjectHashMap.put("result2", result2);
            objectObjectHashMap.put("result3", result3);
            objectObjectHashMap.put("result4", result4);
        } else {
            Integer result1 = baseMapper.getHouseStatisticsOne(code, null,aoiCode,buildingCode,uniCode);
            Integer result2 = baseMapper.getHouseStatisticsTwo(code, null,aoiCode,buildingCode,uniCode);
            Integer result3 = baseMapper.getHouseStatisticsThree(code, null,aoiCode,buildingCode,uniCode);
            Integer result4 = baseMapper.getHouseStatisticsFour(code, null,aoiCode,buildingCode,uniCode);
            Integer result1 = baseMapper.getHouseStatisticsOne(code, null,aoiCode,buildingCode,unitCode);
            Integer result2 = baseMapper.getHouseStatisticsTwo(code, null,aoiCode,buildingCode,unitCode);
            Integer result3 = baseMapper.getHouseStatisticsThree(code, null,aoiCode,buildingCode,unitCode);
            Integer result4 = baseMapper.getHouseStatisticsFour(code, null,aoiCode,buildingCode,unitCode);
            objectObjectHashMap.put("result1", result1);
            objectObjectHashMap.put("result2", result2);
            objectObjectHashMap.put("result3", result3);