zrj
2024-10-31 2237bc8d0fd0aed40c7daf7398cb89c65a74b7ca
新增救援队伍统计
5 files modified
55 ■■■■■ changed files
src/main/java/org/springblade/modules/yw/controller/RescueTeamController.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.xml 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/yw/service/IRescueTeamService.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/yw/service/impl/RescueTeamServiceImpl.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/yw/controller/RescueTeamController.java
@@ -13,6 +13,7 @@
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.yw.excel.RescueTeamExcel;
import org.springblade.modules.yw.vo.RiskSourceVO;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.yw.entity.RescueTeamEntity;
@@ -118,4 +119,16 @@
        String data = rescueTeamService.importRescueTeam(ExcelUtil.read(file, RescueTeamExcel.class),isCovered == 1);
        return R.data(200, data, data);
    }
    /**
     * 救援队伍统计查询
     * @param rescueTeam
     * @return
     */
    @GetMapping("/getStatisticData")
    @ApiOperationSupport(order = 9)
    @ApiOperation(value = "救援队伍统计查询", notes = "")
    public R getStatisticData(RescueTeamVO rescueTeam) {
        return R.data(rescueTeamService.getStatisticData(rescueTeam));
    }
}
src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.java
@@ -1,10 +1,12 @@
package org.springblade.modules.yw.mapper;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.yw.entity.RescueTeamEntity;
import org.springblade.modules.yw.vo.RescueTeamVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
/**
 * 救援队伍表 Mapper 接口
@@ -21,6 +23,12 @@
     * @param rescueTeam
     * @return
     */
    List<RescueTeamVO> selectRescueTeamPage(IPage page, RescueTeamVO rescueTeam);
    List<RescueTeamVO> selectRescueTeamPage(IPage page,@Param("rescueTeam") RescueTeamVO rescueTeam);
    /**
     * 救援队伍统计查询
     * @param rescueTeam
     * @return
     */
    List<Map<String, Object>> getStatisticData(@Param("rescueTeam") RescueTeamVO rescueTeam);
}
src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.xml
@@ -20,4 +20,16 @@
        select * from yw_rescue_team where is_deleted = 0
    </select>
    <!--自定义分页查询-->
    <select id="getStatisticData" resultType="java.util.Map">
        SELECT
            case when type=1 then '园区'
            when type =2 then '企业'
            end as type,
            count(*) AS num
        FROM
            yw_rescue_team
        GROUP BY type
    </select>
</mapper>
src/main/java/org/springblade/modules/yw/service/IRescueTeamService.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
/**
 * 救援队伍表 服务类
@@ -31,4 +32,11 @@
     * @return
     */
    String importRescueTeam(List<RescueTeamExcel> data, boolean isCovered);
    /**
     * 救援队伍统计查询
     * @param rescueTeam
     * @return
     */
    List<Map<String,Object>> getStatisticData(RescueTeamVO rescueTeam);
}
src/main/java/org/springblade/modules/yw/service/impl/RescueTeamServiceImpl.java
@@ -16,6 +16,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
@@ -110,4 +111,15 @@
            rescueTeamEntity.setFirmId(firmInfo.getId());
        }
    }
    /**
     * 救援队伍统计查询
     * @param rescueTeam
     * @return
     */
    @Override
    public List<Map<String, Object>> getStatisticData(RescueTeamVO rescueTeam) {
        // 查询并返回救援队伍统计
        return baseMapper.getStatisticData(rescueTeam);
    }
}