设备型号版本功能完善

This commit is contained in:
SjS 2025-04-18 10:24:27 +08:00
parent b7379ee51b
commit a66ca59134
8 changed files with 62 additions and 29 deletions

View File

@ -139,15 +139,29 @@
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="deviceId" />
<el-table-column label="图片" align="center" prop="picture" width="100">
<el-table-column label="分类" align="center" prop="classifyName" />
<el-table-column label="设备Mac号" align="center" prop="mac" />
<el-table-column label="型号" align="center" prop="model" />
<el-table-column label="型号名称" align="center" prop="modelName" />
<el-table-column label="型号图片" align="center" prop="modelPicture" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.modelPicture" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="版本号" align="center" prop="version" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="用户" align="center" prop="userName" >
<template slot-scope="scope">
<router-link :to="'/user/user/userName/index/' + scope.row.userName" class="link-type">
<span>{{ scope.row.userName }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column label="设备图片" align="center" prop="picture" width="100">
<template slot-scope="scope">
<image-preview :src="scope.row.picture" :width="50" :height="50" />
</template>
</el-table-column>
<el-table-column label="名称" align="center" prop="deviceName" />
<el-table-column label="分类" align="center" prop="classifyName" />
<el-table-column label="型号" align="center" prop="model" />
<el-table-column label="设备Mac号" align="center" prop="mac" />
<el-table-column
label="激活时间"
align="center"
@ -158,6 +172,7 @@
<span>{{ parseTime(scope.row.activationTime, "{y}-{m}-{d}") }}</span>
</template>
</el-table-column>
<el-table-column label="在线状态" align="center" prop="onlineStatus">
<template slot-scope="scope">
<dict-tag
@ -166,14 +181,9 @@
/>
</template>
</el-table-column>
<el-table-column label="用户" align="center" prop="userName" >
<template slot-scope="scope">
<router-link :to="'/user/user/userName/index/' + scope.row.userName" class="link-type">
<span>{{ scope.row.userName }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column label="版本号" align="center" prop="version" />
<el-table-column
label="操作"
:width="200"
@ -490,6 +500,8 @@ export default {
pageSize: 10,
deviceName: null,
classifyName: null,
modelName: null,
modelPicture: null,
model: null,
mac: null,
onlineStatus: null,

View File

@ -494,11 +494,11 @@ public class AppController extends BaseController
/**
* 获取已录入设备列表
*/
@GetMapping("/getExistMac/{macs}")
public AjaxResult getExistMac(@PathVariable List<String> macs)
@PostMapping("/getExistListByMacs")
public AjaxResult getExistMac(@RequestBody AsDevice asDevice)
{
logger.info("【获取已录入设备列表】参数-----macs=【{}】",macs);
List<AsDevice> devices = asDeviceService.getExistMac(macs);
logger.info("【获取已录入设备列表】参数-----macs=【{}】",asDevice);
List<AsDevice> devices = asDeviceService.getExistMac(asDevice);
return AjaxResult.success(devices);
}

View File

@ -48,8 +48,15 @@ public class AsDevice extends BaseEntity
private String classifyName;
/** 型号id */
@Excel(name = "型号id")
private Long modelId;
@Excel(name = "mac集合")
private List<String> macList;
@Excel(name = "未查询到数据的mac号集合")
private List<String> missingMacs;
/** 型号 */
@Excel(name = "型号")
private String model;
@ -175,4 +182,8 @@ public class AsDevice extends BaseEntity
/** 设备前缀 */
@Excel(name = "型号前缀")
private String pre;
@Excel(name = "型号图片")
private String modelPicture;
}

View File

@ -6,5 +6,5 @@ import java.util.List;
@Data
public class AsDeviceQuery extends AsDevice{
private List<String> macList;
}

View File

@ -37,7 +37,7 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice>
* @param asDevice 设备列表
* @return 设备列表集合
*/
public List<AsDevice> selectAsDeviceList(AsDeviceQuery asDevice);
public List<AsDevice> selectAsDeviceList(AsDevice asDevice);
/**
* 新增设备列表

View File

@ -127,7 +127,7 @@ public interface IAsDeviceService
/**
* 获取已录入设备列表
*/
List<AsDevice> getExistMac(List<String> mac);
List<AsDevice> getExistMac(AsDevice asDevice);
/**
* sn和mac号绑定

View File

@ -38,10 +38,7 @@ import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -660,10 +657,20 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
* 获取已录入设备列表
*/
@Override
public List<AsDevice> getExistMac(List<String> macs) {
AsDeviceQuery asDeviceQuery = new AsDeviceQuery();
asDeviceQuery.setMacList(macs);
return asDeviceMapper.selectAsDeviceList(asDeviceQuery);
public List<AsDevice> getExistMac(AsDevice asDevice) {
// 进行多条件查询
String mac = asDevice.getMac();
if(mac != null && !mac.isEmpty()){
String[] macArray = mac.split(",");
if (macArray.length > 1){
asDevice.setMacList(Arrays.asList(macArray));
// 避免mac模糊查询的干扰
asDevice.setMac(null);
}else {
asDevice.setMac(mac);
}
}
return asDeviceMapper.selectAsDeviceList(asDevice);
}
/**

View File

@ -79,8 +79,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ad.mode_str,
ad.bluetooth_id,
ad.bluetooth_name,
ad.pre
ad.model_name,
ad.pre,
am.picture as modelPicture
from as_device ad
left join as_model am on ad.model_id = am.model_id
</sql>
<select id="selectAsDeviceList" parameterType="AsDevice" resultMap="AsDeviceResult">