设备激活二维码生成逻辑修改,设备上报基本信息新增接口添加设备编码查重逻辑。
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
package com.fastbee.iot.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -18,6 +19,7 @@ import com.fastbee.common.core.domain.BaseEntity;
|
||||
@ApiModel(value = "DeviceReportInfo",description = "设备上电审核前上报的基础信息 iot_device_report_info")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("iot_device_report_info")
|
||||
public class DeviceReportInfo extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
@ -93,7 +95,7 @@ public class DeviceReportInfo extends BaseEntity
|
||||
/** 批号 */
|
||||
@Excel(name = "批号")
|
||||
@ApiModelProperty("批号")
|
||||
private Long batchNumber;
|
||||
private String batchNumber;
|
||||
|
||||
/** 设备编号 */
|
||||
@Excel(name = "设备编号")
|
||||
@ -125,4 +127,9 @@ public class DeviceReportInfo extends BaseEntity
|
||||
@ApiModelProperty("代工厂家名称")
|
||||
private String replaceManufacturerName;
|
||||
|
||||
/** 对应设备id */
|
||||
@Excel(name = "对应设备id")
|
||||
@ApiModelProperty("对应设备id")
|
||||
private Long deviceId;
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,8 @@
|
||||
package com.fastbee.iot.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.fastbee.iot.domain.DeviceReportInfo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@ -12,7 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
* @date 2024-12-05
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeviceReportInfoMapper
|
||||
public interface DeviceReportInfoMapper extends BaseMapper<DeviceReportInfo>
|
||||
{
|
||||
/**
|
||||
* 查询设备上电审核前上报的基础信息
|
||||
|
@ -1,6 +1,9 @@
|
||||
package com.fastbee.iot.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.fastbee.common.exception.ServiceException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fastbee.iot.mapper.DeviceReportInfoMapper;
|
||||
@ -56,6 +59,15 @@ public class DeviceReportInfoServiceImpl implements IDeviceReportInfoService
|
||||
@Override
|
||||
public int insertDeviceReportInfo(DeviceReportInfo deviceReportInfo)
|
||||
{
|
||||
//查重
|
||||
List<DeviceReportInfo> list = new LambdaQueryChainWrapper<>(deviceReportInfoMapper)
|
||||
.select(DeviceReportInfo::getSerialNumber)
|
||||
.eq(DeviceReportInfo::getSerialNumber, deviceReportInfo.getSerialNumber())
|
||||
.list();
|
||||
System.err.println("查重:"+list);
|
||||
if (!list.isEmpty()) {
|
||||
throw new ServiceException("设备编号重复!");
|
||||
}
|
||||
return deviceReportInfoMapper.insertDeviceReportInfo(deviceReportInfo);
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,11 @@
|
||||
<result property="lcdManufacturerName" column="lcd_manufacturer_name" />
|
||||
<result property="voiceManufacturerName" column="voice_manufacturer_name" />
|
||||
<result property="replaceManufacturerName" column="replace_manufacturer_name" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceReportInfoVo">
|
||||
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name, lcd_manufacturer_name, voice_manufacturer_name, replace_manufacturer_name from iot_device_report_info
|
||||
select id, imei, iccid, mcu_id, bsp_type, lte_type, mcu_type, mcu_fw, lte_fw, lcd_manufacturer, voice_manufacturer, fram_model, replace_manufacturer, test_record, batch_number, serial_number, qr_code, name, lcd_manufacturer_name, voice_manufacturer_name, replace_manufacturer_name, device_id from iot_device_report_info
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceReportInfoList" parameterType="DeviceReportInfo" resultMap="DeviceReportInfoResult">
|
||||
@ -55,6 +56,7 @@
|
||||
<if test="lcdManufacturerName != null and lcdManufacturerName != ''"> and lcd_manufacturer_name like concat('%', #{lcdManufacturerName}, '%')</if>
|
||||
<if test="voiceManufacturerName != null and voiceManufacturerName != ''"> and voice_manufacturer_name like concat('%', #{voiceManufacturerName}, '%')</if>
|
||||
<if test="replaceManufacturerName != null and replaceManufacturerName != ''"> and replace_manufacturer_name like concat('%', #{replaceManufacturerName}, '%')</if>
|
||||
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -86,6 +88,7 @@
|
||||
<if test="lcdManufacturerName != null">lcd_manufacturer_name,</if>
|
||||
<if test="voiceManufacturerName != null">voice_manufacturer_name,</if>
|
||||
<if test="replaceManufacturerName != null">replace_manufacturer_name,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="imei != null and imei != ''">#{imei},</if>
|
||||
@ -108,6 +111,7 @@
|
||||
<if test="lcdManufacturerName != null">#{lcdManufacturerName},</if>
|
||||
<if test="voiceManufacturerName != null">#{voiceManufacturerName},</if>
|
||||
<if test="replaceManufacturerName != null">#{replaceManufacturerName},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -134,6 +138,7 @@
|
||||
<if test="lcdManufacturerName != null">lcd_manufacturer_name = #{lcdManufacturerName},</if>
|
||||
<if test="voiceManufacturerName != null">voice_manufacturer_name = #{voiceManufacturerName},</if>
|
||||
<if test="replaceManufacturerName != null">replace_manufacturer_name = #{replaceManufacturerName},</if>
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
Reference in New Issue
Block a user