bug处理

This commit is contained in:
kerwincui
2022-06-12 02:06:03 +08:00
parent 5f675aa796
commit 9cd08b74d1
6 changed files with 95 additions and 28 deletions

View File

@@ -46,6 +46,54 @@ public class AlertLog extends BaseEntity
@Excel(name = "设备名称") @Excel(name = "设备名称")
private String deviceName; private String deviceName;
/** 用户ID */
@Excel(name = "用户ID")
private Long userId;
/** 用户昵称 */
@Excel(name = "用户昵称")
private String userName;
/** 租户ID */
@Excel(name = "租户ID")
private Long tenantId;
/** 租户名称 */
@Excel(name = "租户名称")
private String tenantName;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public Long getTenantId() {
return tenantId;
}
public void setTenantId(Long tenantId) {
this.tenantId = tenantId;
}
public String getTenantName() {
return tenantName;
}
public void setTenantName(String tenantName) {
this.tenantName = tenantName;
}
public void setAlertLogId(Long alertLogId) public void setAlertLogId(Long alertLogId)
{ {
this.alertLogId = alertLogId; this.alertLogId = alertLogId;

View File

@@ -18,15 +18,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="userId" column="user_id" />
<result property="userName" column="user_name" />
<result property="tenantId" column="tenant_id" />
<result property="tenantName" column="tenant_name" />
</resultMap> </resultMap>
<sql id="selectAlertLogVo"> <sql id="selectAlertLogVo">
select alert_log__id, alert_name, alert_level, status, product_id, product_name, device_id, device_name, create_by, create_time, update_by, update_time, remark from iot_alert_log select alert_log__id, alert_name, alert_level, status, product_id, product_name, device_id, device_name,user_id, user_name, tenant_id, tenant_name, create_by, create_time, update_by, update_time, remark from iot_alert_log
</sql> </sql>
<select id="selectAlertLogList" parameterType="com.ruoyi.iot.domain.AlertLog" resultMap="AlertLogResult"> <select id="selectAlertLogList" parameterType="com.ruoyi.iot.domain.AlertLog" resultMap="AlertLogResult">
<include refid="selectAlertLogVo"/> <include refid="selectAlertLogVo"/>
<where> <where>
<if test="userId != null and userId != 0"> and user_id = #{userId}</if>
<if test="tenantId != null and tenantId != 0"> and tenant_id = #{tenantId}</if>
<if test="alertName != null and alertName != ''"> and alert_name like concat('%', #{alertName}, '%')</if> <if test="alertName != null and alertName != ''"> and alert_name like concat('%', #{alertName}, '%')</if>
<if test="alertLevel != null "> and alert_level = #{alertLevel}</if> <if test="alertLevel != null "> and alert_level = #{alertLevel}</if>
<if test="status != null "> and status = #{status}</if> <if test="status != null "> and status = #{status}</if>
@@ -57,6 +63,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="tenantId != null">tenant_id,</if>
<if test="tenantName != null and tenantName != ''">tenant_name,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="alertName != null and alertName != ''">#{alertName},</if> <if test="alertName != null and alertName != ''">#{alertName},</if>
@@ -71,6 +81,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="tenantId != null">#{tenantId},</if>
<if test="tenantName != null and tenantName != ''">#{tenantName},</if>
</trim> </trim>
</insert> </insert>
@@ -89,6 +103,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="tenantId != null">tenant_id = #{tenantId},</if>
<if test="tenantName != null and tenantName != ''">tenant_name = #{tenantName},</if>
</trim> </trim>
where alert_log__id = #{alertLogId} where alert_log__id = #{alertLogId}
</update> </update>

View File

@@ -239,10 +239,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( (
<!--普通用户查询设备中的产品数量--> <!--普通用户查询设备中的产品数量-->
<if test="userId != null and userId != 0"> <if test="userId != null and userId != 0">
select count(product_id) select count(distinct product_id)
from iot_device from iot_device
where user_id = #{userId} where user_id = #{userId}
group by product_id
</if> </if>
<!--管理员和租户直接查询产品的数量--> <!--管理员和租户直接查询产品的数量-->
<if test="userId == null || userId == 0"> <if test="userId == null || userId == 0">

View File

@@ -26,9 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectDeviceUserVo"/> <include refid="selectDeviceUserVo"/>
<where> <where>
<if test="1==1"> and device_id = #{deviceId}</if> <if test="1==1"> and device_id = #{deviceId}</if>
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if> <if test="userId != null and userId != 0"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
<if test="isOwner != null "> and is_owner = #{isOwner}</if>
</where> </where>
</select> </select>

View File

@@ -33,8 +33,10 @@
<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;">
<el-tooltip class="item" effect="dark" content="分享的设备" placement="top-start">
<svg-icon icon-class="share" style="font-size:20px;" v-if="item.isOwner!=1" />
</el-tooltip>
<svg-icon icon-class="device" v-if="item.isOwner==1" /> <svg-icon icon-class="device" v-if="item.isOwner==1" />
<svg-icon icon-class="share" v-else />
{{item.deviceName}} {{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>
@@ -51,11 +53,13 @@
</el-row> </el-row>
<el-row :gutter="10"> <el-row :gutter="10">
<el-col :span="15"> <el-col :span="15">
<div style="text-align:left;line-height:40px;font-size:14px;"> <div style="text-align:left;line-height:40px;">
<dict-tag :options="dict.type.iot_device_status" :value="item.status" size="small" style="display:inline-block;margin-right:10px;" /> <dict-tag :options="dict.type.iot_device_status" :value="item.status" size="small" style="display:inline-block;" />
<el-tag type="success" size="small" v-if="item.isShadow==1">启用影子</el-tag> <span style="display:inline-block;margin:0 10px;">
<el-tag type="info" size="small" v-else>禁用影子</el-tag> <el-tag type="success" size="small" v-if="item.isShadow==1">影子</el-tag>
<dict-tag :options="dict.type.iot_location_way" :value="item.locationWay" size="small" style="display:inline-block;margin-left:10px;" /> <el-tag type="info" size="small" v-else>影子</el-tag>
</span>
<dict-tag :options="dict.type.iot_location_way" :value="item.locationWay" size="small" style="display:inline-block;" />
</div> </div>
<el-descriptions :column="1" size="mini"> <el-descriptions :column="1" size="mini">
<el-descriptions-item label="编号"> <el-descriptions-item label="编号">
@@ -261,13 +265,13 @@ export default {
let productId = this.$route.query.productId let productId = this.$route.query.productId
if (productId != null) { if (productId != null) {
this.queryParams.productId = Number(productId); this.queryParams.productId = Number(productId);
this.queryParams.groupId=null; this.queryParams.groupId = null;
} }
// 分组筛选 // 分组筛选
let groupId = this.$route.query.groupId let groupId = this.$route.query.groupId
if (groupId != null) { if (groupId != null) {
this.queryParams.groupId = Number(groupId); this.queryParams.groupId = Number(groupId);
this.queryParams.productId=null; this.queryParams.productId = null;
} }
this.getList(); this.getList();
@@ -282,13 +286,13 @@ export default {
let productId = this.$route.query.productId let productId = this.$route.query.productId
if (productId != null) { if (productId != null) {
this.queryParams.productId = Number(productId); this.queryParams.productId = Number(productId);
this.queryParams.groupId=null; this.queryParams.groupId = null;
} }
// 分组筛选 // 分组筛选
let groupId = this.$route.query.groupId let groupId = this.$route.query.groupId
if (groupId != null) { if (groupId != null) {
this.queryParams.groupId = Number(groupId); this.queryParams.groupId = Number(groupId);
this.queryParams.productId=null; this.queryParams.productId = null;
} }
this.getList(); this.getList();
} }
@@ -631,6 +635,6 @@ export default {
<style scoped> <style scoped>
.card-item { .card-item {
border-radius:15px; border-radius: 15px;
} }
</style> </style>

View File

@@ -28,7 +28,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> <!-- <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" /> -->
</div> </div>
</template> </template>
@@ -53,7 +53,7 @@ export default {
data() { data() {
return { return {
// 设备分组 // 设备分组
deviceGroup:{}, deviceGroup: {},
// 遮罩层 // 遮罩层
loading: true, loading: true,
// 选中数组 // 选中数组
@@ -67,8 +67,8 @@ export default {
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 500,
userId:null, userId: null,
deviceName: null, deviceName: null,
productId: null, productId: null,
productName: null, productName: null,
@@ -89,7 +89,7 @@ export default {
handler(newVal, oldVal) { handler(newVal, oldVal) {
this.deviceGroup = newVal; this.deviceGroup = newVal;
// 获取分组下的设备 // 获取分组下的设备
this.queryParams.userId=this.deviceGroup.userId; this.queryParams.userId = this.deviceGroup.userId;
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getDeviceIdsByGroupId(); this.getDeviceIdsByGroupId();
}, },
@@ -104,6 +104,8 @@ export default {
getDeviceIdsByGroupId() { getDeviceIdsByGroupId() {
getDeviceIds(this.deviceGroup.groupId).then(response => { getDeviceIds(this.deviceGroup.groupId).then(response => {
this.ids = response.data; this.ids = response.data;
// Id数组传递到父组件
this.$emit('idsToParentEvent', this.ids)
this.getList(); this.getList();
}); });
}, },
@@ -143,8 +145,6 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.deviceId) this.ids = selection.map(item => item.deviceId)
console.log("选择赋值");
console.log(this.ids);
this.single = selection.length !== 1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
// Id数组传递到父组件 // Id数组传递到父组件