mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-17 16:36:03 +08:00
固件升级完善
This commit is contained in:
@@ -87,6 +87,17 @@ public class FirmwareController extends BaseController
|
|||||||
return AjaxResult.success(firmwareService.selectFirmwareByFirmwareId(firmwareId));
|
return AjaxResult.success(firmwareService.selectFirmwareByFirmwareId(firmwareId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备最新固件
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取设备最新固件")
|
||||||
|
@PreAuthorize("@ss.hasPermi('iot:firmware:query')")
|
||||||
|
@GetMapping(value = "/getLatest/{deviceId}")
|
||||||
|
public AjaxResult getLatest(@PathVariable("deviceId") Long deviceId)
|
||||||
|
{
|
||||||
|
return AjaxResult.success(firmwareService.selectLatestFirmware(deviceId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增产品固件
|
* 新增产品固件
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ public class Firmware extends BaseEntity
|
|||||||
@Excel(name = "是否系统通用", readConverterExp = "0=-否,1-是")
|
@Excel(name = "是否系统通用", readConverterExp = "0=-否,1-是")
|
||||||
private Integer isSys;
|
private Integer isSys;
|
||||||
|
|
||||||
|
/** 是否最新版(0-否,1-是) */
|
||||||
|
@Excel(name = "是否系统通用", readConverterExp = "0=-否,1-是")
|
||||||
|
private Integer isLatest;
|
||||||
|
|
||||||
/** 固件版本 */
|
/** 固件版本 */
|
||||||
@Excel(name = "固件版本")
|
@Excel(name = "固件版本")
|
||||||
private BigDecimal version;
|
private BigDecimal version;
|
||||||
@@ -54,7 +58,15 @@ public class Firmware extends BaseEntity
|
|||||||
/** 删除标志(0代表存在 2代表删除) */
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
public void setFirmwareId(Long firmwareId)
|
public Integer getIsLatest() {
|
||||||
|
return isLatest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsLatest(Integer isLatest) {
|
||||||
|
this.isLatest = isLatest;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirmwareId(Long firmwareId)
|
||||||
{
|
{
|
||||||
this.firmwareId = firmwareId;
|
this.firmwareId = firmwareId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,14 @@ public interface FirmwareMapper
|
|||||||
*/
|
*/
|
||||||
public Firmware selectFirmwareByFirmwareId(Long firmwareId);
|
public Firmware selectFirmwareByFirmwareId(Long firmwareId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备最新固件
|
||||||
|
*
|
||||||
|
* @param deviceId 产品固件主键
|
||||||
|
* @return 产品固件
|
||||||
|
*/
|
||||||
|
public Firmware selectLatestFirmware(Long deviceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询产品固件列表
|
* 查询产品固件列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -19,6 +19,14 @@ public interface IFirmwareService
|
|||||||
*/
|
*/
|
||||||
public Firmware selectFirmwareByFirmwareId(Long firmwareId);
|
public Firmware selectFirmwareByFirmwareId(Long firmwareId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备最新固件
|
||||||
|
*
|
||||||
|
* @param deviceId 产品固件主键
|
||||||
|
* @return 产品固件
|
||||||
|
*/
|
||||||
|
public Firmware selectLatestFirmware(Long deviceId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询产品固件列表
|
* 查询产品固件列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -37,6 +37,18 @@ public class FirmwareServiceImpl implements IFirmwareService
|
|||||||
return firmwareMapper.selectFirmwareByFirmwareId(firmwareId);
|
return firmwareMapper.selectFirmwareByFirmwareId(firmwareId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备最新固件
|
||||||
|
*
|
||||||
|
* @param deviceId 产品固件主键
|
||||||
|
* @return 产品固件
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Firmware selectLatestFirmware(Long deviceId)
|
||||||
|
{
|
||||||
|
return firmwareMapper.selectLatestFirmware(deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询产品固件列表
|
* 查询产品固件列表
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="tenantId" column="tenant_id" />
|
<result property="tenantId" column="tenant_id" />
|
||||||
<result property="tenantName" column="tenant_name" />
|
<result property="tenantName" column="tenant_name" />
|
||||||
<result property="isSys" column="is_sys" />
|
<result property="isSys" column="is_sys" />
|
||||||
|
<result property="isLatest" column="is_latest" />
|
||||||
<result property="version" column="version" />
|
<result property="version" column="version" />
|
||||||
<result property="filePath" column="file_path" />
|
<result property="filePath" column="file_path" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
@@ -20,7 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectFirmwareVo">
|
<sql id="selectFirmwareVo">
|
||||||
select firmware_id, firmware_name, product_id, product_name, tenant_id, tenant_name, is_sys, version, file_path, create_time, update_time, remark from iot_firmware
|
select firmware_id, firmware_name, product_id, product_name, tenant_id, tenant_name, is_sys,is_latest, version, file_path, create_time, update_time, remark from iot_firmware
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectFirmwareList" parameterType="com.ruoyi.iot.domain.Firmware" resultMap="FirmwareResult">
|
<select id="selectFirmwareList" parameterType="com.ruoyi.iot.domain.Firmware" resultMap="FirmwareResult">
|
||||||
@@ -30,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
|
||||||
<if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if>
|
<if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if>
|
||||||
<if test="productId != null"> and product_id = #{productId}</if>
|
<if test="productId != null"> and product_id = #{productId}</if>
|
||||||
|
<if test="isLatest != null"> and is_latest = #{isLatest}</if>
|
||||||
</where>
|
</where>
|
||||||
order by create_time desc
|
order by create_time desc
|
||||||
</select>
|
</select>
|
||||||
@@ -38,6 +40,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<include refid="selectFirmwareVo"/>
|
<include refid="selectFirmwareVo"/>
|
||||||
where firmware_id = #{firmwareId}
|
where firmware_id = #{firmwareId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectLatestFirmware" parameterType="Long" resultMap="FirmwareResult">
|
||||||
|
select f.firmware_id, f.firmware_name, f.product_id, f.product_name, f.tenant_id, f.tenant_name, f.is_sys,f.is_latest, f.version,
|
||||||
|
f.file_path, f.create_time, f.remark
|
||||||
|
from iot_device d
|
||||||
|
left join iot_firmware f on d.product_id = f.product_id
|
||||||
|
where d.device_id=#{deviceId} and f.is_latest=1
|
||||||
|
order by f.create_time desc
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertFirmware" parameterType="com.ruoyi.iot.domain.Firmware" useGeneratedKeys="true" keyProperty="firmwareId">
|
<insert id="insertFirmware" parameterType="com.ruoyi.iot.domain.Firmware" useGeneratedKeys="true" keyProperty="firmwareId">
|
||||||
insert into iot_firmware
|
insert into iot_firmware
|
||||||
@@ -48,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="tenantId != null">tenant_id,</if>
|
<if test="tenantId != null">tenant_id,</if>
|
||||||
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
|
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
|
||||||
<if test="isSys != null">is_sys,</if>
|
<if test="isSys != null">is_sys,</if>
|
||||||
|
<if test="isLatest != null">is_latest,</if>
|
||||||
<if test="version != null">version,</if>
|
<if test="version != null">version,</if>
|
||||||
<if test="filePath != null and filePath != ''">file_path,</if>
|
<if test="filePath != null and filePath != ''">file_path,</if>
|
||||||
<if test="delFlag != null">del_flag,</if>
|
<if test="delFlag != null">del_flag,</if>
|
||||||
@@ -64,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="tenantId != null">#{tenantId},</if>
|
<if test="tenantId != null">#{tenantId},</if>
|
||||||
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
|
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
|
||||||
<if test="isSys != null">#{isSys},</if>
|
<if test="isSys != null">#{isSys},</if>
|
||||||
|
<if test="isLatest != null">#{isLatest},</if>
|
||||||
<if test="version != null">#{version},</if>
|
<if test="version != null">#{version},</if>
|
||||||
<if test="filePath != null and filePath != ''">#{filePath},</if>
|
<if test="filePath != null and filePath != ''">#{filePath},</if>
|
||||||
<if test="delFlag != null">#{delFlag},</if>
|
<if test="delFlag != null">#{delFlag},</if>
|
||||||
@@ -84,6 +98,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||||
<if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</if>
|
<if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</if>
|
||||||
<if test="isSys != null">is_sys = #{isSys},</if>
|
<if test="isSys != null">is_sys = #{isSys},</if>
|
||||||
|
<if test="isLatest != null">is_latest = #{isLatest},</if>
|
||||||
<if test="version != null">version = #{version},</if>
|
<if test="version != null">version = #{version},</if>
|
||||||
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
|
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
|
||||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user