Browse Source

onenet参数

master
lijunjie 2 years ago
parent
commit
3fd735f202
  1. 44
      ruoyi-admin/src/main/java/com/ruoyi/web/domain/po/OnenetConfig.java
  2. 18
      ruoyi-admin/src/main/java/com/ruoyi/web/persist/mapper/OnenetConfigMapper.java
  3. 24
      ruoyi-admin/src/main/resources/mapper/device/OnenetConfigMapper.xml
  4. 44
      ruoyi-ui/src/views/device/config/index.vue
  5. 4
      ruoyi-ui/src/views/device/equips/index.vue
  6. 6
      ruoyi-ui/src/views/device/receive/index.vue

44
ruoyi-admin/src/main/java/com/ruoyi/web/domain/po/OnenetConfig.java

@ -7,9 +7,9 @@ import com.ruoyi.common.core.domain.BaseEntity;
/**
* onenet参数对象 onenet_config
*
*
* @author lijunjie
* @date 2023-01-06
* @date 2023-02-02
*/
public class OnenetConfig extends BaseEntity
{
@ -26,33 +26,59 @@ public class OnenetConfig extends BaseEntity
@Excel(name = "值")
private String configValue;
public void setId(Integer id)
/** 是否可以修改 1可以 2不可以 */
@Excel(name = "是否可以修改 1可以 2不可以")
private Integer ableUpdate;
/** 是否可以删除 1可以 2不可以 */
@Excel(name = "是否可以删除 1可以 2不可以")
private Integer ableDelete;
public void setId(Integer id)
{
this.id = id;
}
public Integer getId()
public Integer getId()
{
return id;
}
public void setConfigKey(String configKey)
public void setConfigKey(String configKey)
{
this.configKey = configKey;
}
public String getConfigKey()
public String getConfigKey()
{
return configKey;
}
public void setConfigValue(String configValue)
public void setConfigValue(String configValue)
{
this.configValue = configValue;
}
public String getConfigValue()
public String getConfigValue()
{
return configValue;
}
public void setAbleUpdate(Integer ableUpdate)
{
this.ableUpdate = ableUpdate;
}
public Integer getAbleUpdate()
{
return ableUpdate;
}
public void setAbleDelete(Integer ableDelete)
{
this.ableDelete = ableDelete;
}
public Integer getAbleDelete()
{
return ableDelete;
}
@Override
public String toString() {
@ -60,6 +86,8 @@ public class OnenetConfig extends BaseEntity
.append("id", getId())
.append("configKey", getConfigKey())
.append("configValue", getConfigValue())
.append("ableUpdate", getAbleUpdate())
.append("ableDelete", getAbleDelete())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())

18
ruoyi-admin/src/main/java/com/ruoyi/web/persist/mapper/OnenetConfigMapper.java

@ -5,15 +5,15 @@ import com.ruoyi.web.domain.po.OnenetConfig;
/**
* onenet参数Mapper接口
*
*
* @author lijunjie
* @date 2023-01-06
* @date 2023-02-02
*/
public interface OnenetConfigMapper
public interface OnenetConfigMapper
{
/**
* 查询onenet参数
*
*
* @param id onenet参数主键
* @return onenet参数
*/
@ -21,7 +21,7 @@ public interface OnenetConfigMapper
/**
* 查询onenet参数列表
*
*
* @param onenetConfig onenet参数
* @return onenet参数集合
*/
@ -29,7 +29,7 @@ public interface OnenetConfigMapper
/**
* 新增onenet参数
*
*
* @param onenetConfig onenet参数
* @return 结果
*/
@ -37,7 +37,7 @@ public interface OnenetConfigMapper
/**
* 修改onenet参数
*
*
* @param onenetConfig onenet参数
* @return 结果
*/
@ -45,7 +45,7 @@ public interface OnenetConfigMapper
/**
* 删除onenet参数
*
*
* @param id onenet参数主键
* @return 结果
*/
@ -53,7 +53,7 @@ public interface OnenetConfigMapper
/**
* 批量删除onenet参数
*
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/

24
ruoyi-admin/src/main/resources/mapper/device/OnenetConfigMapper.xml

@ -3,11 +3,13 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.web.persist.mapper.OnenetConfigMapper">
<resultMap type="OnenetConfig" id="OnenetConfigResult">
<result property="id" column="id" />
<result property="configKey" column="config_key" />
<result property="configValue" column="config_value" />
<result property="ableUpdate" column="able_update" />
<result property="ableDelete" column="able_delete" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
@ -15,27 +17,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectOnenetConfigVo">
select id, config_key, config_value, create_by, create_time, update_by, update_time from onenet_config
select id, config_key, config_value, able_update, able_delete, create_by, create_time, update_by, update_time from onenet_config
</sql>
<select id="selectOnenetConfigList" parameterType="OnenetConfig" resultMap="OnenetConfigResult">
<include refid="selectOnenetConfigVo"/>
<where>
<where>
<if test="configKey != null and configKey != ''"> and config_key = #{configKey}</if>
<if test="configValue != null and configValue != ''"> and config_value = #{configValue}</if>
<if test="ableUpdate != null "> and able_update = #{ableUpdate}</if>
<if test="ableDelete != null "> and able_delete = #{ableDelete}</if>
</where>
</select>
<select id="selectOnenetConfigById" parameterType="Integer" resultMap="OnenetConfigResult">
<include refid="selectOnenetConfigVo"/>
where id = #{id}
</select>
<insert id="insertOnenetConfig" parameterType="OnenetConfig" useGeneratedKeys="true" keyProperty="id">
insert into onenet_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="configKey != null and configKey != ''">config_key,</if>
<if test="configValue != null and configValue != ''">config_value,</if>
<if test="ableUpdate != null">able_update,</if>
<if test="ableDelete != null">able_delete,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
@ -44,6 +50,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="configKey != null and configKey != ''">#{configKey},</if>
<if test="configValue != null and configValue != ''">#{configValue},</if>
<if test="ableUpdate != null">#{ableUpdate},</if>
<if test="ableDelete != null">#{ableDelete},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
@ -56,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="configKey != null and configKey != ''">config_key = #{configKey},</if>
<if test="configValue != null and configValue != ''">config_value = #{configValue},</if>
<if test="ableUpdate != null">able_update = #{ableUpdate},</if>
<if test="ableDelete != null">able_delete = #{ableDelete},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
@ -69,9 +79,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteOnenetConfigByIds" parameterType="String">
delete from onenet_config where id in
delete from onenet_config where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
</mapper>

44
ruoyi-ui/src/views/device/config/index.vue

@ -1,10 +1,10 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="" prop="configKey">
<el-form-item label="键名" prop="configKey">
<el-input
v-model="queryParams.configKey"
placeholder="请输入"
placeholder="请输入键名"
clearable
@keyup.enter.native="handleQuery"
/>
@ -34,28 +34,6 @@
v-hasPermi="['device:config:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['device:config:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['device:config:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
@ -71,12 +49,13 @@
<el-table v-loading="loading" :data="configList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="" align="center" prop="id" />
<el-table-column label="" align="center" prop="configKey" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="键名" align="center" prop="configKey" />
<el-table-column label="值" align="center" prop="configValue" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-if="scope.row.ableUpdate == 1"
size="mini"
type="text"
icon="el-icon-edit"
@ -84,6 +63,7 @@
v-hasPermi="['device:config:edit']"
>修改</el-button>
<el-button
v-if="scope.row.ableDelete == 1"
size="mini"
type="text"
icon="el-icon-delete"
@ -93,7 +73,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
@ -105,8 +85,8 @@
<!-- 添加或修改onenet参数对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="" prop="configKey">
<el-input v-model="form.configKey" placeholder="请输入" />
<el-form-item label="键名" prop="configKey">
<el-input v-model="form.configKey" :disabled="config_key_disabled" placeholder="请输入键名" />
</el-form-item>
<el-form-item label="值" prop="configValue">
<el-input v-model="form.configValue" placeholder="请输入值" />
@ -137,6 +117,8 @@ export default {
multiple: true,
//
showSearch: true,
//
config_key_disabled: false,
//
total: 0,
// onenet
@ -157,7 +139,7 @@ export default {
//
rules: {
configKey: [
{ required: true, message: "不能为空", trigger: "blur" }
{ required: true, message: "键名不能为空", trigger: "blur" }
],
configValue: [
{ required: true, message: "值不能为空", trigger: "blur" }
@ -216,6 +198,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.config_key_disabled = false;
this.title = "添加onenet参数";
},
/** 修改按钮操作 */
@ -225,6 +208,7 @@ export default {
getConfig(id).then(response => {
this.form = response.data;
this.open = true;
this.config_key_disabled = true;
this.title = "修改onenet参数";
});
},

4
ruoyi-ui/src/views/device/equips/index.vue

@ -230,8 +230,8 @@
<el-dialog title="onenet推送记录" :visible.sync="receiveDataOpen" width="80%">
<el-table v-loading="loading" :data="receiveDataList">
<el-table-column label="主键" align="center" prop="id" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column width="50" label="主键" align="center" prop="id" />
<el-table-column width="200" label="创建时间" align="center" prop="createTime" />
<el-table-column label="推送数据" align="center" prop="value" />
</el-table>
<pagination

6
ruoyi-ui/src/views/device/receive/index.vue

@ -79,9 +79,9 @@
<el-table v-loading="loading" :data="receiveList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="" align="center" prop="id" />
<el-table-column label="编号" align="center" prop="id" width="50"/>
<el-table-column label="imei" align="center" prop="imei" />
<el-table-column label="推送数据" align="center" prop="value" />
<el-table-column label="推送数据" align="center" prop="value" min-width="500"/>
<el-table-column label="消息摘要
" align="center" prop="msgSignature" />
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
@ -113,7 +113,7 @@
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"

Loading…
Cancel
Save