多租户测试调整

This commit is contained in:
kerwincui
2022-06-11 02:32:48 +08:00
parent 8571f899da
commit 33a7ba9645
18 changed files with 146 additions and 45 deletions

View File

@@ -37,7 +37,7 @@ public class AlertController extends BaseController
/** /**
* 查询设备告警列表 * 查询设备告警列表
*/ */
@PreAuthorize("@ss.hasPermi('iot:device:list')") @PreAuthorize("@ss.hasPermi('iot:alert:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(Alert alert) public TableDataInfo list(Alert alert)
{ {
@@ -49,7 +49,7 @@ public class AlertController extends BaseController
/** /**
* 导出设备告警列表 * 导出设备告警列表
*/ */
@PreAuthorize("@ss.hasPermi('iot:device:export')") @PreAuthorize("@ss.hasPermi('iot:alert:export')")
@Log(title = "设备告警", businessType = BusinessType.EXPORT) @Log(title = "设备告警", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, Alert alert) public void export(HttpServletResponse response, Alert alert)
@@ -62,7 +62,7 @@ public class AlertController extends BaseController
/** /**
* 获取设备告警详细信息 * 获取设备告警详细信息
*/ */
@PreAuthorize("@ss.hasPermi('iot:device:query')") @PreAuthorize("@ss.hasPermi('iot:alert:query')")
@GetMapping(value = "/{alertId}") @GetMapping(value = "/{alertId}")
public AjaxResult getInfo(@PathVariable("alertId") Long alertId) public AjaxResult getInfo(@PathVariable("alertId") Long alertId)
{ {
@@ -72,7 +72,7 @@ public class AlertController extends BaseController
/** /**
* 新增设备告警 * 新增设备告警
*/ */
@PreAuthorize("@ss.hasPermi('iot:device:add')") @PreAuthorize("@ss.hasPermi('iot:alert:add')")
@Log(title = "设备告警", businessType = BusinessType.INSERT) @Log(title = "设备告警", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Alert alert) public AjaxResult add(@RequestBody Alert alert)
@@ -83,7 +83,7 @@ public class AlertController extends BaseController
/** /**
* 修改设备告警 * 修改设备告警
*/ */
@PreAuthorize("@ss.hasPermi('iot:device:edit')") @PreAuthorize("@ss.hasPermi('iot:alert:edit')")
@Log(title = "设备告警", businessType = BusinessType.UPDATE) @Log(title = "设备告警", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody Alert alert) public AjaxResult edit(@RequestBody Alert alert)
@@ -94,7 +94,7 @@ public class AlertController extends BaseController
/** /**
* 删除设备告警 * 删除设备告警
*/ */
@PreAuthorize("@ss.hasPermi('iot:device:remove')") @PreAuthorize("@ss.hasPermi('iot:alert:remove')")
@Log(title = "设备告警", businessType = BusinessType.DELETE) @Log(title = "设备告警", businessType = BusinessType.DELETE)
@DeleteMapping("/{alertIds}") @DeleteMapping("/{alertIds}")
public AjaxResult remove(@PathVariable Long[] alertIds) public AjaxResult remove(@PathVariable Long[] alertIds)

View File

@@ -37,7 +37,7 @@ public class AlertLogController extends BaseController
/** /**
* 查询设备告警列表 * 查询设备告警列表
*/ */
@PreAuthorize("@ss.hasPermi('iot:alertLog:list')") @PreAuthorize("@ss.hasPermi('iot:alert:list')")
@GetMapping("/list") @GetMapping("/list")
public TableDataInfo list(AlertLog alertLog) public TableDataInfo list(AlertLog alertLog)
{ {
@@ -49,7 +49,7 @@ public class AlertLogController extends BaseController
/** /**
* 导出设备告警列表 * 导出设备告警列表
*/ */
@PreAuthorize("@ss.hasPermi('iot:alertLog:export')") @PreAuthorize("@ss.hasPermi('iot:alert:export')")
@Log(title = "设备告警", businessType = BusinessType.EXPORT) @Log(title = "设备告警", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
public void export(HttpServletResponse response, AlertLog alertLog) public void export(HttpServletResponse response, AlertLog alertLog)
@@ -62,7 +62,7 @@ public class AlertLogController extends BaseController
/** /**
* 获取设备告警详细信息 * 获取设备告警详细信息
*/ */
@PreAuthorize("@ss.hasPermi('iot:alertLog:query')") @PreAuthorize("@ss.hasPermi('iot:alert:query')")
@GetMapping(value = "/{alertLogId}") @GetMapping(value = "/{alertLogId}")
public AjaxResult getInfo(@PathVariable("alertLogId") Long alertLogId) public AjaxResult getInfo(@PathVariable("alertLogId") Long alertLogId)
{ {
@@ -72,7 +72,7 @@ public class AlertLogController extends BaseController
/** /**
* 新增设备告警 * 新增设备告警
*/ */
@PreAuthorize("@ss.hasPermi('iot:alertLog:add')") @PreAuthorize("@ss.hasPermi('iot:alert:add')")
@Log(title = "设备告警", businessType = BusinessType.INSERT) @Log(title = "设备告警", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody AlertLog alertLog) public AjaxResult add(@RequestBody AlertLog alertLog)
@@ -83,7 +83,7 @@ public class AlertLogController extends BaseController
/** /**
* 修改设备告警 * 修改设备告警
*/ */
@PreAuthorize("@ss.hasPermi('iot:alertLog:edit')") @PreAuthorize("@ss.hasPermi('iot:alert:edit')")
@Log(title = "设备告警", businessType = BusinessType.UPDATE) @Log(title = "设备告警", businessType = BusinessType.UPDATE)
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody AlertLog alertLog) public AjaxResult edit(@RequestBody AlertLog alertLog)
@@ -94,7 +94,7 @@ public class AlertLogController extends BaseController
/** /**
* 删除设备告警 * 删除设备告警
*/ */
@PreAuthorize("@ss.hasPermi('iot:alertLog:remove')") @PreAuthorize("@ss.hasPermi('iot:alert:remove')")
@Log(title = "设备告警", businessType = BusinessType.DELETE) @Log(title = "设备告警", businessType = BusinessType.DELETE)
@DeleteMapping("/{alertLogIds}") @DeleteMapping("/{alertLogIds}")
public AjaxResult remove(@PathVariable Long[] alertLogIds) public AjaxResult remove(@PathVariable Long[] alertLogIds)

View File

@@ -6,6 +6,8 @@ import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException; import com.ruoyi.common.exception.file.FileNameLengthLimitExceededException;
@@ -27,6 +29,7 @@ import com.ruoyi.iot.service.impl.ThingsModelServiceImpl;
import com.ruoyi.iot.util.AESUtils; import com.ruoyi.iot.util.AESUtils;
import com.ruoyi.iot.util.VelocityInitializer; import com.ruoyi.iot.util.VelocityInitializer;
import com.ruoyi.iot.util.VelocityUtils; import com.ruoyi.iot.util.VelocityUtils;
import com.ruoyi.system.service.ISysUserService;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -42,6 +45,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@@ -101,6 +105,17 @@ public class ToolController extends BaseController {
return StringUtils.isEmpty(msg) ? success() : error(msg); return StringUtils.isEmpty(msg) ? success() : error(msg);
} }
/**
* 获取用户列表
*/
@GetMapping("/userList")
public TableDataInfo list(SysUser user)
{
startPage();
List<SysUser> list = toolService.selectUserList(user);
return getDataTable(list);
}
@ApiOperation("mqtt认证") @ApiOperation("mqtt认证")
@PostMapping("/mqtt/auth") @PostMapping("/mqtt/auth")
public ResponseEntity mqttAuth(@RequestParam String clientid, @RequestParam String username, @RequestParam String password) throws Exception { public ResponseEntity mqttAuth(@RequestParam String clientid, @RequestParam String username, @RequestParam String password) throws Exception {

View File

@@ -105,6 +105,25 @@ public class Device extends BaseEntity
/** 分组ID用于分组查询 **/ /** 分组ID用于分组查询 **/
private Long groupId; private Long groupId;
/** 是否设备所有者,用于查询 **/
private Integer isOwner;
public Integer getLocationWay() {
return locationWay;
}
public void setLocationWay(Integer locationWay) {
this.locationWay = locationWay;
}
public Integer getIsOwner() {
return isOwner;
}
public void setIsOwner(Integer isOwner) {
this.isOwner = isOwner;
}
/** 删除标志0代表存在 2代表删除 */ /** 删除标志0代表存在 2代表删除 */
private String delFlag; private String delFlag;
@@ -124,14 +143,6 @@ public class Device extends BaseEntity
this.summary = summary; this.summary = summary;
} }
public Integer getlocationWay() {
return locationWay;
}
public void setlocationWay(Integer locationWay) {
this.locationWay = locationWay;
}
public String getImgUrl() { public String getImgUrl() {
return imgUrl; return imgUrl;
} }

View File

@@ -58,6 +58,25 @@ public class DeviceAllShortOutput
/** 纬度 */ /** 纬度 */
private BigDecimal latitude; private BigDecimal latitude;
/** 是否设备所有者,用于查询 **/
private Integer isOwner;
public Integer getLocationWay() {
return locationWay;
}
public void setLocationWay(Integer locationWay) {
this.locationWay = locationWay;
}
public Integer getIsOwner() {
return isOwner;
}
public void setIsOwner(Integer isOwner) {
this.isOwner = isOwner;
}
public String getNetworkAddress() { public String getNetworkAddress() {
return networkAddress; return networkAddress;
} }
@@ -82,14 +101,6 @@ public class DeviceAllShortOutput
this.latitude = latitude; this.latitude = latitude;
} }
public Integer getlocationWay() {
return locationWay;
}
public void setlocationWay(Integer locationWay) {
this.locationWay = locationWay;
}
public Integer getIsShadow() { public Integer getIsShadow() {
return isShadow; return isShadow;
} }

View File

@@ -93,6 +93,9 @@ public class DeviceShortOutput
/** 图片地址 */ /** 图片地址 */
private String imgUrl; private String imgUrl;
/** 是否设备所有者,用于查询 **/
private Integer isOwner;
private List<StringModelOutput> stringList; private List<StringModelOutput> stringList;
private List<IntegerModelOutput> integerList; private List<IntegerModelOutput> integerList;
private List<DecimalModelOutput> decimalList; private List<DecimalModelOutput> decimalList;
@@ -101,14 +104,22 @@ public class DeviceShortOutput
private List<BoolModelOutput> boolList; private List<BoolModelOutput> boolList;
private List<ReadOnlyModelOutput> readOnlyList; private List<ReadOnlyModelOutput> readOnlyList;
public Integer getlocationWay() { public Integer getLocationWay() {
return locationWay; return locationWay;
} }
public void setlocationWay(Integer locationWay) { public void setLocationWay(Integer locationWay) {
this.locationWay = locationWay; this.locationWay = locationWay;
} }
public Integer getIsOwner() {
return isOwner;
}
public void setIsOwner(Integer isOwner) {
this.isOwner = isOwner;
}
public String getImgUrl() { public String getImgUrl() {
return imgUrl; return imgUrl;
} }

View File

@@ -133,7 +133,7 @@ public class EmqxService {
device.setProductId(productId); device.setProductId(productId);
device.setSerialNumber(deviceNum); device.setSerialNumber(deviceNum);
// 未采用设备定位则清空定位,定位方式(1=ip自动定位2=设备定位3=自定义) // 未采用设备定位则清空定位,定位方式(1=ip自动定位2=设备定位3=自定义)
if(device.getlocationWay()!=2){ if(device.getLocationWay()!=2){
device.setLatitude(null); device.setLatitude(null);
device.setLongitude(null); device.setLongitude(null);
} }

View File

@@ -1,5 +1,6 @@
package com.ruoyi.iot.service; package com.ruoyi.iot.service;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.iot.domain.ProductAuthorize; import com.ruoyi.iot.domain.ProductAuthorize;
import com.ruoyi.iot.model.MqttAuthenticationModel; import com.ruoyi.iot.model.MqttAuthenticationModel;
@@ -8,6 +9,8 @@ import com.ruoyi.iot.model.RegisterUserInput;
import com.ruoyi.iot.util.AESUtils; import com.ruoyi.iot.util.AESUtils;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import java.util.List;
/** /**
* *
* @author kerwincui * @author kerwincui
@@ -20,6 +23,14 @@ public interface IToolService
*/ */
public String register(RegisterUserInput registerBody); public String register(RegisterUserInput registerBody);
/**
* 根据条件分页查询用户列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
public List<SysUser> selectUserList(SysUser user);
/** /**
* 生成随机数字和字母 * 生成随机数字和字母
*/ */

View File

@@ -304,8 +304,16 @@ public class DeviceServiceImpl implements IDeviceService {
*/ */
@Override @Override
public List<Device> selectDeviceListByGroup(Device device) { public List<Device> selectDeviceListByGroup(Device device) {
if(device.getUserId()==null || device.getUserId()==0){ SysUser user = getLoginUser().getUser();
return new ArrayList<>(); List<SysRole> roles=user.getRoles();
for(int i=0;i<roles.size();i++){
if(roles.get(i).getRoleKey().equals("tenant")){
// 租户查看产品下所有设备
device.setTenantId(user.getUserId());
}else if (roles.get(i).getRoleKey().equals("general")){
// 用户查看自己设备
device.setUserId(user.getUserId());
}
} }
return deviceMapper.selectDeviceListByGroup(device); return deviceMapper.selectDeviceListByGroup(device);
} }
@@ -564,7 +572,7 @@ public class DeviceServiceImpl implements IDeviceService {
device.setActiveTime(DateUtils.getNowDate()); device.setActiveTime(DateUtils.getNowDate());
device.setIsShadow(0); device.setIsShadow(0);
device.setRssi(0); device.setRssi(0);
device.setlocationWay(1); // 1-自动定位2-设备定位3-自定义位置 device.setLocationWay(1); // 1-自动定位2-设备定位3-自定义位置
device.setCreateTime(DateUtils.getNowDate()); device.setCreateTime(DateUtils.getNowDate());
device.setThingsModelValue(JSONObject.toJSONString(getThingsModelDefaultValue(device.getProductId()))); device.setThingsModelValue(JSONObject.toJSONString(getThingsModelDefaultValue(device.getProductId())));
// 随机位置 // 随机位置
@@ -713,7 +721,7 @@ public class DeviceServiceImpl implements IDeviceService {
device.setActiveTime(DateUtils.getNowDate()); device.setActiveTime(DateUtils.getNowDate());
} }
// 定位方式(1=ip自动定位2=设备定位3=自定义) // 定位方式(1=ip自动定位2=设备定位3=自定义)
if (device.getlocationWay() == 1) { if (device.getLocationWay() == 1) {
device.setNetworkIp(ipAddress); device.setNetworkIp(ipAddress);
setLocation(ipAddress, device); setLocation(ipAddress, device);
} }

View File

@@ -1,5 +1,6 @@
package com.ruoyi.iot.service.impl; package com.ruoyi.iot.service.impl;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
@@ -32,6 +33,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import com.ruoyi.iot.mqtt.MqttConfig; import com.ruoyi.iot.mqtt.MqttConfig;
import java.util.List;
import java.util.Random; import java.util.Random;
/** /**
@@ -156,6 +158,18 @@ public class ToolServiceImpl implements IToolService
return msg; return msg;
} }
/**
* 根据条件分页查询用户列表
*
* @param user 用户信息
* @return 用户信息集合信息
*/
@Override
public List<SysUser> selectUserList(SysUser user)
{
return userMapper.selectUserList(user);
}
/** /**
* 校验手机号码是否唯一 * 校验手机号码是否唯一
* *

View File

@@ -38,9 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select category_id, category_name select category_id, category_name
from iot_category from iot_category
<where> <where>
<if test="categoryName != null and categoryName != ''"> and category_name = #{categoryName}</if> <if test="tenantId != null and tenantId != ''"> and (tenant_id = #{tenantId} or is_sys = 1)</if>
<if test="tenantName != null and tenantName != ''"> and tenant_name = #{tenantName} or is_sys = 1</if>
<if test="isSys != null "> and is_sys = #{isSys}</if>
</where> </where>
order by order_num order by order_num
</select> </select>

View File

@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="imgUrl" column="img_url" /> <result property="imgUrl" column="img_url" />
<result property="summary" column="summary" /> <result property="summary" column="summary" />
<result property="isOwner" column="is_owner" />
</resultMap> </resultMap>
<resultMap type="com.ruoyi.iot.model.DeviceShortOutput" id="DeviceShortResult"> <resultMap type="com.ruoyi.iot.model.DeviceShortOutput" id="DeviceShortResult">
@@ -50,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="locationWay" column="location_way" /> <result property="locationWay" column="location_way" />
<result property="thingsModelValue" column="things_model_value" /> <result property="thingsModelValue" column="things_model_value" />
<result property="imgUrl" column="img_url" /> <result property="imgUrl" column="img_url" />
<result property="isOwner" column="is_owner" />
</resultMap> </resultMap>
<resultMap type="com.ruoyi.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult"> <resultMap type="com.ruoyi.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
@@ -67,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="networkAddress" column="network_address" /> <result property="networkAddress" column="network_address" />
<result property="longitude" column="longitude" /> <result property="longitude" column="longitude" />
<result property="latitude" column="latitude" /> <result property="latitude" column="latitude" />
<result property="isOwner" column="is_owner" />
</resultMap> </resultMap>
<resultMap type="com.ruoyi.iot.model.ProductAuthenticateModel" id="DeviceAuthenticateResult"> <resultMap type="com.ruoyi.iot.model.ProductAuthenticateModel" id="DeviceAuthenticateResult">
@@ -153,13 +156,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDeviceListByGroup" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult"> <select id="selectDeviceListByGroup" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceResult">
select d.device_id, d.device_name, d.product_name, d.user_name, d.serial_number, d.firmware_version, d.status,d.rssi,d.is_shadow , select d.device_id, d.device_name, d.product_name, d.user_name, d.serial_number, d.firmware_version, d.status,d.rssi,d.is_shadow ,
d.location_way, d.active_time,d.network_address,d.longitude,latitude d.location_way, d.active_time,d.network_address,d.longitude,d.latitude,u.is_owner
from iot_device d from iot_device d
inner join iot_device_user u on u.device_id = d.device_id inner join iot_device_user u on u.device_id = d.device_id
<where> <where>
<if test="userId != null "> and u.user_id = #{userId}</if> <if test="userId != null "> and u.user_id = #{userId}</if>
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
<if test="productId != null "> and d.product_id = #{productId}</if> <if test="productId != null "> and d.product_id = #{productId}</if>
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if> <if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if> <if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
<if test="status != null "> and d.status = #{status}</if> <if test="status != null "> and d.status = #{status}</if>
@@ -172,7 +175,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult"> <select id="selectAllDeviceShortList" parameterType="com.ruoyi.iot.domain.Device" resultMap="DeviceAllShortResult">
select d.device_id, d.device_name, d.product_name, d.user_name, d.serial_number, d.firmware_version, d.status,d.rssi,d.is_shadow , select d.device_id, d.device_name, d.product_name, d.user_name, d.serial_number, d.firmware_version, d.status,d.rssi,d.is_shadow ,
d.location_way, d.active_time,d.network_address,d.longitude,latitude d.location_way, d.active_time,d.network_address,d.longitude,d.latitude,u.is_owner
from iot_device d from iot_device d
inner join iot_device_user u on u.device_id = d.device_id inner join iot_device_user u on u.device_id = d.device_id
<where> <where>
@@ -195,7 +198,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select d.device_id, d.device_name, d.product_id, d.product_name, select d.device_id, d.device_name, d.product_id, d.product_name,
d.user_id, d.user_name, d.tenant_id, d.tenant_name, d.serial_number, d.user_id, d.user_name, d.tenant_id, d.tenant_name, d.serial_number,
d.firmware_version, d.status,d.rssi,d.is_shadow ,d.location_way, d.firmware_version, d.status,d.rssi,d.is_shadow ,d.location_way,
d.things_model_value, d.active_time,d.img_url,u.user_id d.things_model_value, d.active_time,d.img_url,u.is_owner
from iot_device d from iot_device d
inner join iot_device_user u on u.device_id = d.device_id inner join iot_device_user u on u.device_id = d.device_id
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if> <if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>

View File

@@ -18,3 +18,12 @@ export function register(data) {
data: data data: data
}) })
} }
// 查询用户列表
export function listUser(query) {
return request({
url: '/iot/tool/userList',
method: 'get',
params: query
})
}

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1654884749180" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12269" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><defs><style type="text/css">@font-face { font-family: feedback-iconfont; src: url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff2?t=1630033759944") format("woff2"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.woff?t=1630033759944") format("woff"), url("//at.alicdn.com/t/font_1031158_u69w8yhxdu.ttf?t=1630033759944") format("truetype"); }
</style></defs><path d="M569.979 703.801c-29.354 0-49.096 19.741-49.096 49.094 0 29.356 19.741 49.092 49.096 49.092s49.096-19.735 49.097-49.092C619.075 723.542 599.334 703.801 569.979 703.801zM308.003 508.892c-29.353 0-49.099 19.741-49.099 49.098 0 29.349 19.746 49.097 49.099 49.097 29.354 0 49.097-19.748 49.097-49.097C357.1 528.633 337.357 508.892 308.003 508.892zM749.263 180.695 119.553 180.695c-19.667 0-35.55 6.997-47.654 20.988-12.103 13.995-18.151 31.958-18.151 53.896l0 637.652c0 20.424 7.186 38.196 21.559 53.321 14.37 15.134 30.634 22.697 48.785 22.697L758.34 969.249c21.183 0 38.954-7.374 53.329-22.128 14.37-14.748 21.555-30.821 21.555-48.222l0-626.3c0-27.235-6.616-49.358-19.855-66.379C800.135 189.207 778.766 180.695 749.263 180.695zM569.955 859.316c-58.713 0-106.455-43.612-106.455-102.32 0-9.874 1.78-19.24 4.311-28.342l-104.07-77.413c-16.686 10.855-34.451 13.171-55.794 13.171-58.706 0-106.446-47.745-106.446-106.451 0-58.708 47.74-106.449 106.446-106.449 29.063 0 53.316 7.632 72.562 26.584l87.943-53.995c-3.723-10.86-6.2-18.201-6.2-30.311 0-58.706 47.747-106.448 106.454-106.448 58.705 0 106.445 47.742 106.445 106.448 0 58.709-47.741 106.452-106.445 106.452-27.308 0-49.938-6.492-68.811-23.469l-90.259 53.396c2.819 9.525 4.787 19.423 4.787 29.886 0 17.532-0.554 29.723-8.086 44.329l89.915 69.788c19.316-19.613 44.085-27.723 73.727-27.723 58.733 0 106.424 47.711 106.422 106.42C676.4 811.575 628.655 859.316 569.955 859.316zM941.673 82.851c-19.289-21.182-61.434-31.77-93.204-31.77L326.147 51.081c-17.399 0-32.336 6.048-44.818 18.152-12.479 12.102-18.719 26.855-18.719 44.25l0 10.215 519.925 0c46.896 0 69.1 1.773 88.766 19.168 19.668 17.399 21.192 34.811 21.192 77.172l-0.001 608.252 14.575 0c17.399 0 32.338-6.056 44.817-18.158 12.482-12.096 18.721-26.852 18.721-44.244L970.605 170.702C970.605 143.473 960.965 104.032 941.673 82.851zM568.727 442.89c29.355 0 49.097-19.746 49.097-49.1 0-29.351-19.74-49.096-49.097-49.096-29.348 0-49.096 19.745-49.096 49.096C519.631 423.144 539.379 442.89 568.727 442.89z" p-id="12270" fill="#67C23A"></path></svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -368,7 +368,7 @@ export default {
if (this.form.status == 2) { if (this.form.status == 2) {
this.deviceStatus = 1; this.deviceStatus = 1;
} }
this.$modal.alertSuccess("新增成功, 可以烧录sdk到设备了"); this.$modal.alertSuccess("添加设备成功");
this.loadMap(); this.loadMap();
} }
}); });

View File

@@ -33,7 +33,9 @@
<el-row type="flex" :gutter="10" justify="space-between"> <el-row type="flex" :gutter="10" justify="space-between">
<el-col :span="20" style="text-align:left;"> <el-col :span="20" style="text-align:left;">
<el-link type="" :underline="false" @click="handleEditDevice(item)" style="font-weight:bold;font-size:16px;line-height:32px;"> <el-link type="" :underline="false" @click="handleEditDevice(item)" style="font-weight:bold;font-size:16px;line-height:32px;">
<svg-icon icon-class="device" /> {{item.deviceName}} <svg-icon icon-class="device" v-if="item.isOwner==1" />
<svg-icon icon-class="share" v-else />
{{item.deviceName}}
<el-tag size="mini" type="info">Version {{item.firmwareVersion}}</el-tag> <el-tag size="mini" type="info">Version {{item.firmwareVersion}}</el-tag>
</el-link> </el-link>
</el-col> </el-col>

View File

@@ -40,7 +40,7 @@
<script> <script>
import { import {
listUser listUser
} from "@/api/system/user"; } from "@/api/iot/tool";
import { import {
addDeviceUser, addDeviceUser,
addDeviceUsers, addDeviceUsers,

View File

@@ -15,6 +15,12 @@
<el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编号" align="center" prop="serialNumber" /> <el-table-column label="设备编号" align="center" prop="serialNumber" />
<el-table-column label="产品名称" align="center" prop="productName" /> <el-table-column label="产品名称" align="center" prop="productName" />
<el-table-column label="设备类型" align="center">
<template slot-scope="scope">
<el-tag type="success" v-if="scope.row.isOwner==0">分享</el-tag>
<el-tag type="primary" v-else>拥有</el-tag>
</template>
</el-table-column>
<el-table-column label="设备状态" align="center" prop="status"> <el-table-column label="设备状态" align="center" prop="status">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.iot_device_status" :value="scope.row.status" /> <dict-tag :options="dict.type.iot_device_status" :value="scope.row.status" />