lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcBigScreenEquipmentDto.java
@@ -13,6 +13,10 @@ private String equipmentId; private String equipmentName; private String equipmentType; private String equipmentImage; private Integer equipmentStatus; lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentTypeMapper.java
@@ -1,6 +1,7 @@ package org.jeecg.modules.mdc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcEquipmentType; /** @@ -10,4 +11,11 @@ */ public interface MdcEquipmentTypeMapper extends BaseMapper<MdcEquipmentType> { /** * 根据设备类型名称查询设备类型图片 * @param equipmentType * @return */ String findEquipmentTypeImage(@Param("equipmentType") String equipmentType); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentTypeMapper.xml
@@ -2,4 +2,13 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.mdc.mapper.MdcEquipmentTypeMapper"> <!--根据设备类型名称查询设备类型图片--> <select id="findEquipmentTypeImage" resultType="java.lang.String"> SELECT equipment_type_pictures FROM mdc_equipment_type WHERE equipment_type_name = #{ equipmentType } AND equipment_type_states = 'Y' </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcWorkshopInfoMapper.xml
@@ -7,6 +7,8 @@ SELECT mew.id id, a.EquipmentID equipmentId, me.equipment_name equipmentName, me.equipment_type equipmentType, mew.equipment_image equipmentImage, a.Oporation equipmentStatus, mew.coordinate_left coordinateLeft, @@ -15,9 +17,10 @@ mew.vh vh FROM EquipmentLog a INNER JOIN ( SELECT EquipmentID, MAX ( CollectTime ) 'maxgdtime' FROM EquipmentLog GROUP BY EquipmentID ) b ON a.EquipmentID= b.EquipmentID INNER JOIN mdc_workshop_equipment mew ON mew.equipment_id = a.EquipmentID AND a.CollectTime= b.maxgdtime AND mew.workshop_id = #{ workshopId } INNER JOIN ( SELECT EquipmentID, MAX ( CollectTime ) 'maxgdtime' FROM EquipmentLog GROUP BY EquipmentID ) b ON a.EquipmentID= b.EquipmentID INNER JOIN mdc_workshop_equipment mew ON mew.equipment_id = a.EquipmentID INNER JOIN mdc_equipment me ON me.equipment_id = a.EquipmentID AND a.CollectTime= b.maxgdtime AND mew.workshop_id = #{ workshopId } </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentTypeService.java
@@ -65,4 +65,11 @@ * @return */ boolean deleteBatchEquipmentType(String ids); /** * 根据设备类型名称查询设备类型图片 * @param equipmentType * @return */ String findEquipmentTypeImage(String equipmentType); } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentTypeServiceImpl.java
@@ -69,4 +69,14 @@ public boolean deleteBatchEquipmentType(String ids) { return this.removeByIds(Arrays.asList(ids.split(","))); } /** * 根据设备类型名称查询设备类型图片 * @param equipmentType * @return */ @Override public String findEquipmentTypeImage(String equipmentType) { return this.baseMapper.findEquipmentTypeImage(equipmentType); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcWorkshopInfoServiceImpl.java
@@ -2,12 +2,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; import org.jeecg.modules.mdc.dto.MdcBigScreenEquipmentDto; import org.jeecg.modules.mdc.entity.MdcWorkshopInfo; import org.jeecg.modules.mdc.mapper.MdcWorkshopInfoMapper; import org.jeecg.modules.mdc.service.IMdcEquipmentTypeService; import org.jeecg.modules.mdc.service.IMdcWorkshopInfoService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; /** @@ -19,6 +22,9 @@ @Service public class MdcWorkshopInfoServiceImpl extends ServiceImpl<MdcWorkshopInfoMapper, MdcWorkshopInfo> implements IMdcWorkshopInfoService { @Resource private IMdcEquipmentTypeService mdcEquipmentTypeService; /** * 大屏信息 * @param workshopId @@ -26,6 +32,12 @@ */ @Override public List<MdcBigScreenEquipmentDto> getBigScreenInfo(String workshopId) { return this.baseMapper.getBigScreenInfo(workshopId); List<MdcBigScreenEquipmentDto> list = this.baseMapper.getBigScreenInfo(workshopId); for (MdcBigScreenEquipmentDto mdcBigScreenEquipmentDto : list) { if (StringUtils.isEmpty(mdcBigScreenEquipmentDto.getEquipmentImage())) { mdcBigScreenEquipmentDto.setEquipmentImage(mdcEquipmentTypeService.findEquipmentTypeImage(mdcBigScreenEquipmentDto.getEquipmentType())); } } return list; } }