Commit c570f97e authored by yf's avatar yf

融通大屏相关接口开发

parent 600c3ade
package com.censoft.censoftrongtong.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.censoft.censoftrongtong.domain.*;
import com.censoft.censoftrongtong.domain.dto.LedgerFloorDto;
import com.censoft.censoftrongtong.domain.dto.statistics.*;
import com.censoft.censoftrongtong.service.*;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.stream.Collectors;
/**
* 大屏接口
*/
@RestController
@RequestMapping("/system/bigScreen")
public class BigScreenController extends BaseController {
@Autowired
ILedgerProjectService ledgerProjectService;
@Autowired
ILedgerBuildingService ledgerBuildingService;
@Autowired
private ILedgerFloorService ledgerFloorService;
@Autowired
private ILedgerRoomService ledgerRoomService;
@Autowired
private IRiskPlanExistingListService riskPlanExistingListService;
@Autowired
private IRiskPlanInherentListService riskPlanInherentListService;
@Autowired
private IRiskPlanService riskPlanServices;
/**
* 项目信息列表
*/
@GetMapping("/selectLedgerProjectList")
public R<TableDataInfo> selectLedgerProjectList(String name) {
startPage();
List<LedgerProject> list = ledgerProjectService.getLedgerProjectList(name, null);
return R.ok(getDataTable(list));
}
/**
* 项目,楼宇,楼层统计
*/
@GetMapping("/evaluationDataStatistics")
public R<EvaluationDataDto> evaluationDataStatistics(String areaName) {
EvaluationDataDto result = new EvaluationDataDto();
Long projectNum = ledgerProjectService.getProjectCount(areaName);
Long buildingNum = ledgerProjectService.getBuildingCount(areaName, null);
Long floorNum = ledgerProjectService.getFloorCount(areaName, null);
result.setProjectNum(projectNum);
result.setBuildingNum(buildingNum);
result.setFloorNum(floorNum);
return R.ok(result);
}
/**
* 全国风险,年度新增
*/
@GetMapping("/nationalRiskStatistics")
public R<NationalRiskStatisticsDto> nationalRiskStatistics(String areaName, Integer type) {
NationalRiskStatisticsDto result = new NationalRiskStatisticsDto();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.MONTH, Calendar.JANUARY);
calendar.set(Calendar.DAY_OF_MONTH, 1);
Date beginTime = calendar.getTime();
Long nationalRiskNum = riskPlanExistingListService.getNationalRiskNum(areaName, null, null);
Long newRiskNum = riskPlanExistingListService.getNationalRiskNum(areaName, beginTime, null);
result.setNationalRiskNum(nationalRiskNum);
result.setNewRiskNum(newRiskNum);
return R.ok(result);
}
/**
* 总体风险指数排名
*/
@GetMapping("/riskIndexRanking")
public R<List<RiskIndexRankingDto>> riskIndexRanking(String areaName, Integer type) {
startPage();
List<RiskIndexRankingDto> result = riskPlanExistingListService.getRiskIndexRanking(areaName);
return R.ok(result);
}
/**
* 年度风险数量统计
*/
@GetMapping("/annualRiskStatistics")
public R<LinkedHashMap<String, Long>> annualRiskStatistics(String areaName, Integer type) {
LinkedHashMap<String, Long> result = riskPlanExistingListService.getAnnualRiskStatistics(areaName);
return R.ok(result);
}
/**
* 风险级别统计
*/
@GetMapping("/riskLevelStatistics")
public R<List<RiskLevelStatisticsDto>> riskLevelStatistics(String areaName, Integer type) {
List<RiskLevelStatisticsDto> result = riskPlanExistingListService.getRiskLevelStatistics(areaName, null);
return R.ok(result);
}
/**
* 事故类型统计
*/
@GetMapping("/accidentTypeStatistics")
public R<List<AccidentTypeStatisticsDto>> accidentTypeStatistics(String areaName, Integer type) {
List<AccidentTypeStatisticsDto> result = riskPlanExistingListService.getAccidentTypeStatistics(areaName);
return R.ok(result);
}
/**
* 项目风险级别排名
*
* @param areaName
* @param level
* @param type
* @return
*/
@GetMapping("/riskProjectRanking")
public R<List<RiskProjectRankingDto>> riskProjectRanking(String areaName, String level, Integer type) {
List<RiskProjectRankingDto> result = riskPlanExistingListService.getRiskProjectRanking(areaName, level);
return R.ok(result);
}
/**
* 获取地图统计数据
*
* @param queryDto
* @return
*/
@GetMapping("/getRiskMapStatistics")
public R<List<RiskMapStatisticsDto>> getRiskMapStatistics(MapStatisticsQueryDto queryDto) {
List<RiskMapStatisticsDto> list = riskPlanExistingListService.getRiskMapStatistics(queryDto);
if (queryDto.getLevel().equals(3) || queryDto.getLevelName().equals("district")) {
List<LedgerProject> projects = ledgerProjectService.getLedgerProjectList(null, queryDto.getAreaName());
for (RiskMapStatisticsDto r : list) {
if(r.getAreaName()!=null){
List<MapLedgerProjectDto> projectList = projects.stream().filter(s -> s.getDistrict() != null &&
s.getDistrict().contains(r.getAreaName())
).map(s->{
MapLedgerProjectDto projectDto=new MapLedgerProjectDto();
projectDto.setProjectId(s.getId());
projectDto.setProjectName(s.getName());
projectDto.setExistingNum(10L);
projectDto.setInherentNum(10L);
projectDto.setRiskSumNum(20L);
projectDto.setLat(s.getLat());
projectDto.setLng(s.getLng());
return projectDto;
}).collect(Collectors.toList());
r.setProjectList(projectList);
}
}
}
return R.ok(list);
}
/**
* 项目级-上方横条(评估时间、评估数据、风险总数量、风险等级统计(现状、固有))
*/
@GetMapping("/projectStatisticsDetail")
public R<ProjectStatisticsDetailDto> projectStatisticsDetail(@RequestParam Long projectId) {
ProjectStatisticsDetailDto result = new ProjectStatisticsDetailDto();
//项目名称
LedgerProject project = ledgerProjectService.getById(projectId);
result.setProjectName(project.getName());
//评估时间
List<RiskPlan> lastRiskPlan = riskPlanServices.list(Wrappers.<RiskPlan>query().lambda().eq(RiskPlan::getProjectId, projectId).orderByDesc(RiskPlan::getCreateTime));
result.setEvaluationTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, lastRiskPlan.get(0).getCreateTime()));
//评估数据
Long buildingNum = ledgerProjectService.getBuildingCount(null, projectId);
Long floorNum = ledgerProjectService.getFloorCount(null, projectId);
EvaluationDataDto evaluationDataDto = new EvaluationDataDto();
evaluationDataDto.setProjectNum(1L);
evaluationDataDto.setBuildingNum(buildingNum);
evaluationDataDto.setFloorNum(floorNum);
result.setEvaluationData(evaluationDataDto);
//固有风险数量
Long inherentNum = riskPlanInherentListService.getNationalRiskNum(null, null, projectId);
result.setInherentNum(inherentNum);
//现状风险数量
Long existingNum = riskPlanExistingListService.getNationalRiskNum(null, null, projectId);
result.setExistingNum(existingNum);
//风险总数量
Long sumNum = inherentNum + existingNum;
result.setRiskSumNum(sumNum);
//风险等级-固有
List<RiskLevelStatisticsDto> inherentLevelStatics = riskPlanInherentListService.getRiskLevelStatistics(null, projectId);
result.setInherentLevelStatics(inherentLevelStatics);
//风险等级-现状
List<RiskLevelStatisticsDto> existingLevelStatics = riskPlanExistingListService.getRiskLevelStatistics(null, projectId);
result.setExistingLevelStatics(existingLevelStatics);
return R.ok(result);
}
/**
* 项目风险信息
*/
@GetMapping("/projectRiskInformation")
public R<List<ProjectRiskInfoDto>> projectRiskInfo(Long projectId, Long buildingId, Long floorId, Integer type, String level) {
List<ProjectRiskInfoDto> list = riskPlanInherentListService.getProjectRiskInfo(projectId, buildingId, floorId, level);
return R.ok(list);
}
/**
* 获取项目下的楼宇
*
* @param projectId 项目id
* @param type 类型 地上、地下
* @real_return {@link R<List<LedgerBuilding>>}
*/
@GetMapping("/building/list/{projectId}")
public R<List<LedgerBuilding>> getBuildingListByProjectId(@PathVariable("projectId") Long projectId, String type) {
return R.ok(ledgerBuildingService.getBuildingListByProjectId(projectId, type));
}
/**
* 根据楼宇id获取楼层列表
*
* @param buildingId 楼宇id
* @real_return {@link R<List<LedgerFloor>>}
*/
@GetMapping("/floor/list/{buildingId}")
public R<List<LedgerFloorDto>> getFloorListByBuildingId(@PathVariable("buildingId") Long buildingId) {
return R.ok(ledgerFloorService.getFloorListByBuildingId(buildingId));
}
/**
* 根据楼层id获取房间列表
*
* @param floorId 楼宇id
* @real_return {@link R<List<LedgerRoom>>}
*/
@GetMapping("/room/list/{floorId}")
public R<List<LedgerRoom>> getRoomListByFloorId(@PathVariable("floorId") Long floorId) {
return R.ok(ledgerRoomService.getRoomListByFloorId(floorId));
}
}
...@@ -34,14 +34,33 @@ public class LedgerProject extends BaseEntityClean ...@@ -34,14 +34,33 @@ public class LedgerProject extends BaseEntityClean
/** 组织机构id */ /** 组织机构id */
private Long deptId; private Long deptId;
/** 所在城市 */ /** 省 */
@Excel(name = "所在城市",sort = 5) @Excel(name = "省",sort = 5)
private String province;
/** 市 */
@Excel(name = "市",sort = 5)
private String city; private String city;
/** 区 */
@Excel(name = "区",sort = 5)
private String district;
/** 街道 */
@Excel(name = "街道",sort = 5)
private String street;
/** 详细地址 */ /** 详细地址 */
@Excel(name = "详细地址",sort = 6) @Excel(name = "详细地址",sort = 6)
private String address; private String address;
/**
* 维度
*/
private String lat;
/**
* 经度
*/
private String lng;
/** 0-关联 1-自建 */ /** 0-关联 1-自建 */
private String source; private String source;
......
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
@Data
public class AccidentTypeStatisticsDto {
private static final long serialVersionUID = 1L;
/**
* 类型名称
*/
private String typeName;
/**
* 类型数量
*/
private String typeNum;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
@Data
public class EvaluationDataDto {
private static final long serialVersionUID = 1L;
/**
* 项目
*/
private Long projectNum;
/**
* 楼宇
*/
private Long buildingNum;
/**
* 楼层
*/
private Long floorNum;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import jdk.nashorn.internal.ir.annotations.Ignore;
import lombok.Data;
import java.util.Random;
@Data
public class MapLedgerProjectDto {
private static final long serialVersionUID = 1L;
@Ignore
String[] color = new String[]{"red", "green", "yellow", "blue"};
private Long projectId;
private String projectName;
private String lat;
private String lng;
private String riskColor;
public String getRiskColor() {
Random r = new Random();
return color[r.nextInt(4)];
}
/**
* 风险总数量
*/
private Long riskSumNum;
/**
* 固有风险数量
*/
private Long inherentNum;
/**
* 现状风险数量
*/
private Long existingNum;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
@Data
public class MapStatisticsQueryDto {
private static final long serialVersionUID = 1L;
/**
* 级别 默认传1 点击市级传2 依次类推
*/
private Integer level;
/**
* 默认不传,点击后传汉字
*/
private String areaName;
/**
* 0固有 1现状
*/
private String type;
public String getLevelName() {
String levelName = "";
if (this.level == null)
return levelName;
switch (this.level) {
case 1:
levelName = "province";
break;
case 2:
if (this.getAreaName().contains("北京") || this.getAreaName().contains("重庆") || this.getAreaName().contains("上海") || this.getAreaName().contains("天津"))
levelName = "district";
else
levelName = "city";
break;
case 3:
levelName = "district";
break;
case 4:
levelName = "street";
break;
}
return levelName;
}
public String getParentLevel() {
String levelName = "";
if (this.level == null)
return levelName;
switch (this.level) {
case 2:
if (this.getAreaName().contains("北京") || this.getAreaName().contains("重庆") || this.getAreaName().contains("上海") || this.getAreaName().contains("天津"))
levelName = "city";
else
levelName = "province";
break;
case 3:
levelName = "city";
break;
case 4:
levelName = "district";
break;
}
return levelName;
}
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
@Data
public class NationalRiskStatisticsDto {
private static final long serialVersionUID = 1L;
/**
* 全国风险数量
*/
private Long nationalRiskNum;
/**
* 年度新增风险数量
*/
private Long newRiskNum;
/**
* 升级风险数量
*/
private Long upRiskNum;
/**
* 降级风险数量
*/
private Long downRiskNum;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
@Data
public class ProjectRiskInfoDto {
private static final long serialVersionUID = 1L;
/**
* 风险id
*/
private Long id;
/**
* 风险名称
*/
private String riskName;
/**
* 风险类型
*/
private String typeName;
/**
* 风险等级
*/
private String levelName;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
import java.util.List;
@Data
public class ProjectStatisticsDetailDto {
private static final long serialVersionUID = 1L;
/**
* 项目名称
*/
private String projectName;
/**
* 评估时间
*/
private String evaluationTime;
/**
* 评估数据
*/
private EvaluationDataDto evaluationData;
/**
* 风险总数量
*/
private Long riskSumNum;
/**
* 固有风险数量
*/
private Long inherentNum;
/**
* 现状风险数量
*/
private Long existingNum;
/**
* 风险等级(固有)
*/
private List<RiskLevelStatisticsDto> inherentLevelStatics;
/**
* 风险等级(现状)
*/
private List<RiskLevelStatisticsDto> existingLevelStatics;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
@Data
public class RiskIndexRankingDto {
private static final long serialVersionUID = 1L;
/**
* 项目名称
*/
private String projectName;
/**
* 所在区域
*/
private String deptName;
/**
* 所在省
*/
private String province;
/**
* 风险数量
*/
private Long RiskNum;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
@Data
public class RiskLevelStatisticsDto {
private static final long serialVersionUID = 1L;
/**
* 风险级别
*/
private String levelName;
/**
* 级别数量
*/
private String levelNum;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import com.censoft.censoftrongtong.domain.LedgerProject;
import jdk.nashorn.internal.ir.annotations.Ignore;
import lombok.Data;
import java.util.List;
import java.util.Random;
@Data
public class RiskMapStatisticsDto {
@Ignore
String[] color = new String[]{"red", "green", "yellow", "blue"};
/**
* 地区名称
*/
private String areaName;
/**
* 风险数量
*/
private Long riskNum;
/**
* 区域颜色
*/
private String areaColor;
public String getAreaColor() {
Random r = new Random();
return color[r.nextInt(4)];
}
private List<MapLedgerProjectDto> projectList;
}
package com.censoft.censoftrongtong.domain.dto.statistics;
import lombok.Data;
@Data
public class RiskProjectRankingDto {
private static final long serialVersionUID = 1L;
/**
* 项目名称
*/
private String projectName;
/**
* 所在区域
*/
private String deptName;
/**
* 所在省
*/
private String province;
/**
* 风险分数
*/
private Long RiskScore;
}
...@@ -2,6 +2,8 @@ package com.censoft.censoftrongtong.mapper; ...@@ -2,6 +2,8 @@ package com.censoft.censoftrongtong.mapper;
import com.censoft.censoftrongtong.domain.LedgerProject; import com.censoft.censoftrongtong.domain.LedgerProject;
import com.github.yulichang.base.MPJBaseMapper; import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -28,6 +30,11 @@ public interface LedgerProjectMapper extends MPJBaseMapper<LedgerProject> ...@@ -28,6 +30,11 @@ public interface LedgerProjectMapper extends MPJBaseMapper<LedgerProject>
* @return 基础数据-项目集合 * @return 基础数据-项目集合
*/ */
public List<LedgerProject> selectLedgerProjectList(LedgerProject ledgerProject); public List<LedgerProject> selectLedgerProjectList(LedgerProject ledgerProject);
public List<LedgerProject> getLedgerProjectList(@Param("name")String name,@Param("areaName") String areaName);
public Long getProjectCount(@Param("areaName") String areaName);
public Long getBuildingCount(@Param("areaName") String areaName,@Param("projectId") Long projectId);
public Long getFloorCount(@Param("areaName") String areaName,@Param("projectId") Long projectId);
/** /**
* 新增基础数据-项目 * 新增基础数据-项目
......
...@@ -2,10 +2,11 @@ package com.censoft.censoftrongtong.mapper; ...@@ -2,10 +2,11 @@ package com.censoft.censoftrongtong.mapper;
import com.censoft.censoftrongtong.domain.RiskPlanExistingList; import com.censoft.censoftrongtong.domain.RiskPlanExistingList;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto; import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto;
import com.censoft.censoftrongtong.domain.dto.statistics.*;
import com.github.yulichang.base.MPJBaseMapper; import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.*;
/** /**
* 现有风险清单库Mapper接口 * 现有风险清单库Mapper接口
...@@ -13,7 +14,42 @@ import java.util.List; ...@@ -13,7 +14,42 @@ import java.util.List;
* @author ruoyi * @author ruoyi
* @date 2023-06-26 * @date 2023-06-26
*/ */
public interface RiskPlanExistingListMapper extends MPJBaseMapper<RiskPlanExistingList> { public interface RiskPlanExistingListMapper extends MPJBaseMapper<RiskPlanExistingList> {
/**
* 风险数量,年度风险数量
*
* @param areaName
* @param beginTime
* @return
*/
public Long getNationalRiskNum(@Param("areaName") String areaName, @Param("beginTime") Date beginTime,@Param("projectId")Long projectId);
/**
* 总体风险指数排名
*
* @param areaName
* @return
*/
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName);
/**
* 年度风险数量统计
*
* @param areaName
* @return
*/
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(@Param("areaName") String areaName,@Param("projectId")Long projectId);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(@Param("areaName") String areaName, @Param("level") String level);
public List<RiskMapStatisticsDto> getRiskMapStatistics(MapStatisticsQueryDto queryDto);
public List<ProjectRiskInfoDto> getProjectRiskInfo(@Param("projectId") Long projectId, @Param("buildingId") Long buildingId, @Param("floorId") Long floorId,@Param("level")String level);
/** /**
* 查询现有风险清单库 * 查询现有风险清单库
...@@ -31,6 +67,7 @@ public interface RiskPlanExistingListMapper extends MPJBaseMapper<RiskPlanExist ...@@ -31,6 +67,7 @@ public interface RiskPlanExistingListMapper extends MPJBaseMapper<RiskPlanExist
*/ */
public List<RiskPlanExistingList> selectRiskPlanExistingListList(RiskPlanExistingList riskPlanExistingList); public List<RiskPlanExistingList> selectRiskPlanExistingListList(RiskPlanExistingList riskPlanExistingList);
/** /**
* 新增现有风险清单库 * 新增现有风险清单库
* *
......
...@@ -2,20 +2,56 @@ package com.censoft.censoftrongtong.mapper; ...@@ -2,20 +2,56 @@ package com.censoft.censoftrongtong.mapper;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList; import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.*; import com.censoft.censoftrongtong.domain.dto.*;
import com.censoft.censoftrongtong.domain.dto.statistics.*;
import com.github.yulichang.base.MPJBaseMapper; import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
/** /**
* 固有风险清单库Mapper接口 * 固有风险清单库Mapper接口
* *
* @author ruoyi * @author ruoyi
* @date 2023-06-26 * @date 2023-06-26
*/ */
public interface RiskPlanInherentListMapper extends MPJBaseMapper<RiskPlanInherentList> public interface RiskPlanInherentListMapper extends MPJBaseMapper<RiskPlanInherentList> {
{ /**
* 风险数量,年度风险数量
*
* @param areaName
* @param beginTime
* @return
*/
public Long getNationalRiskNum(@Param("areaName") String areaName, @Param("beginTime") Date beginTime, @Param("projectId") Long projectId);
/**
* 总体风险指数排名
*
* @param areaName
* @return
*/
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName);
/**
* 年度风险数量统计
*
* @param areaName
* @return
*/
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(@Param("areaName") String areaName, @Param("projectId") Long projectId);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(@Param("areaName") String areaName, @Param("level") String level);
public List<ProjectRiskInfoDto> getProjectRiskInfo(@Param("projectId") Long projectId, @Param("buildingId") Long buildingId, @Param("floorId") Long floorId,@Param("level")String level);
public List<RiskMapStatisticsDto> getRiskMapStatistics(MapStatisticsQueryDto queryDto);
/** /**
* 查询固有风险清单库 * 查询固有风险清单库
* *
......
...@@ -29,6 +29,11 @@ public interface ILedgerProjectService extends MPJBaseService<LedgerProject> ...@@ -29,6 +29,11 @@ public interface ILedgerProjectService extends MPJBaseService<LedgerProject>
* @return 基础数据-项目集合 * @return 基础数据-项目集合
*/ */
public List<LedgerProject> selectLedgerProjectList(LedgerProject ledgerProject); public List<LedgerProject> selectLedgerProjectList(LedgerProject ledgerProject);
public List<LedgerProject> getLedgerProjectList(String name,String areaName);
public Long getProjectCount(String areaName);
public Long getBuildingCount(String areaName,Long projectId);
public Long getFloorCount(String areaName,Long projectId);
/** /**
* 新增基础数据-项目 * 新增基础数据-项目
......
...@@ -3,18 +3,46 @@ package com.censoft.censoftrongtong.service; ...@@ -3,18 +3,46 @@ package com.censoft.censoftrongtong.service;
import com.censoft.censoftrongtong.domain.RiskPlanExistingList; import com.censoft.censoftrongtong.domain.RiskPlanExistingList;
import com.censoft.censoftrongtong.domain.dto.RiskExistingListSaveDto; import com.censoft.censoftrongtong.domain.dto.RiskExistingListSaveDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto; import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto;
import com.censoft.censoftrongtong.domain.dto.statistics.*;
import com.github.yulichang.base.MPJBaseService; import com.github.yulichang.base.MPJBaseService;
import java.util.List; import java.util.*;
/** /**
* 现有风险清单库Service接口 * 现有风险清单库Service接口
* *
* @author ruoyi * @author ruoyi
* @date 2023-06-26 * @date 2023-06-26
*/ */
public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanExistingList> public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanExistingList> {
{
/**
* 风险数量,年度风险数量
*
* @param areaName
* @param beginTime
* @return
*/
public Long getNationalRiskNum(String areaName, Date beginTime,Long peojectId);
/**
* 总体风险指数排名
*
* @param areaName
* @return
*/
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName);
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(String areaName,Long projectId);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(String areaName,String level);
public List<RiskMapStatisticsDto> getRiskMapStatistics(MapStatisticsQueryDto queryDto);
public List<ProjectRiskInfoDto> getProjectRiskInfo(Long projectId, Long buildingId, Long floorId,String level);
/** /**
* 查询现有风险清单库 * 查询现有风险清单库
...@@ -32,6 +60,10 @@ public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanEx ...@@ -32,6 +60,10 @@ public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanEx
*/ */
public List<RiskPlanExistingList> selectRiskPlanExistingListList(RiskPlanExistingList riskPlanExistingList); public List<RiskPlanExistingList> selectRiskPlanExistingListList(RiskPlanExistingList riskPlanExistingList);
/** /**
* 新增现有风险清单库 * 新增现有风险清单库
* *
...@@ -65,5 +97,6 @@ public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanEx ...@@ -65,5 +97,6 @@ public interface IRiskPlanExistingListService extends MPJBaseService<RiskPlanEx
public int deleteRiskPlanExistingListById(Long id); public int deleteRiskPlanExistingListById(Long id);
Boolean saveRiskExistingListSaveDto(RiskExistingListSaveDto saveDto); Boolean saveRiskExistingListSaveDto(RiskExistingListSaveDto saveDto);
RiskPlanAppExistingListDetailsDto getRiskPlanAppExistingListDetailsDtoByExistingId(Long existingId); RiskPlanAppExistingListDetailsDto getRiskPlanAppExistingListDetailsDtoByExistingId(Long existingId);
} }
...@@ -2,10 +2,13 @@ package com.censoft.censoftrongtong.service; ...@@ -2,10 +2,13 @@ package com.censoft.censoftrongtong.service;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList; import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.*; import com.censoft.censoftrongtong.domain.dto.*;
import com.censoft.censoftrongtong.domain.dto.statistics.*;
import com.github.yulichang.base.MPJBaseService; import com.github.yulichang.base.MPJBaseService;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
/** /**
...@@ -17,6 +20,34 @@ import java.util.List; ...@@ -17,6 +20,34 @@ import java.util.List;
public interface IRiskPlanInherentListService extends MPJBaseService<RiskPlanInherentList> public interface IRiskPlanInherentListService extends MPJBaseService<RiskPlanInherentList>
{ {
/**
* 风险数量,年度风险数量
*
* @param areaName
* @param beginTime
* @return
*/
public Long getNationalRiskNum(String areaName, Date beginTime, Long peojectId);
/**
* 总体风险指数排名
*
* @param areaName
* @return
*/
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName);
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName);
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(String areaName,Long projectId);
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName);
public List<RiskProjectRankingDto> getRiskProjectRanking(String areaName, String level);
public List<ProjectRiskInfoDto> getProjectRiskInfo(Long projectId, Long buildingId, Long floorId,String level);
public List<RiskMapStatisticsDto> getRiskMapStatistics(MapStatisticsQueryDto queryDto);
/** /**
* 查询固有风险清单库 * 查询固有风险清单库
* *
......
...@@ -166,7 +166,9 @@ public class InfoLedgerServiceImpl extends MPJBaseServiceImpl<InfoLedgerMapper, ...@@ -166,7 +166,9 @@ public class InfoLedgerServiceImpl extends MPJBaseServiceImpl<InfoLedgerMapper,
ledgerProject.setInfoAssetsId(infoLedger.getId()); ledgerProject.setInfoAssetsId(infoLedger.getId());
ledgerProject.setName(infoLedger.getName()); ledgerProject.setName(infoLedger.getName());
ledgerProject.setType(infoLedger.getBusiness_type()); ledgerProject.setType(infoLedger.getBusiness_type());
ledgerProject.setCity(infoLedger.getProvince_name());
ledgerProject.setCity(infoLedger.getCity_name()); ledgerProject.setCity(infoLedger.getCity_name());
ledgerProject.setCity(infoLedger.getDistrict_name());
ledgerProject.setAddress(infoLedger.getName()); ledgerProject.setAddress(infoLedger.getName());
ledgerProject.setDelFlag("0"); ledgerProject.setDelFlag("0");
ledgerProject.setStatus("0"); ledgerProject.setStatus("0");
......
...@@ -52,6 +52,33 @@ public class LedgerProjectServiceImpl extends MPJBaseServiceImpl<LedgerProjectMa ...@@ -52,6 +52,33 @@ public class LedgerProjectServiceImpl extends MPJBaseServiceImpl<LedgerProjectMa
return ledgerProjectMapper.selectLedgerProjectList(ledgerProject); return ledgerProjectMapper.selectLedgerProjectList(ledgerProject);
} }
/**
* 查询基础数据-项目列表
*
* @return 基础数据-项目
*/
@Override
public List<LedgerProject> getLedgerProjectList(String name,String areaName)
{
return ledgerProjectMapper.getLedgerProjectList(name,areaName);
}
@Override
public Long getBuildingCount(String areaName,Long projectId)
{
return ledgerProjectMapper.getBuildingCount(areaName,projectId);
}
@Override
public Long getProjectCount(String areaName)
{
return ledgerProjectMapper.getProjectCount(areaName);
}
@Override
public Long getFloorCount(String areaName,Long projectId)
{
return ledgerProjectMapper.getFloorCount(areaName,projectId);
}
/** /**
* 新增基础数据-项目 * 新增基础数据-项目
* *
......
...@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil; ...@@ -4,6 +4,7 @@ import cn.hutool.core.util.StrUtil;
import com.censoft.censoftrongtong.domain.RiskPlanExistingList; import com.censoft.censoftrongtong.domain.RiskPlanExistingList;
import com.censoft.censoftrongtong.domain.dto.RiskExistingListSaveDto; import com.censoft.censoftrongtong.domain.dto.RiskExistingListSaveDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto; import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto;
import com.censoft.censoftrongtong.domain.dto.statistics.*;
import com.censoft.censoftrongtong.mapper.RiskPlanExistingListMapper; import com.censoft.censoftrongtong.mapper.RiskPlanExistingListMapper;
import com.censoft.censoftrongtong.service.IRiskPlanExistingListService; import com.censoft.censoftrongtong.service.IRiskPlanExistingListService;
import com.github.yulichang.base.MPJBaseServiceImpl; import com.github.yulichang.base.MPJBaseServiceImpl;
...@@ -14,9 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,9 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -36,6 +35,51 @@ public class RiskPlanExistingListServiceImpl ...@@ -36,6 +35,51 @@ public class RiskPlanExistingListServiceImpl
private ISysUploadFileService uploadFileService; private ISysUploadFileService uploadFileService;
@Override
public Long getNationalRiskNum(String areaName, Date beginTime,Long peojectId) {
return riskPlanExistingListMapper.getNationalRiskNum(areaName, beginTime,peojectId);
}
@Override
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName) {
return riskPlanExistingListMapper.getRiskIndexRanking(areaName);
}
@Override
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName) {
return riskPlanExistingListMapper.getAnnualRiskStatistics(areaName);
}
@Override
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(String areaName,Long projectId) {
return riskPlanExistingListMapper.getRiskLevelStatistics(areaName,projectId);
}
@Override
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName) {
return riskPlanExistingListMapper.getAccidentTypeStatistics(areaName);
}
@Override
public List<RiskProjectRankingDto> getRiskProjectRanking(String areaName, String level) {
return riskPlanExistingListMapper.getRiskProjectRanking(areaName,level);
}
@Override
public List<ProjectRiskInfoDto> getProjectRiskInfo(Long projectId, Long buildingId, Long floorId, String level) {
return riskPlanExistingListMapper.getProjectRiskInfo(projectId,buildingId,floorId,level);
}
@Override
public List<RiskMapStatisticsDto> getRiskMapStatistics(MapStatisticsQueryDto queryDto) {
return riskPlanExistingListMapper.getRiskMapStatistics(queryDto);
}
/** /**
* 查询现有风险清单库 * 查询现有风险清单库
* *
...@@ -43,8 +87,7 @@ public class RiskPlanExistingListServiceImpl ...@@ -43,8 +87,7 @@ public class RiskPlanExistingListServiceImpl
* @return 现有风险清单库 * @return 现有风险清单库
*/ */
@Override @Override
public RiskPlanExistingList selectRiskPlanExistingListById(Long id) public RiskPlanExistingList selectRiskPlanExistingListById(Long id) {
{
return riskPlanExistingListMapper.selectRiskPlanExistingListById(id); return riskPlanExistingListMapper.selectRiskPlanExistingListById(id);
} }
...@@ -55,11 +98,11 @@ public class RiskPlanExistingListServiceImpl ...@@ -55,11 +98,11 @@ public class RiskPlanExistingListServiceImpl
* @return 现有风险清单库 * @return 现有风险清单库
*/ */
@Override @Override
public List<RiskPlanExistingList> selectRiskPlanExistingListList(RiskPlanExistingList riskPlanExistingList) public List<RiskPlanExistingList> selectRiskPlanExistingListList(RiskPlanExistingList riskPlanExistingList) {
{
return riskPlanExistingListMapper.selectRiskPlanExistingListList(riskPlanExistingList); return riskPlanExistingListMapper.selectRiskPlanExistingListList(riskPlanExistingList);
} }
/** /**
* 新增现有风险清单库 * 新增现有风险清单库
* *
...@@ -67,8 +110,7 @@ public class RiskPlanExistingListServiceImpl ...@@ -67,8 +110,7 @@ public class RiskPlanExistingListServiceImpl
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertRiskPlanExistingList(RiskPlanExistingList riskPlanExistingList) public int insertRiskPlanExistingList(RiskPlanExistingList riskPlanExistingList) {
{
riskPlanExistingList.setCreateTime(DateUtils.getNowDate()); riskPlanExistingList.setCreateTime(DateUtils.getNowDate());
return riskPlanExistingListMapper.insertRiskPlanExistingList(riskPlanExistingList); return riskPlanExistingListMapper.insertRiskPlanExistingList(riskPlanExistingList);
} }
...@@ -80,8 +122,7 @@ public class RiskPlanExistingListServiceImpl ...@@ -80,8 +122,7 @@ public class RiskPlanExistingListServiceImpl
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateRiskPlanExistingList(RiskPlanExistingList riskPlanExistingList) public int updateRiskPlanExistingList(RiskPlanExistingList riskPlanExistingList) {
{
riskPlanExistingList.setUpdateTime(DateUtils.getNowDate()); riskPlanExistingList.setUpdateTime(DateUtils.getNowDate());
return riskPlanExistingListMapper.updateRiskPlanExistingList(riskPlanExistingList); return riskPlanExistingListMapper.updateRiskPlanExistingList(riskPlanExistingList);
} }
...@@ -93,8 +134,7 @@ public class RiskPlanExistingListServiceImpl ...@@ -93,8 +134,7 @@ public class RiskPlanExistingListServiceImpl
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteRiskPlanExistingListByIds(Long[] ids) public int deleteRiskPlanExistingListByIds(Long[] ids) {
{
return riskPlanExistingListMapper.deleteRiskPlanExistingListByIds(ids); return riskPlanExistingListMapper.deleteRiskPlanExistingListByIds(ids);
} }
...@@ -105,14 +145,13 @@ public class RiskPlanExistingListServiceImpl ...@@ -105,14 +145,13 @@ public class RiskPlanExistingListServiceImpl
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteRiskPlanExistingListById(Long id) public int deleteRiskPlanExistingListById(Long id) {
{
return riskPlanExistingListMapper.deleteRiskPlanExistingListById(id); return riskPlanExistingListMapper.deleteRiskPlanExistingListById(id);
} }
@Override @Override
public RiskPlanAppExistingListDetailsDto getRiskPlanAppExistingListDetailsDtoByExistingId(Long existingId) { public RiskPlanAppExistingListDetailsDto getRiskPlanAppExistingListDetailsDtoByExistingId(Long existingId) {
RiskPlanAppExistingListDetailsDto dto = riskPlanExistingListMapper.getRiskPlanAppExistingListDetailsDtoByExistingId(existingId); RiskPlanAppExistingListDetailsDto dto = riskPlanExistingListMapper.getRiskPlanAppExistingListDetailsDtoByExistingId(existingId);
//风险源照片 //风险源照片
if (!StrUtil.hasEmpty(dto.getPictureFileIds())) { if (!StrUtil.hasEmpty(dto.getPictureFileIds())) {
......
...@@ -8,6 +8,7 @@ import com.censoft.censoftrongtong.domain.RiskPlan; ...@@ -8,6 +8,7 @@ import com.censoft.censoftrongtong.domain.RiskPlan;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList; import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.RiskPlanTask; import com.censoft.censoftrongtong.domain.RiskPlanTask;
import com.censoft.censoftrongtong.domain.dto.*; import com.censoft.censoftrongtong.domain.dto.*;
import com.censoft.censoftrongtong.domain.dto.statistics.*;
import com.censoft.censoftrongtong.enums.RiskPlanStatusType; import com.censoft.censoftrongtong.enums.RiskPlanStatusType;
import com.censoft.censoftrongtong.mapper.RiskPlanInherentListMapper; import com.censoft.censoftrongtong.mapper.RiskPlanInherentListMapper;
import com.censoft.censoftrongtong.mapper.RiskPlanMapper; import com.censoft.censoftrongtong.mapper.RiskPlanMapper;
...@@ -18,6 +19,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl; ...@@ -18,6 +19,7 @@ import com.github.yulichang.base.MPJBaseServiceImpl;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.WordUtil; import com.ruoyi.common.utils.WordUtil;
import com.ruoyi.system.service.ISysUploadFileService; import com.ruoyi.system.service.ISysUploadFileService;
import org.apache.ibatis.annotations.Param;
import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -56,6 +58,48 @@ public class RiskPlanInherentListServiceImpl ...@@ -56,6 +58,48 @@ public class RiskPlanInherentListServiceImpl
@Resource @Resource
private IRiskPlanTaskService riskPlanTaskService; private IRiskPlanTaskService riskPlanTaskService;
@Override
public Long getNationalRiskNum(String areaName, Date beginTime,Long peojectId) {
return riskPlanInherentListMapper.getNationalRiskNum(areaName, beginTime,peojectId);
}
@Override
public List<RiskIndexRankingDto> getRiskIndexRanking(String areaName) {
return riskPlanInherentListMapper.getRiskIndexRanking(areaName);
}
@Override
public LinkedHashMap<String, Long> getAnnualRiskStatistics(String areaName) {
return riskPlanInherentListMapper.getAnnualRiskStatistics(areaName);
}
@Override
public List<RiskLevelStatisticsDto> getRiskLevelStatistics(String areaName,Long projectId) {
return riskPlanInherentListMapper.getRiskLevelStatistics(areaName,projectId);
}
@Override
public List<AccidentTypeStatisticsDto> getAccidentTypeStatistics(String areaName) {
return riskPlanInherentListMapper.getAccidentTypeStatistics(areaName);
}
@Override
public List<RiskProjectRankingDto> getRiskProjectRanking(String areaName, String level) {
return riskPlanInherentListMapper.getRiskProjectRanking(areaName,level);
}
@Override
public List<ProjectRiskInfoDto> getProjectRiskInfo( Long projectId, Long buildingId, Long floorId,String level) {
return riskPlanInherentListMapper.getProjectRiskInfo(projectId,buildingId,floorId,level);
}
@Override
public List<RiskMapStatisticsDto> getRiskMapStatistics(MapStatisticsQueryDto queryDto) {
return riskPlanInherentListMapper.getRiskMapStatistics(queryDto);
}
/** /**
* 新增固有风险清单库 * 新增固有风险清单库
* *
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.censoft.censoftrongtong.mapper.LedgerProjectMapper"> <mapper namespace="com.censoft.censoftrongtong.mapper.LedgerProjectMapper">
<resultMap type="com.censoft.censoftrongtong.domain.LedgerProject" id="LedgerProjectResult"> <resultMap type="com.censoft.censoftrongtong.domain.LedgerProject" id="LedgerProjectResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="type" column="type" /> <result property="type" column="type"/>
<result property="business" column="business" /> <result property="business" column="business"/>
<result property="deptId" column="dept_id" /> <result property="deptId" column="dept_id"/>
<result property="city" column="city" /> <result property="province" column="province"/>
<result property="address" column="address" /> <result property="city" column="city"/>
<result property="source" column="source" /> <result property="district" column="district"/>
<result property="infoAssetsId" column="info_assets_id" /> <result property="street" column="street"/>
<result property="status" column="status" /> <result property="address" column="address"/>
<result property="delFlag" column="del_flag" /> <result property="source" column="source"/>
<result property="businessStatus" column="business_status" /> <result property="infoAssetsId" column="info_assets_id"/>
<result property="propertyManagement" column="property_management" /> <result property="status" column="status"/>
<result property="createBy" column="create_by" /> <result property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time" /> <result property="businessStatus" column="business_status"/>
<result property="updateBy" column="update_by" /> <result property="propertyManagement" column="property_management"/>
<result property="updateTime" column="update_time" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="lat" column="lat"/>
<result property="lng" column="lng"/>
</resultMap> </resultMap>
<sql id="selectLedgerProjectVo"> <sql id="selectLedgerProjectVo">
select id, name, type,business, dept_id, city, address, source, info_assets_id,status, del_flag, business_status, property_management, create_by, create_time, update_by, update_time from ledger_project select id,
name,
type,
business,
dept_id,
province,
city,
district,
street,
address,
source,
info_assets_id,
status,
del_flag,
business_status,
property_management,
create_by,
create_time,
update_by,
update_time,
lat,
lng
from ledger_project
</sql> </sql>
<select id="selectLedgerProjectList" parameterType="com.censoft.censoftrongtong.domain.LedgerProject" resultMap="LedgerProjectResult"> <select id="getProjectCount" resultType="java.lang.Long">
select count(1) from ledger_project
<where>
AND del_flag = '0' and status =0
<if test="areaName != null and areaName != ''">
and (
province = #{areaName}
or city = #{areaName}
or district = #{areaName}
)
</if>
</where>
</select>
<select id="getBuildingCount" resultType="java.lang.Long">
select count(1) from ledger_building b
inner join ledger_project p on b.project_id=p.id
<where>
AND b.del_flag = '0' and b.status =0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
<if test="projectId != null">
and p.id=#{projectId}
</if>
</where>
</select>
<select id="getFloorCount" resultType="java.lang.Long">
SELECT count(1) FROM ledger_floor f
inner JOIN ledger_building b ON f.building_id =b.id
inner JOIN ledger_project p ON b.project_id = p.id
<where>
AND f.del_flag = '0' and f.status =0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
<if test="projectId != null">
and p.id=#{projectId}
</if>
</where>
</select>
<select id="getLedgerProjectList" resultMap="LedgerProjectResult">
SELECT
p.id,
p.NAME,
p.type,
p.business,
p.dept_id,
d.dept_name,
p.province,
p.city,
p.district,
p.street,
p.address,
p.source,
p.info_assets_id,
p.STATUS,
p.del_flag,
p.create_by,
p.create_time,
p.update_by,
p.update_time,
p.lat,
p.lng
FROM
ledger_project p
LEFT JOIN sys_dept d ON p.dept_id = d.dept_id
<where>
<if test="name != null and name != ''">
and (
p.name like concat('%', #{name}, '%')
or p.address like concat('%', #{name}, '%')
or d.dept_name like concat('%', #{name}, '%')
)
</if>
<if test="areaName != null and areaName != ''">
and (
p.province like concat('%', #{areaName}, '%')
or p.city like concat('%', #{areaName}, '%')
or p.district like concat('%', #{areaName}, '%')
)
</if>
AND p.del_flag = '0'
</where>
</select>
<select id="selectLedgerProjectList" parameterType="com.censoft.censoftrongtong.domain.LedgerProject"
resultMap="LedgerProjectResult">
SELECT SELECT
p.id, p.id,
p.NAME, p.NAME,
...@@ -36,7 +162,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -36,7 +162,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.business, p.business,
p.dept_id, p.dept_id,
d.dept_name, d.dept_name,
p.province,
p.city, p.city,
p.district,
p.street,
p.address, p.address,
p.source, p.source,
p.info_assets_id, p.info_assets_id,
...@@ -49,60 +178,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -49,60 +178,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM FROM
ledger_project p ledger_project p
LEFT JOIN sys_dept d ON p.dept_id = d.dept_id LEFT JOIN sys_dept d ON p.dept_id = d.dept_id
<where> <where>
<if test="name != null and name != ''"> and p.name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and p.name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and p.type like concat('%', #{type}, '%')</if> <if test="type != null and type != ''">and p.type like concat('%', #{type}, '%')</if>
<if test="business != null and business != ''"> and p.business = #{business}</if> <if test="business != null and business != ''">and p.business = #{business}</if>
<if test="deptId != null "> and ( d.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors) )</if> <if test="deptId != null ">and ( d.dept_id = #{deptId} or find_in_set(#{deptId},d.ancestors) )</if>
<if test="city != null and city != ''"> and p.city like concat('%', #{city}, '%')</if> <if test="province != null and province != ''">and p.province like concat('%', #{province}, '%')</if>
<if test="address != null and address != ''"> and p.address like concat('%', #{address}, '%')</if> <if test="city != null and city != ''">and p.city like concat('%', #{city}, '%')</if>
<if test="source != null and source != ''"> and p.source = #{source}</if> <if test="district != null and district != ''">and p.district like concat('%', #{district}, '%')</if>
<if test="status != null and status != ''"> and p.status = #{status}</if> <if test="street != null and street != ''">and p.street like concat('%', #{street}, '%')</if>
<if test="businessStatus != null and businessStatus != ''"> and p.business_status = #{businessStatus}</if> <if test="address != null and address != ''">and p.address like concat('%', #{address}, '%')</if>
<if test="propertyManagement != null"> and p.property_management = #{propertyManagement}</if> <if test="source != null and source != ''">and p.source = #{source}</if>
<if test="status != null and status != ''">and p.status = #{status}</if>
<if test="businessStatus != null and businessStatus != ''">and p.business_status = #{businessStatus}</if>
<if test="propertyManagement != null">and p.property_management = #{propertyManagement}</if>
AND p.del_flag = '0' AND p.del_flag = '0'
</where> </where>
</select> </select>
<select id="selectLedgerProjectById" parameterType="Long" resultMap="LedgerProjectResult"> <select id="selectLedgerProjectById" parameterType="Long" resultMap="LedgerProjectResult">
<include refid="selectLedgerProjectVo"/> <include refid="selectLedgerProjectVo"/>
where id = #{id} AND del_flag = '0' where id = #{id} AND del_flag = '0'
</select> </select>
<select id="getProjectListByDeptId" parameterType="com.censoft.censoftrongtong.domain.LedgerProject" resultMap="LedgerProjectResult"> <select id="getProjectListByDeptId" parameterType="com.censoft.censoftrongtong.domain.LedgerProject"
resultMap="LedgerProjectResult">
SELECT SELECT
lp.id, lp.id,
lp.NAME, lp.NAME,
lp.type, lp.type,
lp.business, lp.business,
lp.dept_id, lp.dept_id,
lp.city, lp.city,
lp.address, lp.address,
lp.source, lp.source,
lp.business_status, lp.business_status,
lp.property_management, lp.property_management,
lp.info_assets_id, lp.info_assets_id,
lp.STATUS, lp.STATUS,
lp.del_flag, lp.del_flag,
lp.create_by, lp.create_by,
lp.create_time, lp.create_time,
lp.update_by, lp.update_by,
lp.update_time lp.update_time
FROM FROM
ledger_project lp ledger_project lp
WHERE WHERE
( lp.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = #{deptId} OR find_in_set( #{deptId}, ancestors ) ) ) ( lp.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = #{deptId} OR find_in_set( #{deptId}, ancestors )
AND lp.STATUS = '0' AND lp.del_flag = '0' ) )
<if test="name != null and name != ''"> and lp.name like concat('%', #{name}, '%')</if> AND lp.STATUS = '0' AND lp.del_flag = '0'
<if test="name != null and name != ''">and lp.name like concat('%', #{name}, '%')</if>
</select> </select>
<insert id="insertLedgerProject" parameterType="com.censoft.censoftrongtong.domain.LedgerProject" useGeneratedKeys="true" keyProperty="id"> <insert id="insertLedgerProject" parameterType="com.censoft.censoftrongtong.domain.LedgerProject"
useGeneratedKeys="true" keyProperty="id">
insert into ledger_project insert into ledger_project
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if> <if test="name != null">name,</if>
<if test="type != null">type,</if> <if test="type != null">type,</if>
<if test="business != null">business,</if> <if test="business != null">business,</if>
<if test="deptId != null">dept_id,</if> <if test="deptId != null">dept_id,</if>
<if test="province != null">province,</if>
<if test="city != null">city,</if> <if test="city != null">city,</if>
<if test="district != null">district,</if>
<if test="street != null">street,</if>
<if test="address != null">address,</if> <if test="address != null">address,</if>
<if test="source != null">source,</if> <if test="source != null">source,</if>
<if test="infoAssetsId != null">info_assets_id,</if> <if test="infoAssetsId != null">info_assets_id,</if>
...@@ -114,13 +252,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -114,13 +252,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
</trim> <if test="lat != null and lat != ''">lat,</if>
<if test="lng != null and lat != ''">lng,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if> <if test="name != null">#{name},</if>
<if test="type != null">#{type},</if> <if test="type != null">#{type},</if>
<if test="business != null">#{business},</if> <if test="business != null">#{business},</if>
<if test="deptId != null">#{deptId},</if> <if test="deptId != null">#{deptId},</if>
<if test="province != null">#{province},</if>
<if test="city != null">#{city},</if> <if test="city != null">#{city},</if>
<if test="district != null">#{district},</if>
<if test="street != null">#{street},</if>
<if test="address != null">#{address},</if> <if test="address != null">#{address},</if>
<if test="source != null">#{source},</if> <if test="source != null">#{source},</if>
<if test="infoAssetsId != null">#{infoAssetsId},</if> <if test="infoAssetsId != null">#{infoAssetsId},</if>
...@@ -132,7 +275,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -132,7 +275,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
</trim> <if test="lat != null and lat != ''">#{lat},</if>
<if test="lng != null and lat != ''">#{lng},</if>
</trim>
</insert> </insert>
<update id="updateLedgerProject" parameterType="com.censoft.censoftrongtong.domain.LedgerProject"> <update id="updateLedgerProject" parameterType="com.censoft.censoftrongtong.domain.LedgerProject">
...@@ -142,7 +287,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -142,7 +287,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null">type = #{type},</if> <if test="type != null">type = #{type},</if>
<if test="business != null">business = #{business},</if> <if test="business != null">business = #{business},</if>
<if test="deptId != null">dept_id = #{deptId},</if> <if test="deptId != null">dept_id = #{deptId},</if>
<if test="province != null">province = #{province},</if>
<if test="city != null">city = #{city},</if> <if test="city != null">city = #{city},</if>
<if test="district != null">district = #{district},</if>
<if test="street != null">street = #{street},</if>
<if test="address != null">address = #{address},</if> <if test="address != null">address = #{address},</if>
<if test="source != null">source = #{source},</if> <if test="source != null">source = #{source},</if>
<if test="infoAssetsId != null">info_assets_id = #{infoAssetsId},</if> <if test="infoAssetsId != null">info_assets_id = #{infoAssetsId},</if>
...@@ -154,12 +302,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -154,12 +302,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="lat != null and lat != ''">lat = #{lat},</if>
<if test="lng != null and lat != ''">lng = #{lng},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
<delete id="deleteLedgerProjectById" parameterType="Long"> <delete id="deleteLedgerProjectById" parameterType="Long">
update ledger_project set del_flag = '1' where id = #{id} update ledger_project
set del_flag = '1'
where id = #{id}
</delete> </delete>
<delete id="deleteLedgerProjectByIds" parameterType="String"> <delete id="deleteLedgerProjectByIds" parameterType="String">
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.censoft.censoftrongtong.mapper.RiskPlanExistingListMapper"> <mapper namespace="com.censoft.censoftrongtong.mapper.RiskPlanExistingListMapper">
<resultMap type="com.censoft.censoftrongtong.domain.RiskPlanExistingList" id="RiskPlanExistingListResult"> <resultMap type="com.censoft.censoftrongtong.domain.RiskPlanExistingList" id="RiskPlanExistingListResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="userId" column="user_id" /> <result property="userId" column="user_id"/>
<result property="inherentId" column="inherent_id" /> <result property="inherentId" column="inherent_id"/>
<result property="planId" column="plan_id" /> <result property="planId" column="plan_id"/>
<result property="roomId" column="room_id" /> <result property="roomId" column="room_id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="factor" column="factor" /> <result property="factor" column="factor"/>
<result property="type" column="type" /> <result property="type" column="type"/>
<result property="level" column="level" /> <result property="level" column="level"/>
<result property="presenceLocation" column="presence_location" /> <result property="presenceLocation" column="presence_location"/>
<result property="pictureFileIds" column="picture_file_ids" /> <result property="pictureFileIds" column="picture_file_ids"/>
<result property="measuresProject" column="measures_project" /> <result property="measuresProject" column="measures_project"/>
<result property="measuresProjectFileIds" column="measures_project_file_ids" /> <result property="measuresProjectFileIds" column="measures_project_file_ids"/>
<result property="measuresAdministration" column="measures_administration" /> <result property="measuresAdministration" column="measures_administration"/>
<result property="measuresDeptName" column="measures_dept_name" /> <result property="measuresDeptName" column="measures_dept_name"/>
<result property="measuresUserName" column="measures_user_name" /> <result property="measuresUserName" column="measures_user_name"/>
<result property="measuresUserPhone" column="measures_user_phone" /> <result property="measuresUserPhone" column="measures_user_phone"/>
<result property="measuresAdministrationFileIds" column="measures_administration_file_ids" /> <result property="measuresAdministrationFileIds" column="measures_administration_file_ids"/>
<result property="measuresEmergency" column="measures_emergency" /> <result property="measuresEmergency" column="measures_emergency"/>
<result property="measuresEmergencyFileIds" column="measures_emergency_file_ids" /> <result property="measuresEmergencyFileIds" column="measures_emergency_file_ids"/>
<result property="referenceBasis" column="reference_basis" /> <result property="referenceBasis" column="reference_basis"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<result property="remark" column="remark" /> <result property="remark" column="remark"/>
<result property="evaluationItemIds" column="evaluation_item_ids" /> <result property="evaluationItemIds" column="evaluation_item_ids"/>
<result property="factorItems" column="factor_items" /> <result property="factorItems" column="factor_items"/>
</resultMap> </resultMap>
<sql id="selectRiskPlanExistingListVo"> <sql id="selectRiskPlanExistingListVo">
select id, user_id, inherent_id, plan_id, room_id, name, factor, type, level, presence_location, picture_file_ids, measures_project, measures_project_file_ids, measures_administration, measures_dept_name, measures_user_name, measures_user_phone, measures_administration_file_ids, measures_emergency, measures_emergency_file_ids, reference_basis, del_flag, create_by, create_time, update_by, update_time, remark,evaluationItemIds,factor_items from risk_plan_existing_list select id,
user_id,
inherent_id,
plan_id,
room_id,
name,
factor,
type,
level,
presence_location,
picture_file_ids,
measures_project,
measures_project_file_ids,
measures_administration,
measures_dept_name,
measures_user_name,
measures_user_phone,
measures_administration_file_ids,
measures_emergency,
measures_emergency_file_ids,
reference_basis,
del_flag,
create_by,
create_time,
update_by,
update_time,
remark,
evaluationItemIds,
factor_items
from risk_plan_existing_list
</sql> </sql>
<select id="selectRiskPlanExistingListList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanExistingList" resultMap="RiskPlanExistingListResult"> <select id="getAnnualRiskStatistics" resultType="java.util.LinkedHashMap">
SELECT
count( MONTH ( rpil.create_time ) = 1 or null) AS 1月,
count( MONTH ( rpil.create_time ) = 2 or null) AS 2月,
count( MONTH ( rpil.create_time ) = 3 or null) AS 3月,
count( MONTH ( rpil.create_time ) = 4 or null) AS 4月,
count( MONTH ( rpil.create_time ) = 5 or null) AS 5月,
count( MONTH ( rpil.create_time ) = 6 or null) AS 6月,
count( MONTH ( rpil.create_time ) = 7 or null) AS 7月,
count( MONTH ( rpil.create_time ) = 8 or null) AS 8月,
count( MONTH ( rpil.create_time ) = 9 or null) AS 9月,
count( MONTH ( rpil.create_time ) = 10 or null) AS 10月,
count( MONTH ( rpil.create_time ) = 11 or null) AS 11月,
count( MONTH ( rpil.create_time ) = 12 or null) AS 12月
FROM risk_plan_existing_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
</where>
</select>
<select id="getRiskProjectRanking"
resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskProjectRankingDto">
SELECT p.name projectName,count(1) RiskScore,d.dept_name deptName,p.province FROM risk_plan_existing_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
inner JOIN sys_dept d ON p.dept_id = d.dept_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
</where>
group by p.id,p.name ORDER BY RiskScore desc
</select>
<select id="getAccidentTypeStatistics"
resultType="com.censoft.censoftrongtong.domain.dto.statistics.AccidentTypeStatisticsDto">
select dict_label typeName, COUNT(1) typeNum
FROM (select dict_label from sys_dict_data where dict_type = 'risk_plan_type') a
left join
risk_plan_existing_list rpil
on FIND_IN_SET(a.dict_label, rpil.type)
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
</where>
GROUP BY dict_label
ORDER BY typeNum desc
</select>
<select id="getRiskLevelStatistics"
resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskLevelStatisticsDto">
SELECT rpil.level levelName, count(1) levelNum
FROM risk_plan_existing_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
<if test="projectId != null">
and p.id=#{projectId}
</if>
</where>
group by rpil.level ORDER BY levelNum desc
</select>
<select id="getRiskIndexRanking" resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskIndexRankingDto">
SELECT p.name projectName,count(1) RiskNum,d.dept_name deptName,p.province FROM risk_plan_existing_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
inner JOIN sys_dept d ON p.dept_id = d.dept_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
</where>
group by p.id,p.name ORDER BY RiskNum desc
</select>
<select id="getNationalRiskNum" resultType="java.lang.Long">
SELECT count(1) FROM risk_plan_existing_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
<if test="beginTime != null">
and (
date_format(rpil.create_time,'%y%m%d') >= date_format(#{beginTime},'%Y-%m-%d')
)
</if>
<if test="projectId != null">
and p.id=#{projectId}
</if>
</where>
</select>
<select id="getProjectRiskInfo" resultType="com.censoft.censoftrongtong.domain.dto.statistics.ProjectRiskInfoDto">
SELECT
rpil.id, rpil.hazard_source_name riskName,rpil.level levelName,'现状' typeName
FROM
risk_plan_existing_list rpil
LEFT JOIN ledger_room lr ON lr.id = rpil.room_id
LEFT JOIN ledger_floor lf ON lf.id = floor_id
LEFT JOIN ledger_building lb ON lb.id = lf.building_id
<where>
<if test="projectId != null">AND lb.project_id = #{projectId}</if>
<if test="buildingId != null">AND lf.building_id = #{buildingId}</if>
<if test="floorId != null">AND lf.id = #{floorId}</if>
<if test="level != null and level != ''">AND rpil.level = #{level}</if>
AND rpil.del_flag = '0'
AND lr.del_flag = '0'
AND lr.`status` = '0'
AND lf.del_flag = '0'
AND lf.`status` = '0'
AND lb.del_flag = '0'
AND lb.`status` = '0'
</where>
ORDER BY
rpil.create_time DESC
</select>
<select id="getRiskMapStatistics"
parameterType="com.censoft.censoftrongtong.domain.dto.statistics.MapStatisticsQueryDto"
resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskMapStatisticsDto">
SELECT p.${levelName} areaName,
COUNT(1) riskNum
FROM risk_plan_existing_list rpil
INNER JOIN ledger_room lr ON lr.id = rpil.room_id
INNER JOIN ledger_floor lf ON lf.id = floor_id
INNER JOIN ledger_building lb ON lb.id = lf.building_id
INNER JOIN ledger_project p ON p.id = lb.project_id
<where>
AND rpil.del_flag = '0'
AND lr.del_flag = '0'
AND lr.`status` = '0'
AND lf.del_flag = '0'
AND lf.`status` = '0'
AND lb.del_flag = '0'
AND lb.`status` = '0'
<if test="areaName != null and areaName != '' and level != 1">
AND p.${parentLevel} like concat('%', #{areaName}, '%')
</if>
</where>
<if test="levelName != null and levelName != ''">
group by p.${levelName}
</if>
</select>
<select id="selectRiskPlanExistingListList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanExistingList"
resultMap="RiskPlanExistingListResult">
SELECT SELECT
rpil.id, rpil.id,
lb.id AS buildingId, lb.id AS buildingId,
...@@ -86,26 +315,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -86,26 +315,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN sys_dict_data sdd ON sdd.dict_label = rpil.LEVEL LEFT JOIN sys_dict_data sdd ON sdd.dict_label = rpil.LEVEL
AND dict_type = 'risk_plan_level' AND dict_type = 'risk_plan_level'
<where> <where>
<if test="userId != null "> and rpil.user_id = #{userId}</if> <if test="userId != null ">and rpil.user_id = #{userId}</if>
<if test="roomId != null "> and rpil.room_id = #{roomId}</if> <if test="roomId != null ">and rpil.room_id = #{roomId}</if>
<if test="inherentId != null "> and rpil.inherent_id = #{inherentId}</if> <if test="inherentId != null ">and rpil.inherent_id = #{inherentId}</if>
<if test="planId != null "> and rpil.plan_id = #{planId}</if> <if test="planId != null ">and rpil.plan_id = #{planId}</if>
<if test="name != null and name != ''"> and rpil.name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and rpil.name like concat('%', #{name}, '%')</if>
<if test="factor != null and factor != ''"> and rpil.factor = #{factor}</if> <if test="factor != null and factor != ''">and rpil.factor = #{factor}</if>
<if test="type != null and type != ''"> and rpil.type = #{type}</if> <if test="type != null and type != ''">and rpil.type = #{type}</if>
<if test="level != null and level != ''"> and rpil.level = #{level}</if> <if test="level != null and level != ''">and rpil.level = #{level}</if>
<if test="presenceLocation != null and presenceLocation != ''"> and rpil.presence_location = #{presenceLocation}</if> <if test="presenceLocation != null and presenceLocation != ''">and rpil.presence_location =
<if test="pictureFileIds != null and pictureFileIds != ''"> and rpil.picture_file_ids = #{pictureFileIds}</if> #{presenceLocation}
<if test="measuresProject != null and measuresProject != ''"> and rpil.measures_project = #{measuresProject}</if> </if>
<if test="measuresProjectFileIds != null and measuresProjectFileIds != ''"> and rpil.measures_project_file_ids = #{measuresProjectFileIds}</if> <if test="pictureFileIds != null and pictureFileIds != ''">and rpil.picture_file_ids = #{pictureFileIds}
<if test="measuresAdministration != null and measuresAdministration != ''"> and rpil.measures_administration = #{measuresAdministration}</if> </if>
<if test="measuresDeptName != null and measuresDeptName != ''"> and rpil.measures_dept_name like concat('%', #{measuresDeptName}, '%')</if> <if test="measuresProject != null and measuresProject != ''">and rpil.measures_project =
<if test="measuresUserName != null and measuresUserName != ''"> and rpil.measures_user_name like concat('%', #{measuresUserName}, '%')</if> #{measuresProject}
<if test="measuresUserPhone != null and measuresUserPhone != ''"> and rpil.measures_user_phone = #{measuresUserPhone}</if> </if>
<if test="measuresAdministrationFileIds != null and measuresAdministrationFileIds != ''"> and rpil.measures_administration_file_ids = #{measuresAdministrationFileIds}</if> <if test="measuresProjectFileIds != null and measuresProjectFileIds != ''">and
<if test="measuresEmergency != null and measuresEmergency != ''"> and rpil.measures_emergency = #{measuresEmergency}</if> rpil.measures_project_file_ids = #{measuresProjectFileIds}
<if test="measuresEmergencyFileIds != null and measuresEmergencyFileIds != ''"> and rpil.measures_emergency_file_ids = #{measuresEmergencyFileIds}</if> </if>
<if test="referenceBasis != null and referenceBasis != ''"> and rpil.reference_basis = #{referenceBasis}</if> <if test="measuresAdministration != null and measuresAdministration != ''">and rpil.measures_administration
= #{measuresAdministration}
</if>
<if test="measuresDeptName != null and measuresDeptName != ''">and rpil.measures_dept_name like concat('%',
#{measuresDeptName}, '%')
</if>
<if test="measuresUserName != null and measuresUserName != ''">and rpil.measures_user_name like concat('%',
#{measuresUserName}, '%')
</if>
<if test="measuresUserPhone != null and measuresUserPhone != ''">and rpil.measures_user_phone =
#{measuresUserPhone}
</if>
<if test="measuresAdministrationFileIds != null and measuresAdministrationFileIds != ''">and
rpil.measures_administration_file_ids = #{measuresAdministrationFileIds}
</if>
<if test="measuresEmergency != null and measuresEmergency != ''">and rpil.measures_emergency =
#{measuresEmergency}
</if>
<if test="measuresEmergencyFileIds != null and measuresEmergencyFileIds != ''">and
rpil.measures_emergency_file_ids = #{measuresEmergencyFileIds}
</if>
<if test="referenceBasis != null and referenceBasis != ''">and rpil.reference_basis = #{referenceBasis}
</if>
</where> </where>
</select> </select>
...@@ -114,7 +365,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -114,7 +365,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertRiskPlanExistingList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanExistingList" useGeneratedKeys="true" keyProperty="id"> <insert id="insertRiskPlanExistingList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanExistingList"
useGeneratedKeys="true" keyProperty="id">
insert into risk_plan_existing_list insert into risk_plan_existing_list
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
...@@ -197,7 +449,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -197,7 +449,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="measuresDeptName != null">measures_dept_name = #{measuresDeptName},</if> <if test="measuresDeptName != null">measures_dept_name = #{measuresDeptName},</if>
<if test="measuresUserName != null">measures_user_name = #{measuresUserName},</if> <if test="measuresUserName != null">measures_user_name = #{measuresUserName},</if>
<if test="measuresUserPhone != null">measures_user_phone = #{measuresUserPhone},</if> <if test="measuresUserPhone != null">measures_user_phone = #{measuresUserPhone},</if>
<if test="measuresAdministrationFileIds != null">measures_administration_file_ids = #{measuresAdministrationFileIds},</if> <if test="measuresAdministrationFileIds != null">measures_administration_file_ids =
#{measuresAdministrationFileIds},
</if>
<if test="measuresEmergency != null">measures_emergency = #{measuresEmergency},</if> <if test="measuresEmergency != null">measures_emergency = #{measuresEmergency},</if>
<if test="measuresEmergencyFileIds != null">measures_emergency_file_ids = #{measuresEmergencyFileIds},</if> <if test="measuresEmergencyFileIds != null">measures_emergency_file_ids = #{measuresEmergencyFileIds},</if>
<if test="referenceBasis != null">reference_basis = #{referenceBasis},</if> <if test="referenceBasis != null">reference_basis = #{referenceBasis},</if>
...@@ -214,7 +468,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -214,7 +468,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteRiskPlanExistingListById" parameterType="Long"> <delete id="deleteRiskPlanExistingListById" parameterType="Long">
delete from risk_plan_existing_list where id = #{id} delete
from risk_plan_existing_list
where id = #{id}
</delete> </delete>
<delete id="deleteRiskPlanExistingListByIds" parameterType="String"> <delete id="deleteRiskPlanExistingListByIds" parameterType="String">
...@@ -225,50 +481,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -225,50 +481,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="getRiskPlanAppExistingListDetailsDtoByExistingId" <select id="getRiskPlanAppExistingListDetailsDtoByExistingId"
resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto"> resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDetailsDto">
SELECT SELECT rpil.id,
rpil.id, su.user_id AS userId,
su.user_id AS userId, su.nick_name AS userName,
su.nick_name AS userName, rpil.inherent_id AS inherentId,
rpil.inherent_id AS inherentId, lp.id AS projectId,
lp.id AS projectId, lp.`name` AS projectName,
lp.`name` AS projectName, lb.id AS buildingId,
lb.id AS buildingId, lb.`name` AS buildingName,
lb.`name` AS buildingName, lf.id AS floorId,
lf.id AS floorId, lf.`name` AS floorName,
lf.`name` AS floorName, lr.id AS roomId,
lr.id AS roomId, lr.`name` AS roomName,
lr.`name` AS roomName, rpil.plan_id AS planId,
rpil.plan_id AS planId, rpil.`name`,
rpil.`name`, rpil.factor,
rpil.factor, rpil.type,
rpil.type, rpil.`level`,
rpil.`level`, rpil.presence_location AS presenceLocation,
rpil.presence_location AS presenceLocation, rpil.picture_file_ids AS pictureFileIds,
rpil.picture_file_ids AS pictureFileIds, rpil.measures_project AS measuresProject,
rpil.measures_project AS measuresProject, rpil.measures_project_file_ids AS measuresProjectFileIds,
rpil.measures_project_file_ids AS measuresProjectFileIds, rpil.measures_administration AS measuresAdministration,
rpil.measures_administration AS measuresAdministration, rpil.measures_dept_name as measuresDeptName,
rpil.measures_dept_name as measuresDeptName, rpil.measures_user_name as measuresUserName,
rpil.measures_user_name as measuresUserName, rpil.measures_user_phone as measuresUserPhone,
rpil.measures_user_phone as measuresUserPhone, rpil.measures_administration_file_ids AS measuresAdministrationFileIds,
rpil.measures_administration_file_ids AS measuresAdministrationFileIds, rpil.measures_emergency AS measuresEmergency,
rpil.measures_emergency AS measuresEmergency, rpil.measures_emergency_file_ids AS measuresEmergencyFileIds,
rpil.measures_emergency_file_ids AS measuresEmergencyFileIds, rpil.reference_basis AS referenceBasis,
rpil.reference_basis AS referenceBasis, rpil.create_time,
rpil.create_time, rpil.evaluation_item_ids,
rpil.evaluation_item_ids, rpil.factor_items
rpil.factor_items FROM risk_plan_existing_list rpil
FROM LEFT JOIN sys_user su ON su.user_id = rpil.user_id
risk_plan_existing_list rpil LEFT JOIN risk_plan rp ON rp.id = rpil.plan_id
LEFT JOIN sys_user su ON su.user_id = rpil.user_id LEFT JOIN ledger_project lp ON lp.id = rp.project_id
LEFT JOIN risk_plan rp ON rp.id = rpil.plan_id LEFT JOIN ledger_room lr ON lr.id = rpil.room_id
LEFT JOIN ledger_project lp ON lp.id = rp.project_id LEFT JOIN ledger_floor lf ON lf.id = lr.floor_id
LEFT JOIN ledger_room lr ON lr.id = rpil.room_id LEFT JOIN ledger_building lb ON lb.id = lf.building_id
LEFT JOIN ledger_floor lf ON lf.id = lr.floor_id WHERE rpil.id = #{existingId}
LEFT JOIN ledger_building lb ON lb.id = lf.building_id
WHERE
rpil.id = #{existingId}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.censoft.censoftrongtong.mapper.RiskPlanInherentListMapper"> <mapper namespace="com.censoft.censoftrongtong.mapper.RiskPlanInherentListMapper">
<resultMap type="com.censoft.censoftrongtong.domain.RiskPlanInherentList" id="RiskPlanInherentListResult"> <resultMap type="com.censoft.censoftrongtong.domain.RiskPlanInherentList" id="RiskPlanInherentListResult">
<result property="id" column="id" /> <result property="id" column="id"/>
<result property="userId" column="user_id" /> <result property="userId" column="user_id"/>
<result property="roomId" column="room_id" /> <result property="roomId" column="room_id"/>
<result property="planId" column="plan_id" /> <result property="planId" column="plan_id"/>
<result property="name" column="name" /> <result property="name" column="name"/>
<result property="pointType" column="point_type" /> <result property="pointType" column="point_type"/>
<result property="specialEquipment" column="special_equipment" /> <result property="specialEquipment" column="special_equipment"/>
<result property="safetyWarningSigns" column="safety_warning_signs" /> <result property="safetyWarningSigns" column="safety_warning_signs"/>
<result property="factor" column="factor" /> <result property="factor" column="factor"/>
<result property="type" column="type" /> <result property="type" column="type"/>
<result property="level" column="level" /> <result property="level" column="level"/>
<result property="riskLikelihood" column="risk_likelihood" /> <result property="riskLikelihood" column="risk_likelihood"/>
<result property="riskSeverity" column="risk_severity" /> <result property="riskSeverity" column="risk_severity"/>
<result property="presenceLocation" column="presence_location" /> <result property="presenceLocation" column="presence_location"/>
<result property="pictureFileIds" column="picture_file_ids" /> <result property="pictureFileIds" column="picture_file_ids"/>
<result property="measuresProject" column="measures_project" /> <result property="measuresProject" column="measures_project"/>
<result property="measuresProjectFileIds" column="measures_project_file_ids" /> <result property="measuresProjectFileIds" column="measures_project_file_ids"/>
<result property="measuresAdministration" column="measures_administration" /> <result property="measuresAdministration" column="measures_administration"/>
<result property="measuresDeptName" column="measures_dept_name" /> <result property="measuresDeptName" column="measures_dept_name"/>
<result property="measuresUserName" column="measures_user_name" /> <result property="measuresUserName" column="measures_user_name"/>
<result property="measuresUserPhone" column="measures_user_phone" /> <result property="measuresUserPhone" column="measures_user_phone"/>
<result property="measuresAdministrationFileIds" column="measures_administration_file_ids" /> <result property="measuresAdministrationFileIds" column="measures_administration_file_ids"/>
<result property="hazardSourceName" column="hazard_source_name" /> <result property="hazardSourceName" column="hazard_source_name"/>
<result property="majorHazardSource" column="major_hazard_source" /> <result property="majorHazardSource" column="major_hazard_source"/>
<result property="majorHazardSourceDescription" column="major_hazard_source_description" /> <result property="majorHazardSourceDescription" column="major_hazard_source_description"/>
<result property="measuresEmergency" column="measures_emergency" /> <result property="measuresEmergency" column="measures_emergency"/>
<result property="measuresEmergencyFileIds" column="measures_emergency_file_ids" /> <result property="measuresEmergencyFileIds" column="measures_emergency_file_ids"/>
<result property="referenceBasis" column="reference_basis" /> <result property="referenceBasis" column="reference_basis"/>
<result property="delFlag" column="del_flag" /> <result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by" /> <result property="createBy" column="create_by"/>
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time"/>
<result property="remark" column="remark" /> <result property="remark" column="remark"/>
</resultMap> </resultMap>
<sql id="selectRiskPlanInherentListVo"> <sql id="selectRiskPlanInherentListVo">
select id, user_id, room_id, plan_id, name, point_type, special_equipment, safety_warning_signs, factor, type, level, risk_likelihood, risk_severity, presence_location, picture_file_ids, measures_project, measures_project_file_ids, measures_administration, measures_dept_name, measures_user_name, measures_user_phone, measures_administration_file_ids, hazard_source_name, major_hazard_source, major_hazard_source_description, measures_emergency, measures_emergency_file_ids, reference_basis, del_flag, create_by, create_time, update_by, update_time, remark from risk_plan_inherent_list select id,
user_id,
room_id,
plan_id,
name,
point_type,
special_equipment,
safety_warning_signs,
factor,
type,
level,
risk_likelihood,
risk_severity,
presence_location,
picture_file_ids,
measures_project,
measures_project_file_ids,
measures_administration,
measures_dept_name,
measures_user_name,
measures_user_phone,
measures_administration_file_ids,
hazard_source_name,
major_hazard_source,
major_hazard_source_description,
measures_emergency,
measures_emergency_file_ids,
reference_basis,
del_flag,
create_by,
create_time,
update_by,
update_time,
remark
from risk_plan_inherent_list
</sql> </sql>
<select id="selectRiskPlanInherentListList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanInherentList" resultMap="RiskPlanInherentListResult"> <select id="getAnnualRiskStatistics" resultType="java.util.LinkedHashMap">
SELECT
count( MONTH ( rpil.create_time ) = 1 or null) AS 1月,
count( MONTH ( rpil.create_time ) = 2 or null) AS 2月,
count( MONTH ( rpil.create_time ) = 3 or null) AS 3月,
count( MONTH ( rpil.create_time ) = 4 or null) AS 4月,
count( MONTH ( rpil.create_time ) = 5 or null) AS 5月,
count( MONTH ( rpil.create_time ) = 6 or null) AS 6月,
count( MONTH ( rpil.create_time ) = 7 or null) AS 7月,
count( MONTH ( rpil.create_time ) = 8 or null) AS 8月,
count( MONTH ( rpil.create_time ) = 9 or null) AS 9月,
count( MONTH ( rpil.create_time ) = 10 or null) AS 10月,
count( MONTH ( rpil.create_time ) = 11 or null) AS 11月,
count( MONTH ( rpil.create_time ) = 12 or null) AS 12月
FROM risk_plan_inherent_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
</where>
</select>
<select id="getRiskProjectRanking"
resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskProjectRankingDto">
SELECT p.name projectName,count(1) RiskScore,d.dept_name deptName,p.province FROM risk_plan_inherent_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
inner JOIN sys_dept d ON p.dept_id = d.dept_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
</where>
group by p.id,p.name ORDER BY RiskScore desc
</select>
<select id="getAccidentTypeStatistics"
resultType="com.censoft.censoftrongtong.domain.dto.statistics.AccidentTypeStatisticsDto">
select dict_label typeName, COUNT(1) typeNum
FROM (select dict_label from sys_dict_data where dict_type = 'risk_plan_type') a
left join
risk_plan_inherent_list rpil
on FIND_IN_SET(a.dict_label, rpil.type)
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
</where>
GROUP BY dict_label
ORDER BY typeNum desc
</select>
<select id="getRiskLevelStatistics"
resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskLevelStatisticsDto">
SELECT rpil.level levelName, count(1) levelNum
FROM risk_plan_inherent_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
<if test="projectId != null">
and p.id=#{projectId}
</if>
</where>
group by rpil.level ORDER BY levelNum desc
</select>
<select id="getRiskIndexRanking" resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskIndexRankingDto">
SELECT p.name projectName,count(1) RiskNum,d.dept_name deptName,p.province FROM risk_plan_inherent_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
inner JOIN sys_dept d ON p.dept_id = d.dept_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
</where>
group by p.id,p.name ORDER BY RiskNum desc
</select>
<select id="getNationalRiskNum" resultType="java.lang.Long">
SELECT count(1) FROM risk_plan_inherent_list rpil
inner JOIN ledger_room lr ON lr.id = rpil.room_id
inner JOIN ledger_floor lf ON lf.id = floor_id
inner JOIN ledger_building lb ON lb.id = lf.building_id
inner JOIN ledger_project p ON p.id = lb.project_id
<where>
and rpil.del_flag=0
<if test="areaName != null and areaName != ''">
and (
p.province = #{areaName}
or p.city = #{areaName}
or p.district = #{areaName}
)
</if>
<if test="beginTime != null">
and (
date_format(rpil.create_time,'%y%m%d') >= date_format(#{beginTime},'%Y-%m-%d')
)
</if>
<if test="projectId != null">
and p.id=#{projectId}
</if>
</where>
</select>
<select id="getProjectRiskInfo" resultType="com.censoft.censoftrongtong.domain.dto.statistics.ProjectRiskInfoDto">
SELECT
rpil.id, rpil.hazard_source_name riskName,rpil.level levelName,'固有' typeName
FROM
risk_plan_inherent_list rpil
LEFT JOIN ledger_room lr ON lr.id = rpil.room_id
LEFT JOIN ledger_floor lf ON lf.id = floor_id
LEFT JOIN sys_user su ON su.user_id = rpil.user_id
LEFT JOIN ledger_building lb ON lb.id = lf.building_id
<where>
<if test="projectId != null">AND lb.project_id = #{projectId}</if>
<if test="buildingId != null">AND lf.building_id = #{buildingId}</if>
<if test="floorId != null">AND lf.id = #{floorId}</if>
<if test="level != null and level != ''">AND rpil.level = #{level}</if>
AND rpil.del_flag = '0'
AND lr.del_flag = '0'
AND lr.`status` = '0'
AND lf.del_flag = '0'
AND lf.`status` = '0'
AND lb.del_flag = '0'
AND lb.`status` = '0'
</where>
ORDER BY
rpil.create_time DESC
</select>
<select id="getRiskMapStatistics" parameterType="com.censoft.censoftrongtong.domain.dto.statistics.MapStatisticsQueryDto"
resultType="com.censoft.censoftrongtong.domain.dto.statistics.RiskMapStatisticsDto">
SELECT #{levelName} areaName,
COUNT(1) riskNum
FROM risk_plan_inherent_list rpil
INNER JOIN ledger_room lr ON lr.id = rpil.room_id
INNER JOIN ledger_floor lf ON lf.id = floor_id
INNER JOIN ledger_building lb ON lb.id = lf.building_id
INNER JOIN ledger_project p ON p.id = lb.project_id
<where>
AND rpil.del_flag = '0'
AND lr.del_flag = '0'
AND lr.`status` = '0'
AND lf.del_flag = '0'
AND lf.`status` = '0'
AND lb.del_flag = '0'
AND lb.`status` = '0'
<if test="areaName != null and areaName != '' and level != 1">
AND ${parentLevel} = ${areaName}
</if>
</where>
<if test="levelName != null and levelName != ''">
group by ${levelName}
</if>
</select>
<select id="selectRiskPlanInherentListList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanInherentList"
resultMap="RiskPlanInherentListResult">
SELECT SELECT
rpil.id, rpil.id,
lb.id AS buildingId, lb.id AS buildingId,
...@@ -96,38 +334,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -96,38 +334,68 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ledger_building lb ON lb.id = lf.building_id LEFT JOIN ledger_building lb ON lb.id = lf.building_id
LEFT JOIN sys_dict_data sdd ON sdd.dict_label = rpil.LEVEL LEFT JOIN sys_dict_data sdd ON sdd.dict_label = rpil.LEVEL
AND dict_type = 'risk_plan_level' AND dict_type = 'risk_plan_level'
LEFT JOIN risk_plan rp ON FIND_IN_SET( lb.id, rp.building_ids ) LEFT JOIN risk_plan rp ON FIND_IN_SET( lb.id, rp.building_ids )
<where> <where>
<if test="name != null and name != ''"> and rpil.name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and rpil.name like concat('%', #{name}, '%')</if>
<if test="buildingName != null and buildingName != ''"> and lb.name like concat('%', #{buildingName}, '%')</if> <if test="buildingName != null and buildingName != ''">and lb.name like concat('%', #{buildingName}, '%')
<if test="floorName != null and floorName != ''"> and lf.name like concat('%', #{floorName}, '%')</if> </if>
<if test="roomName != null and roomName != ''"> and lr.name like concat('%', #{roomName}, '%')</if> <if test="floorName != null and floorName != ''">and lf.name like concat('%', #{floorName}, '%')</if>
<if test="level != null and level != ''"> and rpil.level = #{level}</if> <if test="roomName != null and roomName != ''">and lr.name like concat('%', #{roomName}, '%')</if>
<if test="factor != null and factor != ''"> and rpil.factor like concat('%', #{factor}, '%')</if> <if test="level != null and level != ''">and rpil.level = #{level}</if>
<if test="type != null and type != ''"> and rpil.type like concat('%', #{type}, '%')</if> <if test="factor != null and factor != ''">and rpil.factor like concat('%', #{factor}, '%')</if>
<if test="presenceLocation != null and presenceLocation != ''"> and rpil.presence_location like concat('%', #{presenceLocation}, '%')</if> <if test="type != null and type != ''">and rpil.type like concat('%', #{type}, '%')</if>
<if test="userId != null "> and rpil.user_id = #{userId}</if> <if test="presenceLocation != null and presenceLocation != ''">and rpil.presence_location like concat('%',
<if test="roomId != null "> and rpil.room_id = #{roomId}</if> #{presenceLocation}, '%')
<if test="planId != null "> and rp.id = #{planId}</if> </if>
<if test="pointType != null and pointType != ''"> and rpil.point_type = #{pointType}</if> <if test="userId != null ">and rpil.user_id = #{userId}</if>
<if test="specialEquipment != null "> and rpil.special_equipment = #{specialEquipment}</if> <if test="roomId != null ">and rpil.room_id = #{roomId}</if>
<if test="safetyWarningSigns != null and safetyWarningSigns != ''"> and rpil.safety_warning_signs = #{safetyWarningSigns}</if> <if test="planId != null ">and rp.id = #{planId}</if>
<if test="riskLikelihood != null and riskLikelihood != ''"> and rpil.risk_likelihood = #{riskLikelihood}</if> <if test="pointType != null and pointType != ''">and rpil.point_type = #{pointType}</if>
<if test="riskSeverity != null and riskSeverity != ''"> and rpil.risk_severity = #{riskSeverity}</if> <if test="specialEquipment != null ">and rpil.special_equipment = #{specialEquipment}</if>
<if test="pictureFileIds != null and pictureFileIds != ''"> and rpil.picture_file_ids = #{pictureFileIds}</if> <if test="safetyWarningSigns != null and safetyWarningSigns != ''">and rpil.safety_warning_signs =
<if test="measuresProject != null and measuresProject != ''"> and rpil.measures_project = #{measuresProject}</if> #{safetyWarningSigns}
<if test="measuresProjectFileIds != null and measuresProjectFileIds != ''"> and rpil.measures_project_file_ids = #{measuresProjectFileIds}</if> </if>
<if test="measuresAdministration != null and measuresAdministration != ''"> and rpil.measures_administration = #{measuresAdministration}</if> <if test="riskLikelihood != null and riskLikelihood != ''">and rpil.risk_likelihood = #{riskLikelihood}
<if test="measuresDeptName != null and measuresDeptName != ''"> and rpil.measures_dept_name like concat('%', #{measuresDeptName}, '%')</if> </if>
<if test="measuresUserName != null and measuresUserName != ''"> and rpil.measures_user_name like concat('%', #{measuresUserName}, '%')</if> <if test="riskSeverity != null and riskSeverity != ''">and rpil.risk_severity = #{riskSeverity}</if>
<if test="measuresUserPhone != null and measuresUserPhone != ''"> and rpil.measures_user_phone = #{measuresUserPhone}</if> <if test="pictureFileIds != null and pictureFileIds != ''">and rpil.picture_file_ids = #{pictureFileIds}
<if test="measuresAdministrationFileIds != null and measuresAdministrationFileIds != ''"> and rpil.measures_administration_file_ids = #{measuresAdministrationFileIds}</if> </if>
<if test="hazardSourceName != null and hazardSourceName != ''"> and rpil.hazard_source_name like concat('%', #{hazardSourceName}, '%')</if> <if test="measuresProject != null and measuresProject != ''">and rpil.measures_project =
<if test="majorHazardSource != null "> and .major_hazard_source = #{majorHazardSource}</if> #{measuresProject}
<if test="majorHazardSourceDescription != null and majorHazardSourceDescription != ''"> and rpil.major_hazard_source_description = #{majorHazardSourceDescription}</if> </if>
<if test="measuresEmergency != null and measuresEmergency != ''"> and rpil.measures_emergency = #{measuresEmergency}</if> <if test="measuresProjectFileIds != null and measuresProjectFileIds != ''">and
<if test="measuresEmergencyFileIds != null and measuresEmergencyFileIds != ''"> and rpil.measures_emergency_file_ids = #{measuresEmergencyFileIds}</if> rpil.measures_project_file_ids = #{measuresProjectFileIds}
<if test="referenceBasis != null and referenceBasis != ''"> and rpil.reference_basis = #{referenceBasis}</if> </if>
<if test="measuresAdministration != null and measuresAdministration != ''">and rpil.measures_administration
= #{measuresAdministration}
</if>
<if test="measuresDeptName != null and measuresDeptName != ''">and rpil.measures_dept_name like concat('%',
#{measuresDeptName}, '%')
</if>
<if test="measuresUserName != null and measuresUserName != ''">and rpil.measures_user_name like concat('%',
#{measuresUserName}, '%')
</if>
<if test="measuresUserPhone != null and measuresUserPhone != ''">and rpil.measures_user_phone =
#{measuresUserPhone}
</if>
<if test="measuresAdministrationFileIds != null and measuresAdministrationFileIds != ''">and
rpil.measures_administration_file_ids = #{measuresAdministrationFileIds}
</if>
<if test="hazardSourceName != null and hazardSourceName != ''">and rpil.hazard_source_name like concat('%',
#{hazardSourceName}, '%')
</if>
<if test="majorHazardSource != null ">and .major_hazard_source = #{majorHazardSource}</if>
<if test="majorHazardSourceDescription != null and majorHazardSourceDescription != ''">and
rpil.major_hazard_source_description = #{majorHazardSourceDescription}
</if>
<if test="measuresEmergency != null and measuresEmergency != ''">and rpil.measures_emergency =
#{measuresEmergency}
</if>
<if test="measuresEmergencyFileIds != null and measuresEmergencyFileIds != ''">and
rpil.measures_emergency_file_ids = #{measuresEmergencyFileIds}
</if>
<if test="referenceBasis != null and referenceBasis != ''">and rpil.reference_basis = #{referenceBasis}
</if>
</where> </where>
</select> </select>
...@@ -136,7 +404,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -136,7 +404,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id} where id = #{id}
</select> </select>
<insert id="insertRiskPlanInherentList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanInherentList" useGeneratedKeys="true" keyProperty="id"> <insert id="insertRiskPlanInherentList" parameterType="com.censoft.censoftrongtong.domain.RiskPlanInherentList"
useGeneratedKeys="true" keyProperty="id">
insert into risk_plan_inherent_list insert into risk_plan_inherent_list
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if> <if test="userId != null">user_id,</if>
...@@ -233,10 +502,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -233,10 +502,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="measuresDeptName != null">measures_dept_name = #{measuresDeptName},</if> <if test="measuresDeptName != null">measures_dept_name = #{measuresDeptName},</if>
<if test="measuresUserName != null">measures_user_name = #{measuresUserName},</if> <if test="measuresUserName != null">measures_user_name = #{measuresUserName},</if>
<if test="measuresUserPhone != null">measures_user_phone = #{measuresUserPhone},</if> <if test="measuresUserPhone != null">measures_user_phone = #{measuresUserPhone},</if>
<if test="measuresAdministrationFileIds != null">measures_administration_file_ids = #{measuresAdministrationFileIds},</if> <if test="measuresAdministrationFileIds != null">measures_administration_file_ids =
#{measuresAdministrationFileIds},
</if>
<if test="hazardSourceName != null">hazard_source_name = #{hazardSourceName},</if> <if test="hazardSourceName != null">hazard_source_name = #{hazardSourceName},</if>
<if test="majorHazardSource != null">major_hazard_source = #{majorHazardSource},</if> <if test="majorHazardSource != null">major_hazard_source = #{majorHazardSource},</if>
<if test="majorHazardSourceDescription != null">major_hazard_source_description = #{majorHazardSourceDescription},</if> <if test="majorHazardSourceDescription != null">major_hazard_source_description =
#{majorHazardSourceDescription},
</if>
<if test="measuresEmergency != null">measures_emergency = #{measuresEmergency},</if> <if test="measuresEmergency != null">measures_emergency = #{measuresEmergency},</if>
<if test="measuresEmergencyFileIds != null">measures_emergency_file_ids = #{measuresEmergencyFileIds},</if> <if test="measuresEmergencyFileIds != null">measures_emergency_file_ids = #{measuresEmergencyFileIds},</if>
<if test="referenceBasis != null">reference_basis = #{referenceBasis},</if> <if test="referenceBasis != null">reference_basis = #{referenceBasis},</if>
...@@ -251,7 +524,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -251,7 +524,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update> </update>
<delete id="deleteRiskPlanInherentListById" parameterType="Long"> <delete id="deleteRiskPlanInherentListById" parameterType="Long">
delete from risk_plan_inherent_list where id = #{id} delete
from risk_plan_inherent_list
where id = #{id}
</delete> </delete>
<delete id="deleteRiskPlanInherentListByIds" parameterType="String"> <delete id="deleteRiskPlanInherentListByIds" parameterType="String">
...@@ -262,37 +537,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -262,37 +537,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="getInherentListByPlanId" <select id="getInherentListByPlanId"
resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDto"> resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDto">
SELECT SELECT
rpil.id, rpil.id,
rpil.`name`, rpil.`name`,
lb.id AS buildingId, lb.id AS buildingId,
lb.`name` AS buildingName, lb.`name` AS buildingName,
lf.id AS floorId, lf.id AS floorId,
lf.`name` AS floorName, lf.`name` AS floorName,
lr.id AS roomId, lr.id AS roomId,
lr.`name` AS roomName, lr.`name` AS roomName,
su.user_id AS userId, su.user_id AS userId,
su.nick_name AS userName, su.nick_name AS userName,
su.avatar, su.avatar,
rpil.level, rpil.level,
rpil.create_time AS createTime rpil.create_time AS createTime
FROM FROM
risk_plan_inherent_list rpil risk_plan_inherent_list rpil
LEFT JOIN ledger_room lr ON lr.id = rpil.room_id LEFT JOIN ledger_room lr ON lr.id = rpil.room_id
LEFT JOIN ledger_floor lf ON lf.id = floor_id LEFT JOIN ledger_floor lf ON lf.id = floor_id
LEFT JOIN sys_user su ON su.user_id = rpil.user_id LEFT JOIN sys_user su ON su.user_id = rpil.user_id
LEFT JOIN ledger_building lb ON lb.id = lf.building_id LEFT JOIN ledger_building lb ON lb.id = lf.building_id
LEFT JOIN sys_dict_data sdd ON sdd.dict_label = rpil.LEVEL LEFT JOIN sys_dict_data sdd ON sdd.dict_label = rpil.LEVEL
AND dict_type = 'risk_plan_level' AND dict_type = 'risk_plan_level'
<where> <where>
<if test="projectId != null"> AND lb.project_id = #{projectId}</if> <if test="projectId != null">AND lb.project_id = #{projectId}</if>
<if test="buildingId != null"> AND lf.building_id = #{buildingId}</if> <if test="buildingId != null">AND lf.building_id = #{buildingId}</if>
<if test="floorId != null"> AND lf.id = #{floorId}</if> <if test="floorId != null">AND lf.id = #{floorId}</if>
<if test="roomId != null"> AND lr.id = #{roomId}</if> <if test="roomId != null">AND lr.id = #{roomId}</if>
AND rpil.del_flag = '0' AND rpil.del_flag = '0'
AND lr.del_flag = '0' AND lr.del_flag = '0'
AND lr.`status` = '0' AND lr.`status` = '0'
...@@ -306,84 +579,78 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -306,84 +579,78 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getRiskPlanAppInherentListDetailsDtoByInherentId" <select id="getRiskPlanAppInherentListDetailsDtoByInherentId"
resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDetailsDto"> resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDetailsDto">
SELECT SELECT rpil.id,
rpil.id, su.user_id AS userId,
su.user_id AS userId, su.nick_name AS userName,
su.nick_name AS userName, lp.id AS projectId,
lp.id AS projectId, lp.`name` AS projectName,
lp.`name` AS projectName, lb.id AS buildingId,
lb.id AS buildingId, lb.`name` AS buildingName,
lb.`name` AS buildingName, lf.id AS floorId,
lf.id AS floorId, lf.`name` AS floorName,
lf.`name` AS floorName, lr.id AS roomId,
lr.id AS roomId, lr.`name` AS roomName,
lr.`name` AS roomName, rpil.plan_id AS planId,
rpil.plan_id AS planId, rpil.`name`,
rpil.`name`, rpil.point_type as pointType,
rpil.point_type as pointType, rpil.special_equipment as specialEquipment,
rpil.special_equipment as specialEquipment, rpil.equipment_number as equipmentNumber,
rpil.equipment_number as equipmentNumber, rpil.safety_warning_signs as safetyWarningSigns,
rpil.safety_warning_signs as safetyWarningSigns, rpil.factor,
rpil.factor, rpil.type,
rpil.type, rpil.`level`,
rpil.`level`, rpil.`risk_likelihood`,
rpil.`risk_likelihood`, rpil.`risk_severity`,
rpil.`risk_severity`, rpil.presence_location AS presenceLocation,
rpil.presence_location AS presenceLocation, rpil.picture_file_ids AS pictureFileIds,
rpil.picture_file_ids AS pictureFileIds, rpil.measures_project AS measuresProject,
rpil.measures_project AS measuresProject, rpil.measures_project_file_ids AS measuresProjectFileIds,
rpil.measures_project_file_ids AS measuresProjectFileIds, rpil.measures_administration AS measuresAdministration,
rpil.measures_administration AS measuresAdministration, rpil.measures_dept_name as measuresDeptName,
rpil.measures_dept_name as measuresDeptName, rpil.measures_user_name as measuresUserName,
rpil.measures_user_name as measuresUserName, rpil.measures_user_phone as measuresUserPhone,
rpil.measures_user_phone as measuresUserPhone, rpil.measures_administration_file_ids AS measuresAdministrationFileIds,
rpil.measures_administration_file_ids AS measuresAdministrationFileIds, rpil.hazard_source_name AS hazardSourceName,
rpil.hazard_source_name AS hazardSourceName, rpil.major_hazard_source AS majorHazardSource,
rpil.major_hazard_source AS majorHazardSource, rpil.major_hazard_source_description AS majorHazardSourceDescription,
rpil.major_hazard_source_description AS majorHazardSourceDescription, rpil.measures_emergency AS measuresEmergency,
rpil.measures_emergency AS measuresEmergency, rpil.measures_emergency_file_ids AS measuresEmergencyFileIds,
rpil.measures_emergency_file_ids AS measuresEmergencyFileIds, rpil.reference_basis AS referenceBasis,
rpil.reference_basis AS referenceBasis, rpil.create_time
rpil.create_time
FROM FROM risk_plan_inherent_list rpil
risk_plan_inherent_list rpil LEFT JOIN sys_user su ON su.user_id = rpil.user_id
LEFT JOIN sys_user su ON su.user_id = rpil.user_id LEFT JOIN risk_plan rp ON rp.id = rpil.plan_id
LEFT JOIN risk_plan rp ON rp.id = rpil.plan_id LEFT JOIN ledger_project lp ON lp.id = rp.project_id
LEFT JOIN ledger_project lp ON lp.id = rp.project_id LEFT JOIN ledger_room lr ON lr.id = rpil.room_id
LEFT JOIN ledger_room lr ON lr.id = rpil.room_id LEFT JOIN ledger_floor lf ON lf.id = lr.floor_id
LEFT JOIN ledger_floor lf ON lf.id = lr.floor_id LEFT JOIN ledger_building lb ON lb.id = lf.building_id
LEFT JOIN ledger_building lb ON lb.id = lf.building_id WHERE rpil.id = #{inherentId}
WHERE
rpil.id = #{inherentId}
</select> </select>
<select id="getExistingListByInherentId" <select id="getExistingListByInherentId"
resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDto"> resultType="com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDto">
SELECT SELECT reil.id,
reil.id, reil.`name`,
reil.`name`, reil.create_time AS createTime,
reil.create_time AS createTime, reil.presence_location AS presenceLocation,
reil.presence_location AS presenceLocation, su.user_id AS userId,
su.user_id AS userId, su.nick_name AS userName,
su.nick_name AS userName, su.avatar,
su.avatar, reil.level,
reil.level, reil.factor,
reil.factor, lb.id AS buildingId,
lb.id AS buildingId, lb.`name` AS buildingName,
lb.`name` AS buildingName, lf.id AS floorId,
lf.id AS floorId, lf.`name` AS floorName,
lf.`name` AS floorName, lr.id AS roomId,
lr.id AS roomId, lr.`name` AS roomName
lr.`name` AS roomName FROM risk_plan_inherent_list reil
FROM LEFT JOIN sys_user su ON su.user_id = reil.user_id
risk_plan_existing_list reil LEFT JOIN risk_plan_inherent_list rpil ON rpil.id = reil.inherent_id
LEFT JOIN sys_user su ON su.user_id = reil.user_id LEFT JOIN ledger_room lr ON lr.id = rpil.room_id
LEFT JOIN risk_plan_inherent_list rpil ON rpil.id = reil.inherent_id LEFT JOIN ledger_floor lf ON lf.id = lr.floor_id
LEFT JOIN ledger_room lr ON lr.id = rpil.room_id LEFT JOIN ledger_building lb ON lb.id = lf.building_id
LEFT JOIN ledger_floor lf ON lf.id = lr.floor_id WHERE reil.inherent_id = #{inherentId}
LEFT JOIN ledger_building lb ON lb.id = lf.building_id
WHERE
reil.inherent_id = #{inherentId}
AND reil.del_flag = '0' AND reil.del_flag = '0'
AND rpil.del_flag = '0' AND rpil.del_flag = '0'
AND lr.del_flag = '0' AND lr.del_flag = '0'
...@@ -395,72 +662,77 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -395,72 +662,77 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="getRiskNotificationExportWordDto" <select id="getRiskNotificationExportWordDto"
resultType="com.censoft.censoftrongtong.domain.dto.RiskNotificationExportWordDto"> resultType="com.censoft.censoftrongtong.domain.dto.RiskNotificationExportWordDto">
SELECT SELECT lr.`name` AS `name`,
lr.`name` AS `name`, rpil.`level`,
rpil.`level`, rpil.`name` AS dangerName,
rpil.`name` AS dangerName, rpil.point_type AS pointType,
rpil.point_type AS pointType, rpil.type,
rpil.type, rpil.safety_warning_signs AS safetyWarningSigns,
rpil.safety_warning_signs AS safetyWarningSigns, rpil.measures_administration AS measuresAdministration,
rpil.measures_administration AS measuresAdministration, rpil.measures_dept_name AS deptName,
rpil.measures_dept_name AS deptName, rpil.measures_user_name AS userName,
rpil.measures_user_name AS userName, rpil.measures_user_phone AS userPhone,
rpil.measures_user_phone AS userPhone, rpil.measures_emergency AS measuresEmergency
rpil.measures_emergency AS measuresEmergency FROM risk_plan_inherent_list rpil
FROM left join ledger_room lr on lr.id = rpil.room_id
risk_plan_inherent_list rpil WHERE rpil.id = #{inherentId}
left join ledger_room lr on lr.id = rpil.room_id
WHERE
rpil.id = #{inherentId}
</select> </select>
<select id="getPlanInherentList" <select id="getPlanInherentList"
resultType="com.censoft.censoftrongtong.domain.dto.RiskInherentListExportDto"> resultType="com.censoft.censoftrongtong.domain.dto.RiskInherentListExportDto">
SELECT SELECT
rpil.id AS id, rpil.id AS id,
sd.dept_name AS deptName, sd.dept_name AS deptName,
lp.`name` AS projectName, lp.`name` AS projectName,
lp.city AS city, lp.city AS city,
lp.type AS type, lp.type AS type,
lp.business AS businessFormat, lp.business AS businessFormat,
rpil.`name` AS inherentName, rpil.`name` AS inherentName,
rpil.`level` AS inherentLevel, rpil.`level` AS inherentLevel,
rpel.`name` AS existingName, rpel.`name` AS existingName,
rpel.`level` AS existingLevel, rpel.`level` AS existingLevel,
rpil.`level` AS inherentProjectLevel, rpil.`level` AS inherentProjectLevel,
rpel.`level` AS existingProjectLevel, rpel.`level` AS existingProjectLevel,
rpil.presence_location AS presenceLocation, rpil.presence_location AS presenceLocation,
rpil.type AS listType, rpil.type AS listType,
rpil.measures_administration AS inherentMeasuresAdministration, rpil.measures_administration AS inherentMeasuresAdministration,
rpel.measures_administration AS existingMeasuresAdministration, rpel.measures_administration AS existingMeasuresAdministration,
rpil.measures_dept_name AS measuresDeptName, rpil.measures_dept_name AS measuresDeptName,
rpil.measures_user_name AS measuresUserName, rpil.measures_user_name AS measuresUserName,
rpil.measures_user_phone AS measuresUserPhone, rpil.measures_user_phone AS measuresUserPhone,
rpil.hazard_source_name AS hazardSourceName, rpil.hazard_source_name AS hazardSourceName,
rpil.major_hazard_source AS majorHazardSource, rpil.major_hazard_source AS majorHazardSource,
rpil.major_hazard_source_description AS majorHazardDescription, rpil.major_hazard_source_description AS majorHazardDescription,
rpil.reference_basis AS referenceBasis rpil.reference_basis AS referenceBasis
FROM FROM
risk_plan rp risk_plan rp
LEFT JOIN ledger_project lp ON lp.id = rp.project_id LEFT JOIN ledger_project lp ON lp.id = rp.project_id
LEFT JOIN sys_dept sd ON sd.dept_id = lp.dept_id LEFT JOIN sys_dept sd ON sd.dept_id = lp.dept_id
LEFT JOIN ledger_building lb ON FIND_IN_SET( lb.id, rp.building_ids ) LEFT JOIN ledger_building lb ON FIND_IN_SET( lb.id, rp.building_ids )
LEFT JOIN ledger_floor lf ON lf.building_id = lb.id LEFT JOIN ledger_floor lf ON lf.building_id = lb.id
LEFT JOIN ledger_room lr ON lr.floor_id = lf.id LEFT JOIN ledger_room lr ON lr.floor_id = lf.id
LEFT JOIN risk_plan_inherent_list rpil ON rpil.room_id = lr.id LEFT JOIN risk_plan_inherent_list rpil ON rpil.room_id = lr.id
LEFT JOIN risk_plan_existing_list rpel ON rpel.inherent_id = rpil.id LEFT JOIN risk_plan_inherent_list rpel ON rpel.inherent_id = rpil.id
WHERE WHERE
rpil.id IS NOT NULL rpil.id IS NOT NULL
<if test="deptName != null and deptName != ''">and sd.dept_name like concat('%',#{deptName},'%')</if> <if test="deptName != null and deptName != ''">and sd.dept_name like concat('%',#{deptName},'%')</if>
<if test="projectName != null and projectName != ''">and lp.name like concat('%',#{projectName},'%')</if> <if test="projectName != null and projectName != ''">and lp.name like concat('%',#{projectName},'%')</if>
<if test="city != null and city != ''">and lp.city like concat('%',#{city},'%')</if> <if test="city != null and city != ''">and lp.city like concat('%',#{city},'%')</if>
<if test="businessFormat != null and businessFormat != ''">and lp.business like concat('%',#{businessFormat},'%')</if> <if test="businessFormat != null and businessFormat != ''">and lp.business like
<if test="inherentName != null and inherentName != ''">and rpil.`name` like concat('%',#{inherentName},'%')</if> concat('%',#{businessFormat},'%')
<if test="inherentLevel != null and inherentLevel != ''">and rpil.`level` like concat('%',#{inherentLevel},'%')</if> </if>
<if test="existingName != null and existingName != ''">and rpel.`name` like concat('%',#{existingName},'%')</if> <if test="inherentName != null and inherentName != ''">and rpil.`name` like concat('%',#{inherentName},'%')</if>
<if test="existingLevel != null and existingLevel != ''">and rpel.`level` like concat('%',#{existingLevel},'%')</if> <if test="inherentLevel != null and inherentLevel != ''">and rpil.`level` like
<if test="presenceLocation != null and presenceLocation != ''">and rpil.presence_location like concat('%',#{presenceLocation},'%')</if> concat('%',#{inherentLevel},'%')
<if test="listType != null and listType != ''">and rpil.type like concat('%',#{listType},'%')</if> </if>
<if test="planId != null">and rp.id = #{name}</if> <if test="existingName != null and existingName != ''">and rpel.`name` like concat('%',#{existingName},'%')</if>
GROUP BY rpil.id <if test="existingLevel != null and existingLevel != ''">and rpel.`level` like
concat('%',#{existingLevel},'%')
</if>
<if test="presenceLocation != null and presenceLocation != ''">and rpil.presence_location like
concat('%',#{presenceLocation},'%')
</if>
<if test="listType != null and listType != ''">and rpil.type like concat('%',#{listType},'%')</if>
<if test="planId != null">and rp.id = #{name}</if>
GROUP BY rpil.id
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -60,13 +60,6 @@ ...@@ -60,13 +60,6 @@
<version>${bitwalker.version}</version> <version>${bitwalker.version}</version>
</dependency> </dependency>
<!-- pagehelper 分页插件 -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper.boot.version}</version>
</dependency>
<!-- 获取系统信息 --> <!-- 获取系统信息 -->
<dependency> <dependency>
<groupId>com.github.oshi</groupId> <groupId>com.github.oshi</groupId>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment