feat(iot): 设备增加图标和预览图附件支持
- 在 Device 模型中添加 iconId 和 previewId 字段,用于存储附件 ID - 在 DeviceDto、DeviceServeDto 和 DeviceVo 中添加对应的字段和关联对象 - 更新 DeviceMapper.xml 以支持新字段的查询和映射 - 优化 BulletinMapper.xml 中的附件查询逻辑 - 移除 BulletinServiceImpl 中未使用的 UserRepository 依赖
This commit is contained in:
parent
0b5288cbe2
commit
3bfa34bab5
@ -60,6 +60,11 @@ public class BatchDeviceDto {
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
public String icon;
|
||||
public String iconId;
|
||||
|
||||
/**
|
||||
* 预览图
|
||||
*/
|
||||
public String previewId;
|
||||
|
||||
}
|
||||
|
@ -57,6 +57,11 @@ public class DeviceDto {
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
public String icon;
|
||||
public String iconId;
|
||||
|
||||
/**
|
||||
* 预览图
|
||||
*/
|
||||
public String previewId;
|
||||
|
||||
}
|
||||
|
@ -38,7 +38,12 @@ public class DeviceServeDto {
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
public String icon;
|
||||
public String iconId;
|
||||
|
||||
/**
|
||||
* 预览图
|
||||
*/
|
||||
public String previewId;
|
||||
|
||||
/**
|
||||
* 参数
|
||||
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.zsc.edu.gateway.common.enums.IState;
|
||||
import com.zsc.edu.gateway.framework.json.JsonbTypeHandler;
|
||||
import com.zsc.edu.gateway.modules.attachment.entity.Attachment;
|
||||
import com.zsc.edu.gateway.modules.iot.product.entity.Product;
|
||||
import com.zsc.edu.gateway.modules.system.entity.BaseEntity;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -109,10 +110,26 @@ public class Device extends BaseEntity {
|
||||
public Double latitude;
|
||||
|
||||
/**
|
||||
* 设备图标
|
||||
* 设备图标附件ID
|
||||
*/
|
||||
public String icon;
|
||||
public String iconId;
|
||||
|
||||
/**
|
||||
* 设备图标附件
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
public Attachment icon;
|
||||
|
||||
/**
|
||||
* 设备预览图附件ID
|
||||
*/
|
||||
public String previewId;
|
||||
|
||||
/**
|
||||
* 设备预览图附件
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
public Attachment preview;
|
||||
|
||||
public enum Status implements IEnum<Integer>, IState<Status> {
|
||||
UNACTIVATED(0, "未激活"),
|
||||
|
@ -3,6 +3,7 @@ package com.zsc.edu.gateway.modules.iot.device.vo;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zsc.edu.gateway.framework.json.JsonbTypeHandler;
|
||||
import com.zsc.edu.gateway.modules.attachment.entity.Attachment;
|
||||
import com.zsc.edu.gateway.modules.iot.device.entity.Device;
|
||||
import com.zsc.edu.gateway.modules.iot.product.entity.Product;
|
||||
import com.zsc.edu.gateway.modules.iot.tsl.entity.Param;
|
||||
@ -107,9 +108,24 @@ public class DeviceVo {
|
||||
public Double latitude;
|
||||
|
||||
/**
|
||||
* 设备图标
|
||||
* 设备图标附件ID
|
||||
*/
|
||||
public String icon;
|
||||
public String iconId;
|
||||
|
||||
/**
|
||||
* 设备图标附件
|
||||
*/
|
||||
public Attachment icon;
|
||||
|
||||
/**
|
||||
* 设备预览图附件ID
|
||||
*/
|
||||
public String previewId;
|
||||
|
||||
/**
|
||||
* 设备预览图附件
|
||||
*/
|
||||
public Attachment preview;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,6 @@ public class BulletinServiceImpl extends ServiceImpl<BulletinRepository, Bulleti
|
||||
|
||||
private final BulletinMapper mapper;
|
||||
private final BulletinRepository repo;
|
||||
private final UserRepository userRepository;
|
||||
private final BulletinAttachmentRepository bulletinAttachmentRepository;
|
||||
/**
|
||||
* 查询公告详情
|
||||
|
@ -24,7 +24,8 @@
|
||||
<result column="remark" jdbcType="VARCHAR" property="deviceRemark"/>
|
||||
<result column="longitude" jdbcType="DOUBLE" property="longitude"/>
|
||||
<result column="latitude" jdbcType="DOUBLE" property="latitude"/>
|
||||
<result column="icon" jdbcType="VARCHAR" property="icon"/>
|
||||
<result column="icon_id" jdbcType="VARCHAR" property="iconId"/>
|
||||
<result column="preview_id" jdbcType="VARCHAR" property="previewId"/>
|
||||
<result column="name" property="productName"/>
|
||||
<result column="product_type" jdbcType="VARCHAR" property="productType"/>
|
||||
<result column="model" property="model"/>
|
||||
@ -35,6 +36,18 @@
|
||||
<result column="update_time" jdbcType="DATE" property="updateTime"/>
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||
<result column="enabled" jdbcType="BOOLEAN" property="enabled"/>
|
||||
<association property="icon" javaType="com.zsc.edu.gateway.modules.attachment.entity.Attachment"
|
||||
autoMapping="true"
|
||||
columnPrefix="icon_">
|
||||
<id column="id" property="id"/>
|
||||
<result column="file_name" property="fileName"/>
|
||||
</association>
|
||||
<association property="preview" javaType="com.zsc.edu.gateway.modules.attachment.entity.Attachment"
|
||||
autoMapping="true"
|
||||
columnPrefix="preview_">
|
||||
<id column="id" property="id"/>
|
||||
<result column="file_name" property="fileName"/>
|
||||
</association>
|
||||
<collection property="params" ofType="com.zsc.edu.gateway.modules.iot.tsl.entity.Param" autoMapping="true"
|
||||
columnPrefix="param_">
|
||||
<id column="id" property="id"/>
|
||||
@ -56,10 +69,16 @@
|
||||
ip.type as param_type,
|
||||
ip.identifier as param_identifier,
|
||||
ip.name as param_name,
|
||||
ip.remark as param_remark
|
||||
ip.remark as param_remark,
|
||||
ai.id as icon_id,
|
||||
ai.file_name as icon_file_name,
|
||||
ap.file_name as preview_file_name,
|
||||
ap.id as preview_id
|
||||
from iot_device d
|
||||
left join iot_product p on d.product_id = p.id
|
||||
left join iot_param ip on p.id = ip.foreign_id and ip.foreign_type = 3
|
||||
left join attachment ai on d.icon_id = ai.id
|
||||
left join attachment ap on d.preview_id = ap.id
|
||||
where d.id = #{id}
|
||||
</select>
|
||||
|
||||
|
@ -25,8 +25,8 @@
|
||||
<result column="remark" jdbcType="VARCHAR" property="remark"/>
|
||||
<collection property="attachments" ofType="com.zsc.edu.gateway.modules.attachment.entity.Attachment"
|
||||
autoMapping="true" columnPrefix="attachment_">
|
||||
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||
<result column="file_name" jdbcType="VARCHAR" property="fileName"/>
|
||||
<id column="id" property="id"/>
|
||||
<result column="file_name" property="fileName"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
<select id="selectByBulletinId" resultMap="BulletinMap">
|
||||
|
BIN
storage/attachment/3013b01a2c4db4e6354db9e6376aa4a7409b5162
Normal file
BIN
storage/attachment/3013b01a2c4db4e6354db9e6376aa4a7409b5162
Normal file
Binary file not shown.
BIN
storage/attachment/aef555e74ce46ee9b2b4f67f90c32512751a5db6
Normal file
BIN
storage/attachment/aef555e74ce46ee9b2b4f67f90c32512751a5db6
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
BIN
storage/temp/863733116800
Normal file
BIN
storage/temp/863733116800
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Loading…
Reference in New Issue
Block a user