设备列表重复问题处理

This commit is contained in:
kerwincui
2022-06-10 21:29:46 +08:00
parent 34b0cd53ea
commit 8571f899da
5 changed files with 12 additions and 7 deletions

View File

@@ -74,7 +74,7 @@ public class DeviceUserController extends BaseController
/**
* 新增设备用户
*/
@PreAuthorize("@ss.hasPermi('iot:device:add')")
@PreAuthorize("@ss.hasPermi('iot:device:share')")
@Log(title = "设备用户", businessType = BusinessType.INSERT)
@PostMapping
@ApiOperation("添加设备用户")
@@ -86,10 +86,10 @@ public class DeviceUserController extends BaseController
/**
* 新增多个设备用户
*/
@PreAuthorize("@ss.hasPermi('iot:device:add')")
@PreAuthorize("@ss.hasPermi('iot:device:share')")
@Log(title = "设备用户", businessType = BusinessType.INSERT)
@PostMapping("/addDeviceUsers")
@ApiOperation("添加设备用户")
@ApiOperation("批量添加设备用户")
public AjaxResult addDeviceUsers(@RequestBody List<DeviceUser> deviceUsers)
{
return toAjax(deviceUserService.insertDeviceUserList(deviceUsers));

View File

@@ -61,7 +61,7 @@ public class DeviceUserServiceImpl implements IDeviceUserService
public int insertDeviceUser(DeviceUser deviceUser)
{
List<DeviceUser> deviceUsers = selectDeviceUserList(deviceUser);
if (!deviceUsers.isEmpty()) throw new RuntimeException("该用户已添加, 禁止重复添加");
if (!deviceUsers.isEmpty()) { throw new RuntimeException("该用户已添加, 禁止重复添加");}
deviceUser.setCreateTime(DateUtils.getNowDate());
deviceUser.setIsOwner(0);
SysUser sysUser = getLoginUser().getUser();

View File

@@ -166,6 +166,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="networkAddress != null and networkAddress != ''"> and d.network_address like concat('%', #{networkAddress}, '%')</if>
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
group by d.device_id,d.user_id
order by d.create_time desc
</select>
@@ -179,6 +180,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tenantId != null "> and d.tenant_id = #{tenantId}</if>
<if test="productId != null "> and d.product_id = #{productId}</if>
</where>
group by d.device_id,d.user_id
</select>
<select id="selectDeviceThingsModelValueBySerialNumber" parameterType="String" resultMap="DeviceThingsValueResult">
@@ -210,6 +212,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="status != null "> and d.status = #{status}</if>
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
group by d.device_id,d.user_id
order by d.create_time desc
</select>

View File

@@ -461,7 +461,7 @@ export default {
this.chartLoading = true;
// Mqtt发布实时监测
let model = {};
model.name = "";
model.name = "关闭实时监测";
model.value = 0;
this.mqttPublish(4, this.monitorDevice, model);
},

View File

@@ -19,7 +19,9 @@
<input type="radio" :checked="scope.row.isSelect" name="user" />
</template>
</el-table-column>
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" :show-overflow-tooltip="true" />
<el-table-column label="用户编号" align="center" key="userId" prop="userId" width="120" />
<el-table-column label="用户名称" align="center" key="userName" prop="userName" />
<el-table-column label="用户昵称" align="center" key="nickName" prop="nickName" />
<el-table-column label="手机号码" align="center" key="phonenumber" prop="phonenumber" width="120" />
<el-table-column label="创建时间" align="center" prop="createTime" width="160">
<template slot-scope="scope">
@@ -29,7 +31,7 @@
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="addDeviceUser">添加</el-button>
<el-button type="primary" @click="addDeviceUser">分享</el-button>
<el-button @click="closeSelectUser"> </el-button>
</div>
</el-dialog>