Merge pull request 'feat: 修改查询化学品信息' (#1) from zhangyu/security-knowledge-base:master into master

Reviewed-on: http://81.70.119.104:3000/xxhjsb/security-knowledge-base/pulls/1
master^2
zhouxi 2023-03-03 11:59:32 +08:00
commit 93ca711fa9
3 changed files with 203 additions and 199 deletions

View File

@ -8,6 +8,7 @@ import com.hbt.security.knowledge.base.msds.mapper.MsdsMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List; import java.util.List;
@ -37,7 +38,11 @@ public class MsdsDaoImpl implements MsdsDao {
*/ */
@Override @Override
public Msds selectMsdsByName(String name) { public Msds selectMsdsByName(String name) {
return msdsMapper.selectMsdsByName(name); List<Msds> list = msdsMapper.selectMsdsByName(name);
if(CollectionUtils.isEmpty(list)) {
return new Msds();
}
return list.get(0);
} }
/** /**

View File

@ -4,7 +4,6 @@ import java.util.List;
import com.hbt.msds.api.domain.Msds; import com.hbt.msds.api.domain.Msds;
import com.hbt.msds.api.domain.MsdsMaterial; import com.hbt.msds.api.domain.MsdsMaterial;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -28,7 +27,7 @@ public interface MsdsMapper
* @param name * @param name
* @return * @return
*/ */
Msds selectMsdsByName(String name); List<Msds> selectMsdsByName(String name);
/** /**
* *

View File

@ -200,9 +200,9 @@
<select id="selectMsdsByName" parameterType="String" resultMap="MsdsMsdsMaterialResult"> <select id="selectMsdsByName" parameterType="String" resultMap="MsdsMsdsMaterialResult">
select a.id, a.chemical_cn, a.other_chemical_cn, a.chemical_en, a.other_chemical_en, a.cas, a.type, a.detonator_profession1, a.detonator_profession1_concentration, a.detonator_profession1_CAS_No, a.detonator_profession2, a.detonator_profession2_concentration, a.detonator_profession2_CAS_No, a.detonator_profession3, a.detonator_profession3_concentration, a.detonator_profession3_CAS_No, a.detonator_profession4, a.detonator_profession4_concentration, a.detonator_profession4_CAS_No, a.detonator_profession5, a.detonator_profession5_concentration, a.detonator_profession5_CAS_No, a.hazard_category, a.Invasion_route, a.health_hazards, a.environmental_hazards, a.explosion_hazard, a.skin_contact, a.eye_contact, a.inhalation, a.ingestion, a.hazard_characteristics, a.hazardous_combustion_products, a.fire_extinguishing_method, a.fire_fighting, a.emergency_actions, a.operational_considerations, a.storage_precautions, a.MAC, a.PC_TWA, a.PC_STEL, a.TLV_C, a.TLV_TWA, a.TLV_STEL, a.monitoring_methods, a.engineering_control, a.respiratory_protection, a.eye_protection, a.physical_protection, a.hand_protection, a.other_protection, a.appearance_and_shape, a.ph_value, a.melting_point, a.boiling_point, a.relative_density, a.relative_vapor_density, a.saturated_vapor_pressure, a.heat_of_combustion, a.critical, a.critical_pressure, a.octanol_water_partition_coefficient, a.flash_point, a.Ignition_temperature, a.lower_explosion_limit, a.upper_explosion_limit, a.solubility, a.main_uses, a.stability, a.forbidden_mixtures, a.avoid_contact_conditions, a.aggregation_hazards, a.decomposition_products, a.nature_of_waste, a.disposal_methods, a.deprecation_considerations, a.dangerous_goods_number, a.un_number, a.packaging_category, a.packaging_logo, a.packaging_method, a.shipping_precautions, a.regulatory_information, a.critical_value select DISTINCT a.id, a.chemical_cn, a.other_chemical_cn, a.chemical_en, a.other_chemical_en, a.cas, a.type, a.detonator_profession1, a.detonator_profession1_concentration, a.detonator_profession1_CAS_No, a.detonator_profession2, a.detonator_profession2_concentration, a.detonator_profession2_CAS_No, a.detonator_profession3, a.detonator_profession3_concentration, a.detonator_profession3_CAS_No, a.detonator_profession4, a.detonator_profession4_concentration, a.detonator_profession4_CAS_No, a.detonator_profession5, a.detonator_profession5_concentration, a.detonator_profession5_CAS_No, a.hazard_category, a.Invasion_route, a.health_hazards, a.environmental_hazards, a.explosion_hazard, a.skin_contact, a.eye_contact, a.inhalation, a.ingestion, a.hazard_characteristics, a.hazardous_combustion_products, a.fire_extinguishing_method, a.fire_fighting, a.emergency_actions, a.operational_considerations, a.storage_precautions, a.MAC, a.PC_TWA, a.PC_STEL, a.TLV_C, a.TLV_TWA, a.TLV_STEL, a.monitoring_methods, a.engineering_control, a.respiratory_protection, a.eye_protection, a.physical_protection, a.hand_protection, a.other_protection, a.appearance_and_shape, a.ph_value, a.melting_point, a.boiling_point, a.relative_density, a.relative_vapor_density, a.saturated_vapor_pressure, a.heat_of_combustion, a.critical, a.critical_pressure, a.octanol_water_partition_coefficient, a.flash_point, a.Ignition_temperature, a.lower_explosion_limit, a.upper_explosion_limit, a.solubility, a.main_uses, a.stability, a.forbidden_mixtures, a.avoid_contact_conditions, a.aggregation_hazards, a.decomposition_products, a.nature_of_waste, a.disposal_methods, a.deprecation_considerations, a.dangerous_goods_number, a.un_number, a.packaging_category, a.packaging_logo, a.packaging_method, a.shipping_precautions, a.regulatory_information, a.critical_value
from msds a from msds a
where a.chemical_cn = #{name} where a.chemical_cn = #{name} or FIND_IN_SET(#{name} ,REPLACE(a.other_chemical_cn, '', ',') )
</select> </select>