设备型号版本功能完善

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 type="selection" width="55" align="center" />
<el-table-column label="id" align="center" prop="deviceId" /> <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"> <template slot-scope="scope">
<image-preview :src="scope.row.picture" :width="50" :height="50" /> <image-preview :src="scope.row.picture" :width="50" :height="50" />
</template> </template>
</el-table-column> </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 <el-table-column
label="激活时间" label="激活时间"
align="center" align="center"
@ -158,6 +172,7 @@
<span>{{ parseTime(scope.row.activationTime, "{y}-{m}-{d}") }}</span> <span>{{ parseTime(scope.row.activationTime, "{y}-{m}-{d}") }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="在线状态" align="center" prop="onlineStatus"> <el-table-column label="在线状态" align="center" prop="onlineStatus">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag <dict-tag
@ -166,14 +181,9 @@
/> />
</template> </template>
</el-table-column> </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 <el-table-column
label="操作" label="操作"
:width="200" :width="200"
@ -490,6 +500,8 @@ export default {
pageSize: 10, pageSize: 10,
deviceName: null, deviceName: null,
classifyName: null, classifyName: null,
modelName: null,
modelPicture: null,
model: null, model: null,
mac: null, mac: null,
onlineStatus: null, onlineStatus: null,

View File

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

View File

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

View File

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

View File

@ -37,7 +37,7 @@ public interface AsDeviceMapper extends BaseMapper<AsDevice>
* @param asDevice 设备列表 * @param asDevice 设备列表
* @return 设备列表集合 * @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号绑定 * sn和mac号绑定

View File

@ -38,10 +38,7 @@ import javax.annotation.Resource;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -660,10 +657,20 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
* 获取已录入设备列表 * 获取已录入设备列表
*/ */
@Override @Override
public List<AsDevice> getExistMac(List<String> macs) { public List<AsDevice> getExistMac(AsDevice asDevice) {
AsDeviceQuery asDeviceQuery = new AsDeviceQuery(); // 进行多条件查询
asDeviceQuery.setMacList(macs); String mac = asDevice.getMac();
return asDeviceMapper.selectAsDeviceList(asDeviceQuery); 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.mode_str,
ad.bluetooth_id, ad.bluetooth_id,
ad.bluetooth_name, ad.bluetooth_name,
ad.pre ad.model_name,
ad.pre,
am.picture as modelPicture
from as_device ad from as_device ad
left join as_model am on ad.model_id = am.model_id
</sql> </sql>
<select id="selectAsDeviceList" parameterType="AsDevice" resultMap="AsDeviceResult"> <select id="selectAsDeviceList" parameterType="AsDevice" resultMap="AsDeviceResult">