From 15a3aba3a971501e55400a546560280e46b758ca Mon Sep 17 00:00:00 2001
From: zrj <646384940@qq.com>
Date: Thu, 31 Oct 2024 15:40:34 +0800
Subject: [PATCH] 应急空间,救援队伍,风险源,应急物资查询调整,按企业查询

---
 src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.xml                 |   19 +++
 src/main/java/org/springblade/modules/yw/vo/RiskSourceVO.java                        |    3 
 src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.xml          |   31 +++++-
 src/main/java/org/springblade/modules/yw/mapper/RiskSourceMapper.xml                 |   13 ++
 src/main/java/org/springblade/modules/yw/vo/RescueTeamVO.java                        |    4 
 src/main/java/org/springblade/modules/yw/mapper/EmergencySpaceMapper.xml             |   39 +++----
 src/main/java/org/springblade/common/cache/DictBizCache.java                         |   38 ++++---
 src/main/java/org/springblade/modules/yw/entity/EmergencySuppliesEntity.java         |   10 --
 src/main/java/org/springblade/modules/yw/vo/EmergencySuppliesVO.java                 |   39 ++++---
 src/main/java/org/springblade/modules/yw/service/impl/EmergencySpaceServiceImpl.java |    9 +
 src/main/java/org/springblade/modules/yw/vo/EmergencySpaceVO.java                    |   35 +++---
 src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.java         |    4 
 12 files changed, 149 insertions(+), 95 deletions(-)

diff --git a/src/main/java/org/springblade/common/cache/DictBizCache.java b/src/main/java/org/springblade/common/cache/DictBizCache.java
index 180b49d..fe6c2e9 100644
--- a/src/main/java/org/springblade/common/cache/DictBizCache.java
+++ b/src/main/java/org/springblade/common/cache/DictBizCache.java
@@ -1,21 +1,6 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
 package org.springblade.common.cache;
 
+import org.apache.logging.log4j.util.Strings;
 import org.springblade.common.enums.DictBizEnum;
 import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.secure.utils.AuthUtil;
@@ -23,9 +8,8 @@
 import org.springblade.core.tool.utils.StringPool;
 import org.springblade.modules.system.entity.DictBiz;
 import org.springblade.modules.system.service.IDictBizService;
-
+import java.util.ArrayList;
 import java.util.List;
-
 import static org.springblade.core.cache.constant.CacheConstant.DICT_CACHE;
 
 /**
@@ -82,6 +66,24 @@
 	/**
 	 * 获取字典值
 	 *
+	 * @param code    字典编号
+	 * @param dictKeys 字符串键
+	 * @return String
+	 */
+	public static String getValues(String code, String dictKeys) {
+		List<String> list = new ArrayList<>();
+		List<DictBiz> dictBizList = getList(code);
+		for (DictBiz dictBiz : dictBizList) {
+			if (dictKeys.contains(dictBiz.getDictKey())){
+				list.add(dictBiz.getDictValue());
+			}
+		}
+		return Strings.join(list,',');
+	}
+
+	/**
+	 * 获取字典值
+	 *
 	 * @param code    字典编号枚举
 	 * @param dictKey String型字典键
 	 * @return String
diff --git a/src/main/java/org/springblade/modules/yw/entity/EmergencySuppliesEntity.java b/src/main/java/org/springblade/modules/yw/entity/EmergencySuppliesEntity.java
index fafa5d3..186b375 100644
--- a/src/main/java/org/springblade/modules/yw/entity/EmergencySuppliesEntity.java
+++ b/src/main/java/org/springblade/modules/yw/entity/EmergencySuppliesEntity.java
@@ -88,16 +88,6 @@
 	 */
 	@ApiModelProperty(value = "所属企业id")
 	private Long firmId;
-	/**
-	 * 责任人姓名
-	 */
-	@ApiModelProperty(value = "责任人姓名")
-	private String personInCha;
-	/**
-	 * 责任人电话
-	 */
-	@ApiModelProperty(value = "责任人电话")
-	private String personInChaPhone;
 
 	/**
 	 * 创建人
diff --git a/src/main/java/org/springblade/modules/yw/mapper/EmergencySpaceMapper.xml b/src/main/java/org/springblade/modules/yw/mapper/EmergencySpaceMapper.xml
index ddab7b4..631392d 100644
--- a/src/main/java/org/springblade/modules/yw/mapper/EmergencySpaceMapper.xml
+++ b/src/main/java/org/springblade/modules/yw/mapper/EmergencySpaceMapper.xml
@@ -2,28 +2,25 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.springblade.modules.yw.mapper.EmergencySpaceMapper">
 
-    <!-- 通用查询映射结果 -->
-    <resultMap id="emergencySpaceResultMap" type="org.springblade.modules.yw.entity.EmergencySpaceEntity">
-        <result column="id" property="id"/>
-        <result column="name" property="name"/>
-        <result column="type" property="type"/>
-        <result column="main_func" property="mainFunc"/>
-        <result column="lng" property="lng"/>
-        <result column="lat" property="lat"/>
-        <result column="pre_level" property="preLevel"/>
-        <result column="capacity" property="capacity"/>
-        <result column="remark" property="remark"/>
-        <result column="firm_id" property="firmId"/>
-        <result column="create_user" property="createUser"/>
-        <result column="create_time" property="createTime"/>
-        <result column="update_user" property="updateUser"/>
-        <result column="update_time" property="updateTime"/>
-        <result column="is_deleted" property="isDeleted"/>
-    </resultMap>
-
     <!--自定义分页查询-->
-    <select id="selectEmergencySpacePage" resultMap="emergencySpaceResultMap">
-        select * from yw_emergency_space where is_deleted = 0
+    <select id="selectEmergencySpacePage" resultType="org.springblade.modules.yw.vo.EmergencySpaceVO">
+        select
+        yes.*,
+        yfi.name as firmName,
+        bdb.dict_value as emergencySpaceType
+        from yw_emergency_space yes
+        left join blade_dict_biz bdb on bdb.dict_key = yes.type and bdb.code = 'emergency_space_type'
+        left join yw_firm_info yfi on yfi.id = yes.firm_id and yfi.is_deleted = 0
+        where yes.is_deleted = 0
+        <if test="emergencySpace.name!=null and emergencySpace.name!=''">
+            and yes.name like concat('%',#{emergencySpace.name},'%')
+        </if>
+        <if test="emergencySpace.firmId!=null">
+            and yes.firm_id = #{emergencySpace.firmId}
+        </if>
+        <if test="emergencySpace.type!=null">
+            and yes.type = #{emergencySpace.type}
+        </if>
     </select>
 
     <!--获取应急空间统计数据-->
diff --git a/src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.java b/src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.java
index 3bcaf08..87c3954 100644
--- a/src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.java
+++ b/src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.java
@@ -1,5 +1,6 @@
 package org.springblade.modules.yw.mapper;
 
+import org.apache.ibatis.annotations.Param;
 import org.springblade.modules.yw.entity.EmergencySuppliesEntity;
 import org.springblade.modules.yw.vo.EmergencySuppliesVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
@@ -21,6 +22,7 @@
 	 * @param emergencySupplies
 	 * @return
 	 */
-	List<EmergencySuppliesVO> selectEmergencySuppliesPage(IPage page, EmergencySuppliesVO emergencySupplies);
+	List<EmergencySuppliesVO> selectEmergencySuppliesPage(IPage page,
+														  @Param("emergencySupplies") EmergencySuppliesVO emergencySupplies);
 
 }
diff --git a/src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.xml b/src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.xml
index 27c5679..08f3869 100644
--- a/src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.xml
+++ b/src/main/java/org/springblade/modules/yw/mapper/EmergencySuppliesMapper.xml
@@ -6,14 +6,12 @@
     <resultMap id="emergencySuppliesResultMap" type="org.springblade.modules.yw.entity.EmergencySuppliesEntity">
         <result column="id" property="id"/>
         <result column="name" property="name"/>
-        <result column="number" property="number"/>
+        <result column="num" property="num"/>
         <result column="unit" property="unit"/>
-        <result column="address" property="address"/>
+        <result column="sto_loc" property="stoLoc"/>
         <result column="supplies_id" property="suppliesId"/>
         <result column="remark" property="remark"/>
         <result column="firm_id" property="firmId"/>
-        <result column="person_in_cha" property="personInCha"/>
-        <result column="person_in_cha_phone" property="personInChaPhone"/>
         <result column="create_user" property="createUser"/>
         <result column="create_time" property="createTime"/>
         <result column="update_user" property="updateUser"/>
@@ -22,8 +20,29 @@
     </resultMap>
 
     <!--自定义分页查询-->
-    <select id="selectEmergencySuppliesPage" resultMap="emergencySuppliesResultMap">
-        select * from yw_emergency_supplies where is_deleted = 0
+    <select id="selectEmergencySuppliesPage" resultType="org.springblade.modules.yw.vo.EmergencySuppliesVO">
+        select
+        yes.*,
+        yfi.name as firmName,
+        ys.per_in_cha as personInCha,ys.per_in_cha_pho as personInChaPhone,
+        bdb.dict_value as emeSupType,
+        concat(yes.num,bdb1.dict_value) as numUnit
+        from
+        yw_emergency_supplies yes
+        left join yw_supplies ys on ys.id = yes.supplies_id and ys.is_deleted = 0
+        left join yw_firm_info yfi on yfi.id = yes.firm_id and yfi.is_deleted = 0
+        left join blade_dict_biz bdb on bdb.dict_key = yes.type and bdb.code = 'eme_sup_type'
+        left join blade_dict_biz bdb1 on bdb1.dict_key = yes.unit and bdb1.code = 'unit'
+        where yes.is_deleted = 0
+        <if test="emergencySupplies.name!=null and emergencySupplies.name!=''">
+            and yes.name like concat('%',#{emergencySupplies.name},'%')
+        </if>
+        <if test="emergencySupplies.firmId!=null">
+            and yes.firm_id = #{emergencySupplies.firmId}
+        </if>
+        <if test="emergencySupplies.type!=null">
+            and yes.type = #{emergencySupplies.type}
+        </if>
     </select>
 
 </mapper>
diff --git a/src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.xml b/src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.xml
index 39e4d92..67790f7 100644
--- a/src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.xml
+++ b/src/main/java/org/springblade/modules/yw/mapper/RescueTeamMapper.xml
@@ -16,8 +16,23 @@
     </resultMap>
 
     <!--自定义分页查询-->
-    <select id="selectRescueTeamPage" resultMap="rescueTeamResultMap">
-        select * from yw_rescue_team where is_deleted = 0
+    <select id="selectRescueTeamPage" resultType="org.springblade.modules.yw.vo.RescueTeamVO">
+        select
+        yrt.*,
+        yfi.name as firmName
+        from
+        yw_rescue_team yrt
+        left join yw_firm_info yfi on yfi.id = yrt.firm_id and yfi.is_deleted = 0
+        where yrt.is_deleted = 0
+        <if test="rescueTeam.firmId!=null">
+            and yrt.firm_id = #{rescueTeam.firmId}
+        </if>
+        <if test="rescueTeam.perInCha!=null and rescueTeam.perInCha!=''">
+            and yrt.per_in_cha like concat('%',#{rescueTeam.perInCha},'%')
+        </if>
+        <if test="rescueTeam.perInChaPho!=null and rescueTeam.perInChaPho!=''">
+            and yrt.per_in_cha_pho like concat('%',#{rescueTeam.perInChaPho},'%')
+        </if>
     </select>
 
     <!--自定义分页查询-->
diff --git a/src/main/java/org/springblade/modules/yw/mapper/RiskSourceMapper.xml b/src/main/java/org/springblade/modules/yw/mapper/RiskSourceMapper.xml
index ed4fc87..2adb77d 100644
--- a/src/main/java/org/springblade/modules/yw/mapper/RiskSourceMapper.xml
+++ b/src/main/java/org/springblade/modules/yw/mapper/RiskSourceMapper.xml
@@ -17,8 +17,17 @@
     </resultMap>
 
     <!--自定义分页查询-->
-    <select id="selectRiskSourcePage" resultMap="riskSourceResultMap">
-        select * from yw_risk_source where is_deleted = 0
+    <select id="selectRiskSourcePage" resultType="org.springblade.modules.yw.vo.RiskSourceVO">
+        select
+        yrs.*,
+        yfi.name as firmName
+        from
+        yw_risk_source yrs
+        left join yw_firm_info yfi on yfi.id = yrs.firm_id and yfi.is_deleted = 0
+        where yrs.is_deleted = 0
+        <if test="riskSource.firmId!=null">
+            and yrs.firm_id = #{riskSource.firmId}
+        </if>
     </select>
 
     <!--风险源统计查询-->
diff --git a/src/main/java/org/springblade/modules/yw/service/impl/EmergencySpaceServiceImpl.java b/src/main/java/org/springblade/modules/yw/service/impl/EmergencySpaceServiceImpl.java
index 8a92110..8d9b4fd 100644
--- a/src/main/java/org/springblade/modules/yw/service/impl/EmergencySpaceServiceImpl.java
+++ b/src/main/java/org/springblade/modules/yw/service/impl/EmergencySpaceServiceImpl.java
@@ -3,6 +3,8 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.apache.logging.log4j.util.Strings;
+import org.springblade.common.cache.DictBizCache;
+import org.springblade.common.cache.SysCache;
 import org.springblade.common.utils.PositionUtil;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.modules.yw.entity.EmergencySpaceEntity;
@@ -39,7 +41,12 @@
 	 */
 	@Override
 	public IPage<EmergencySpaceVO> selectEmergencySpacePage(IPage<EmergencySpaceVO> page, EmergencySpaceVO emergencySpace) {
-		return page.setRecords(baseMapper.selectEmergencySpacePage(page, emergencySpace));
+		List<EmergencySpaceVO> emergencySpaceVOS = baseMapper.selectEmergencySpacePage(page, emergencySpace);
+		for (EmergencySpaceVO emergencySpaceVO : emergencySpaceVOS) {
+			// 设置应急空间主要用途
+			emergencySpaceVO.setMainFuncName(DictBizCache.getValues("emergency_space_use",emergencySpaceVO.getMainFunc()));
+		}
+		return page.setRecords(emergencySpaceVOS);
 	}
 
 	/**
diff --git a/src/main/java/org/springblade/modules/yw/vo/EmergencySpaceVO.java b/src/main/java/org/springblade/modules/yw/vo/EmergencySpaceVO.java
index 55d7722..b41e95a 100644
--- a/src/main/java/org/springblade/modules/yw/vo/EmergencySpaceVO.java
+++ b/src/main/java/org/springblade/modules/yw/vo/EmergencySpaceVO.java
@@ -1,23 +1,7 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
 package org.springblade.modules.yw.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springblade.modules.yw.entity.EmergencySpaceEntity;
-import org.springblade.core.tool.node.INode;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -32,4 +16,21 @@
 public class EmergencySpaceVO extends EmergencySpaceEntity {
 	private static final long serialVersionUID = 1L;
 
+	/**
+	 * 企业名称
+	 */
+	@ApiModelProperty(value = "企业名称")
+	private String firmName;
+
+	/**
+	 * 应急空间类型
+	 */
+	@ApiModelProperty(value = "应急空间类型")
+	private String emergencySpaceType;
+
+	/**
+	 * 主要功能
+	 */
+	@ApiModelProperty(value = "主要功能")
+	private String mainFuncName;
 }
diff --git a/src/main/java/org/springblade/modules/yw/vo/EmergencySuppliesVO.java b/src/main/java/org/springblade/modules/yw/vo/EmergencySuppliesVO.java
index a50eb69..fd089ea 100644
--- a/src/main/java/org/springblade/modules/yw/vo/EmergencySuppliesVO.java
+++ b/src/main/java/org/springblade/modules/yw/vo/EmergencySuppliesVO.java
@@ -1,23 +1,7 @@
-/*
- *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
- *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice,
- *  this list of conditions and the following disclaimer.
- *  Redistributions in binary form must reproduce the above copyright
- *  notice, this list of conditions and the following disclaimer in the
- *  documentation and/or other materials provided with the distribution.
- *  Neither the name of the dreamlu.net developer nor the names of its
- *  contributors may be used to endorse or promote products derived from
- *  this software without specific prior written permission.
- *  Author: Chill 庄骞 (smallchill@163.com)
- */
 package org.springblade.modules.yw.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springblade.modules.yw.entity.EmergencySuppliesEntity;
-import org.springblade.core.tool.node.INode;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -32,4 +16,25 @@
 public class EmergencySuppliesVO extends EmergencySuppliesEntity {
 	private static final long serialVersionUID = 1L;
 
+
+	@ApiModelProperty(value = "企业名称")
+	private String firmName;
+
+	@ApiModelProperty(value = "类型")
+	private String emeSupType;
+
+	@ApiModelProperty(value = "数量单位(拼接)")
+	private String numUnit;
+
+	/**
+	 * 责任人姓名
+	 */
+	@ApiModelProperty(value = "责任人姓名")
+	private String personInCha;
+	/**
+	 * 责任人电话
+	 */
+	@ApiModelProperty(value = "责任人电话")
+	private String personInChaPhone;
+
 }
diff --git a/src/main/java/org/springblade/modules/yw/vo/RescueTeamVO.java b/src/main/java/org/springblade/modules/yw/vo/RescueTeamVO.java
index e821151..81a02bd 100644
--- a/src/main/java/org/springblade/modules/yw/vo/RescueTeamVO.java
+++ b/src/main/java/org/springblade/modules/yw/vo/RescueTeamVO.java
@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.yw.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springblade.modules.yw.entity.RescueTeamEntity;
 import org.springblade.core.tool.node.INode;
 import lombok.Data;
@@ -32,4 +33,7 @@
 public class RescueTeamVO extends RescueTeamEntity {
 	private static final long serialVersionUID = 1L;
 
+	@ApiModelProperty(value = "企业名称")
+	private String firmName;
+
 }
diff --git a/src/main/java/org/springblade/modules/yw/vo/RiskSourceVO.java b/src/main/java/org/springblade/modules/yw/vo/RiskSourceVO.java
index dfa704e..b5e5a35 100644
--- a/src/main/java/org/springblade/modules/yw/vo/RiskSourceVO.java
+++ b/src/main/java/org/springblade/modules/yw/vo/RiskSourceVO.java
@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.yw.vo;
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springblade.modules.yw.entity.RiskSourceEntity;
 import org.springblade.core.tool.node.INode;
 import lombok.Data;
@@ -32,4 +33,6 @@
 public class RiskSourceVO extends RiskSourceEntity {
 	private static final long serialVersionUID = 1L;
 
+	@ApiModelProperty(value = "企业名称")
+	private String firmName;
 }

--
Gitblit v1.9.3