Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mqttsnet
thinglinks
提交
f3721445
thinglinks
项目概览
mqttsnet
/
thinglinks
通知
1
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
thinglinks
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f3721445
编写于
2月 09, 2022
作者:
xiaonannet
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增产品管理列表,新增功能
上级
2018be4b
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
939 addition
and
190 deletion
+939
-190
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/Product.java
...et/thinglinks/link/api/domain/product/entity/Product.java
+2
-25
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductCommands.java
...links/link/api/domain/product/entity/ProductCommands.java
+2
-24
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductCommandsRequests.java
...nk/api/domain/product/entity/ProductCommandsRequests.java
+2
-24
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductCommandsResponse.java
...nk/api/domain/product/entity/ProductCommandsResponse.java
+2
-24
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductProperties.java
...nks/link/api/domain/product/entity/ProductProperties.java
+2
-24
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductServices.java
...links/link/api/domain/product/entity/ProductServices.java
+2
-24
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductTemplate.java
...links/link/api/domain/product/entity/ProductTemplate.java
+2
-25
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/controller/product/ProductController.java
...thinglinks/link/controller/product/ProductController.java
+80
-5
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/mapper/product/ProductMapper.java
...qttsnet/thinglinks/link/mapper/product/ProductMapper.java
+49
-0
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/product/ProductService.java
...tsnet/thinglinks/link/service/product/ProductService.java
+45
-3
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/product/impl/ProductServiceImpl.java
...nglinks/link/service/product/impl/ProductServiceImpl.java
+118
-9
thinglinks-modules/thinglinks-modules-link/src/main/resources/mapper/link/product/ProductMapper.xml
.../src/main/resources/mapper/link/product/ProductMapper.xml
+96
-0
thinglinks-ui/src/api/link/product.js
thinglinks-ui/src/api/link/product.js
+44
-0
thinglinks-ui/src/views/link/product/index.vue
thinglinks-ui/src/views/link/product/index.vue
+490
-0
thinglinks-ui/src/views/login.vue
thinglinks-ui/src/views/login.vue
+3
-3
未找到文件。
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/Product.java
浏览文件 @
f3721445
package
com.mqttsnet.thinglinks.link.api.domain.product.entity
;
import
com.mqttsnet.thinglinks.common.core.web.domain.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
...
...
@@ -24,7 +25,7 @@ import lombok.Data;
*/
@ApiModel
(
value
=
"产品模型"
)
@Data
public
class
Product
implements
Serializable
{
public
class
Product
extends
BaseEntity
implements
Serializable
{
/**
* id
*/
...
...
@@ -114,29 +115,5 @@ public class Product implements Serializable {
@ApiModelProperty
(
value
=
"产品描述"
)
private
String
remark
;
/**
* 创建者
*/
@ApiModelProperty
(
value
=
"创建者"
)
private
String
createBy
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@ApiModelProperty
(
value
=
"更新者"
)
private
String
updateBy
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
)
private
LocalDateTime
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductCommands.java
浏览文件 @
f3721445
package
com.mqttsnet.thinglinks.link.api.domain.product.entity
;
import
com.mqttsnet.thinglinks.common.core.web.domain.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
...
...
@@ -24,7 +25,7 @@ import lombok.Data;
*/
@ApiModel
(
value
=
"产品模型设备服务命令表"
)
@Data
public
class
ProductCommands
implements
Serializable
{
public
class
ProductCommands
extends
BaseEntity
implements
Serializable
{
/**
* 命令id
*/
...
...
@@ -51,29 +52,6 @@ public class ProductCommands implements Serializable {
@ApiModelProperty
(
value
=
"命令描述。"
)
private
String
description
;
/**
* 创建者
*/
@ApiModelProperty
(
value
=
"创建者"
)
private
String
createBy
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@ApiModelProperty
(
value
=
"更新者"
)
private
String
updateBy
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
)
private
LocalDateTime
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductCommandsRequests.java
浏览文件 @
f3721445
package
com.mqttsnet.thinglinks.link.api.domain.product.entity
;
import
com.mqttsnet.thinglinks.common.core.web.domain.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
...
...
@@ -24,7 +25,7 @@ import lombok.Data;
*/
@ApiModel
(
value
=
"产品模型设备下发服务命令属性表"
)
@Data
public
class
ProductCommandsRequests
implements
Serializable
{
public
class
ProductCommandsRequests
extends
BaseEntity
implements
Serializable
{
/**
* id
*/
...
...
@@ -123,29 +124,6 @@ public class ProductCommandsRequests implements Serializable {
@ApiModelProperty
(
value
=
"指示单位。,取值根据参数确定,如:,•温度单位:“C”或“K”,•百分比单位:“%”,•压强单位:“Pa”或“kPa”,"
)
private
String
unit
;
/**
* 创建者
*/
@ApiModelProperty
(
value
=
"创建者"
)
private
String
createBy
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@ApiModelProperty
(
value
=
"更新者"
)
private
String
updateBy
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
)
private
LocalDateTime
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductCommandsResponse.java
浏览文件 @
f3721445
package
com.mqttsnet.thinglinks.link.api.domain.product.entity
;
import
com.mqttsnet.thinglinks.common.core.web.domain.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
...
...
@@ -24,7 +25,7 @@ import lombok.Data;
*/
@ApiModel
(
value
=
"产品模型设备响应服务命令属性表"
)
@Data
public
class
ProductCommandsResponse
implements
Serializable
{
public
class
ProductCommandsResponse
extends
BaseEntity
implements
Serializable
{
/**
* id
*/
...
...
@@ -123,29 +124,6 @@ public class ProductCommandsResponse implements Serializable {
@ApiModelProperty
(
value
=
"指示单位。,取值根据参数确定,如:,•温度单位:“C”或“K”,•百分比单位:“%”,•压强单位:“Pa”或“kPa”,"
)
private
String
unit
;
/**
* 创建者
*/
@ApiModelProperty
(
value
=
"创建者"
)
private
String
createBy
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@ApiModelProperty
(
value
=
"更新者"
)
private
String
updateBy
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
)
private
LocalDateTime
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductProperties.java
浏览文件 @
f3721445
package
com.mqttsnet.thinglinks.link.api.domain.product.entity
;
import
com.mqttsnet.thinglinks.common.core.web.domain.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
...
...
@@ -24,7 +25,7 @@ import lombok.Data;
*/
@ApiModel
(
value
=
"产品模型服务属性表"
)
@Data
public
class
ProductProperties
implements
Serializable
{
public
class
ProductProperties
extends
BaseEntity
implements
Serializable
{
/**
* 属性id
*/
...
...
@@ -122,29 +123,6 @@ public class ProductProperties implements Serializable {
@ApiModelProperty
(
value
=
"指示单位。支持长度不超过50。,取值根据参数确定,如:,•温度单位:“C”或“K”,•百分比单位:“%”,•压强单位:“Pa”或“kPa”,"
)
private
String
unit
;
/**
* 创建者
*/
@ApiModelProperty
(
value
=
"创建者"
)
private
String
createBy
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@ApiModelProperty
(
value
=
"更新者"
)
private
String
updateBy
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
)
private
LocalDateTime
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductServices.java
浏览文件 @
f3721445
package
com.mqttsnet.thinglinks.link.api.domain.product.entity
;
import
com.mqttsnet.thinglinks.common.core.web.domain.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
...
...
@@ -24,7 +25,7 @@ import lombok.Data;
*/
@ApiModel
(
value
=
"产品模型服务表"
)
@Data
public
class
ProductServices
implements
Serializable
{
public
class
ProductServices
extends
BaseEntity
implements
Serializable
{
/**
* 服务id
*/
...
...
@@ -63,29 +64,6 @@ public class ProductServices implements Serializable {
@ApiModelProperty
(
value
=
"服务的描述信息:文本描述,不影响实际功能,可配置为空字符串''。,"
)
private
String
description
;
/**
* 创建者
*/
@ApiModelProperty
(
value
=
"创建者"
)
private
String
createBy
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@ApiModelProperty
(
value
=
"更新者"
)
private
String
updateBy
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
)
private
LocalDateTime
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
thinglinks-api/thinglinks-api-link/src/main/java/com/mqttsnet/thinglinks/link/api/domain/product/entity/ProductTemplate.java
浏览文件 @
f3721445
package
com.mqttsnet.thinglinks.link.api.domain.product.entity
;
import
com.mqttsnet.thinglinks.common.core.web.domain.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
...
...
@@ -24,7 +25,7 @@ import lombok.Data;
*/
@ApiModel
(
value
=
"产品模板"
)
@Data
public
class
ProductTemplate
implements
Serializable
{
public
class
ProductTemplate
extends
BaseEntity
implements
Serializable
{
/**
* id
*/
...
...
@@ -55,29 +56,5 @@ public class ProductTemplate implements Serializable {
@ApiModelProperty
(
value
=
"产品模型模板描述"
)
private
String
remark
;
/**
* 创建者
*/
@ApiModelProperty
(
value
=
"创建者"
)
private
String
createBy
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
)
private
LocalDateTime
createTime
;
/**
* 更新者
*/
@ApiModelProperty
(
value
=
"更新者"
)
private
String
updateBy
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
)
private
LocalDateTime
updateTime
;
private
static
final
long
serialVersionUID
=
1L
;
}
\ No newline at end of file
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/controller/product/ProductController.java
浏览文件 @
f3721445
...
...
@@ -4,10 +4,14 @@ import com.alibaba.fastjson.JSONException;
import
com.alibaba.fastjson.JSONObject
;
import
com.mqttsnet.thinglinks.common.core.constant.Constants
;
import
com.mqttsnet.thinglinks.common.core.constant.HttpStatus
;
import
com.mqttsnet.thinglinks.common.core.utils.poi.ExcelUtil
;
import
com.mqttsnet.thinglinks.common.core.web.controller.BaseController
;
import
com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult
;
import
com.mqttsnet.thinglinks.common.core.web.page.TableDataInfo
;
import
com.mqttsnet.thinglinks.common.log.annotation.Log
;
import
com.mqttsnet.thinglinks.common.log.enums.BusinessType
;
import
com.mqttsnet.thinglinks.common.security.annotation.PreAuthorize
;
import
com.mqttsnet.thinglinks.link.api.domain.device.entity.Device
;
import
com.mqttsnet.thinglinks.link.api.domain.product.entity.Product
;
import
com.mqttsnet.thinglinks.link.service.product.ProductService
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -15,16 +19,19 @@ import org.springframework.web.bind.annotation.*;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
/**
* (product)表控制层
* (product)
产品
表控制层
*
* @author thinglinks
*/
@RestController
@RequestMapping
(
"/product"
)
@Slf4j
public
class
ProductController
{
public
class
ProductController
extends
BaseController
{
/**
* 服务对象
*/
...
...
@@ -42,9 +49,9 @@ public class ProductController {
return
productService
.
selectByPrimaryKey
(
id
);
}
/**
/* */
/**
* 新增产品模型
*/
*/
/*
@PreAuthorize(hasPermi = "link:product:add")
@Log(title = "产品模型", businessType = BusinessType.INSERT)
@PostMapping
...
...
@@ -59,7 +66,7 @@ public class ProductController {
log.error("新增产品模型异常:", e);
return new AjaxResult(HttpStatus.ERROR, "快捷生成失败", tokenObj);
}
}
}
*/
/**
* @param file
...
...
@@ -80,4 +87,72 @@ public class ProductController {
}*/
return
ajaxResult
;
}
/**
* 查询产品管理列表
*/
@PreAuthorize
(
hasPermi
=
"link:product:list"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
Product
product
)
{
startPage
();
List
<
Product
>
list
=
productService
.
selectProductList
(
product
);
return
getDataTable
(
list
);
}
/**
* 导出产品管理列表
*/
@PreAuthorize
(
hasPermi
=
"link:product:export"
)
@Log
(
title
=
"产品管理"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
Product
product
)
throws
IOException
{
List
<
Product
>
list
=
productService
.
selectProductList
(
product
);
ExcelUtil
<
Product
>
util
=
new
ExcelUtil
<
Product
>(
Product
.
class
);
util
.
exportExcel
(
response
,
list
,
"产品管理数据"
);
}
/**
* 获取产品管理详细信息
*/
@PreAuthorize
(
hasPermi
=
"link:product:query"
)
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
productService
.
selectProductById
(
id
));
}
/**
* 新增产品管理
*/
@PreAuthorize
(
hasPermi
=
"link:product:add"
)
@Log
(
title
=
"产品管理"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
Product
product
)
{
return
toAjax
(
productService
.
insertProduct
(
product
));
}
/**
* 修改产品管理
*/
@PreAuthorize
(
hasPermi
=
"link:product:edit"
)
@Log
(
title
=
"产品管理"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
Product
product
)
{
return
toAjax
(
productService
.
updateProduct
(
product
));
}
/**
* 删除产品管理
*/
@PreAuthorize
(
hasPermi
=
"link:product:remove"
)
@Log
(
title
=
"产品管理"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
productService
.
deleteProductByIds
(
ids
));
}
}
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/mapper/product/ProductMapper.java
浏览文件 @
f3721445
...
...
@@ -71,4 +71,53 @@ public interface ProductMapper {
int
updateBatchSelective
(
List
<
Product
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
Product
>
list
);
/**
* 查询产品管理
*
* @param id 产品管理主键
* @return 产品管理
*/
public
Product
selectProductById
(
Long
id
);
/**
* 查询产品管理列表
*
* @param product 产品管理
* @return 产品管理集合
*/
public
List
<
Product
>
selectProductList
(
Product
product
);
/**
* 新增产品管理
*
* @param product 产品管理
* @return 结果
*/
public
int
insertProduct
(
Product
product
);
/**
* 修改产品管理
*
* @param product 产品管理
* @return 结果
*/
public
int
updateProduct
(
Product
product
);
/**
* 删除产品管理
*
* @param id 产品管理主键
* @return 结果
*/
public
int
deleteProductById
(
Long
id
);
/**
* 批量删除产品管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteProductByIds
(
Long
[]
ids
);
}
\ No newline at end of file
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/product/ProductService.java
浏览文件 @
f3721445
...
...
@@ -4,6 +4,7 @@ import java.util.List;
import
com.alibaba.fastjson.JSONObject
;
import
com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult
;
import
com.mqttsnet.thinglinks.link.api.domain.device.entity.Device
;
import
com.mqttsnet.thinglinks.link.api.domain.product.entity.Product
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
...
...
@@ -54,12 +55,53 @@ public interface ProductService{
*/
AjaxResult
importProductJson
(
MultipartFile
file
)
throws
Exception
;
/**
* 查询产品管理
*
* @param id 产品管理主键
* @return 产品管理
*/
public
Product
selectProductById
(
Long
id
);
/**
* 查询产品管理列表
*
* @param product 产品管理
* @return 产品管理集合
*/
public
List
<
Product
>
selectProductList
(
Product
product
);
/**
* 新增产品管理
*
* @param product 产品管理
* @return 结果
*/
public
int
insertProduct
(
Product
product
);
/**
* 修改产品管理
*
* @param product 产品管理
* @return 结果
*/
public
int
updateProduct
(
Product
product
);
/**
*
新增产品模型
*
批量删除产品管理
*
* @param
content 产品模型
* @param
ids 需要删除的产品管理主键集合
* @return 结果
*/
AjaxResult
insertProduct
(
JSONObject
content
)
throws
Exception
;
public
int
deleteProductByIds
(
Long
[]
ids
)
;
/**
* 删除产品管理信息
*
* @param id 产品管理主键
* @return 结果
*/
public
int
deleteProductById
(
Long
id
);
}
thinglinks-modules/thinglinks-modules-link/src/main/java/com/mqttsnet/thinglinks/link/service/product/impl/ProductServiceImpl.java
浏览文件 @
f3721445
...
...
@@ -4,8 +4,13 @@ import com.alibaba.fastjson.JSONObject;
import
com.google.common.collect.Lists
;
import
com.jayway.jsonpath.JsonPath
;
import
com.mqttsnet.thinglinks.common.core.text.CharsetKit
;
import
com.mqttsnet.thinglinks.common.core.utils.DateUtils
;
import
com.mqttsnet.thinglinks.common.core.web.domain.AjaxResult
;
import
com.mqttsnet.thinglinks.common.security.service.TokenService
;
import
com.mqttsnet.thinglinks.system.api.domain.SysUser
;
import
com.mqttsnet.thinglinks.system.api.model.LoginUser
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.io.BufferedReader
;
...
...
@@ -27,7 +32,7 @@ import org.springframework.web.multipart.MultipartFile;
/**
* @Description:
java类作用描述
* @Description:
产品模型业务层
* @Author: ShiHuan Sun
* @E-mail: 13733918655@163.com
* @Website: http://thinglinks.mqttsnet.com
...
...
@@ -44,6 +49,8 @@ public class ProductServiceImpl implements ProductService{
@Resource
private
ProductMapper
productMapper
;
@Autowired
private
TokenService
tokenService
;
@Override
public
int
deleteByPrimaryKey
(
Long
id
)
{
...
...
@@ -52,21 +59,37 @@ public class ProductServiceImpl implements ProductService{
@Override
public
int
insert
(
Product
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
productMapper
.
insert
(
record
);
}
@Override
public
int
insertOrUpdate
(
Product
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
productMapper
.
insertOrUpdate
(
record
);
}
@Override
public
int
insertOrUpdateSelective
(
Product
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
productMapper
.
insertOrUpdateSelective
(
record
);
}
@Override
public
int
insertSelective
(
Product
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setCreateBy
(
sysUser
.
getUserName
());
record
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
productMapper
.
insertSelective
(
record
);
}
...
...
@@ -77,11 +100,19 @@ public class ProductServiceImpl implements ProductService{
@Override
public
int
updateByPrimaryKeySelective
(
Product
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setUpdateTime
(
DateUtils
.
getNowDate
());
record
.
setUpdateBy
(
sysUser
.
getUserName
());
return
productMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
int
updateByPrimaryKey
(
Product
record
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
record
.
setUpdateTime
(
DateUtils
.
getNowDate
());
record
.
setUpdateBy
(
sysUser
.
getUserName
());
return
productMapper
.
updateByPrimaryKey
(
record
);
}
...
...
@@ -126,7 +157,7 @@ public class ProductServiceImpl implements ProductService{
while
((
line
=
reader
.
readLine
())
!=
null
)
{
sb
.
append
(
line
);
}
return
i
nsertProduct
(
JSONObject
.
parseObject
(
sb
.
toString
()));
return
i
mportProductJsonData
(
JSONObject
.
parseObject
(
sb
.
toString
()));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
...
...
@@ -167,7 +198,7 @@ public class ProductServiceImpl implements ProductService{
while
((
line
=
br
.
readLine
())
!=
null
)
{
sb
.
append
(
line
);
}
ajaxResult
=
i
nsertProduct
(
JSONObject
.
parseObject
(
sb
.
toString
()));
ajaxResult
=
i
mportProductJsonData
(
JSONObject
.
parseObject
(
sb
.
toString
()));
}
//一定记得关闭流
zipInputStream
.
closeEntry
();
...
...
@@ -181,9 +212,8 @@ public class ProductServiceImpl implements ProductService{
* @param content 产品模型
* @return 结果
*/
@Override
@Transactional
public
AjaxResult
i
nsertProduct
(
JSONObject
content
)
throws
Exception
{
public
AjaxResult
i
mportProductJsonData
(
JSONObject
content
)
throws
Exception
{
//分析json取值
String
manufacturerId
=
content
.
getString
(
"manufacturerId"
);
String
manufacturerName
=
content
.
getString
(
"manufacturerName"
);
...
...
@@ -194,14 +224,14 @@ public class ProductServiceImpl implements ProductService{
String
productSerial
=
content
.
getString
(
"productSerial"
);
String
version
=
content
.
getString
(
"version"
);
//效验数据是否存在
Product
query
=
new
Product
();
/*
Product query = new Product();
query.setUserName(loginUser.getUsername());
query.setModel(model);
query.setManufacturerId(manufacturerId);
List<Product> getList = productMapper.selectListByProduct(query);
if (getList != null && getList.size()>0){
return AjaxResult.error("产品模型已上传");
}
}
*/
//验证properties数据格式(int、decimal、string、bool、dateTime、jsonObject)
List
read1
=
JsonPath
.
read
(
content
.
toJSONString
(),
"$..properties[*].datatype"
);
List
read2
=
JsonPath
.
read
(
content
.
toJSONString
(),
"$..properties[*].description"
);
...
...
@@ -230,7 +260,7 @@ public class ProductServiceImpl implements ProductService{
return
AjaxResult
.
error
(
"Invalid product: Invalid dataType,must be one of [int、decimal、string、bool、dateTime、jsonObject]"
);
}
//添加物模型数据
Product
product
=
new
Product
();
/*
Product product = new Product();
product.setProductName(productName);
product.setManufacturerId(manufacturerId);
product.setManufacturerName(manufacturerName);
...
...
@@ -275,8 +305,87 @@ public class ProductServiceImpl implements ProductService{
propertiesList.add(properties);
}
productServicesMapper.batchProductPropertis(propertiesList);
}
}
*/
return
AjaxResult
.
success
(
"操作成功"
);
}
/**
* 查询产品管理
*
* @param id 产品管理主键
* @return 产品管理
*/
@Override
public
Product
selectProductById
(
Long
id
)
{
return
productMapper
.
selectProductById
(
id
);
}
/**
* 查询产品管理列表
*
* @param product 产品管理
* @return 产品管理
*/
@Override
public
List
<
Product
>
selectProductList
(
Product
product
)
{
return
productMapper
.
selectProductList
(
product
);
}
/**
* 新增产品管理
*
* @param product 产品管理
* @return 结果
*/
@Override
public
int
insertProduct
(
Product
product
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
product
.
setCreateBy
(
sysUser
.
getUserName
());
product
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
productMapper
.
insertProduct
(
product
);
}
/**
* 修改产品管理
*
* @param product 产品管理
* @return 结果
*/
@Override
public
int
updateProduct
(
Product
product
)
{
LoginUser
loginUser
=
tokenService
.
getLoginUser
();
SysUser
sysUser
=
loginUser
.
getSysUser
();
product
.
setUpdateTime
(
DateUtils
.
getNowDate
());
product
.
setUpdateBy
(
sysUser
.
getUserName
());
return
productMapper
.
updateProduct
(
product
);
}
/**
* 批量删除产品管理
*
* @param ids 需要删除的产品管理主键
* @return 结果
*/
@Override
public
int
deleteProductByIds
(
Long
[]
ids
)
{
return
productMapper
.
deleteProductByIds
(
ids
);
}
/**
* 删除产品管理信息
*
* @param id 产品管理主键
* @return 结果
*/
@Override
public
int
deleteProductById
(
Long
id
)
{
return
productMapper
.
deleteProductById
(
id
);
}
}
thinglinks-modules/thinglinks-modules-link/src/main/resources/mapper/link/product/ProductMapper.xml
浏览文件 @
f3721445
...
...
@@ -733,4 +733,100 @@
</if>
</trim>
</insert>
<select
id=
"selectProductList"
parameterType=
"com.mqttsnet.thinglinks.link.api.domain.product.entity.Product"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from product
<where>
<if
test=
"productName != null and productName != ''"
>
and product_name like concat('%', #{productName}, '%')
</if>
<if
test=
"manufacturerId != null and manufacturerId != ''"
>
and manufacturer_id = #{manufacturerId}
</if>
<if
test=
"manufacturerName != null and manufacturerName != ''"
>
and manufacturer_name like concat('%', #{manufacturerName}, '%')
</if>
<if
test=
"model != null and model != ''"
>
and model = #{model}
</if>
</where>
</select>
<select
id=
"selectProductById"
parameterType=
"Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from product
where id = #{id}
</select>
<insert
id=
"insertProduct"
parameterType=
"com.mqttsnet.thinglinks.link.api.domain.product.entity.Product"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into product
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"appId != null and appId != ''"
>
app_id,
</if>
<if
test=
"templateId != null"
>
template_id,
</if>
<if
test=
"productName != null and productName != ''"
>
product_name,
</if>
<if
test=
"productIdentification != null and productIdentification != ''"
>
product_identification,
</if>
<if
test=
"productType != null and productType != ''"
>
product_type,
</if>
<if
test=
"manufacturerId != null and manufacturerId != ''"
>
manufacturer_id,
</if>
<if
test=
"manufacturerName != null and manufacturerName != ''"
>
manufacturer_name,
</if>
<if
test=
"model != null and model != ''"
>
model,
</if>
<if
test=
"dataFormat != null and dataFormat != ''"
>
data_format,
</if>
<if
test=
"deviceType != null and deviceType != ''"
>
device_type,
</if>
<if
test=
"protocolType != null and protocolType != ''"
>
protocol_type,
</if>
<if
test=
"status != null and status != ''"
>
status,
</if>
<if
test=
"remark != null"
>
remark,
</if>
<if
test=
"createBy != null"
>
create_by,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateBy != null"
>
update_by,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"appId != null and appId != ''"
>
#{appId},
</if>
<if
test=
"templateId != null"
>
#{templateId},
</if>
<if
test=
"productName != null and productName != ''"
>
#{productName},
</if>
<if
test=
"productIdentification != null and productIdentification != ''"
>
#{productIdentification},
</if>
<if
test=
"productType != null and productType != ''"
>
#{productType},
</if>
<if
test=
"manufacturerId != null and manufacturerId != ''"
>
#{manufacturerId},
</if>
<if
test=
"manufacturerName != null and manufacturerName != ''"
>
#{manufacturerName},
</if>
<if
test=
"model != null and model != ''"
>
#{model},
</if>
<if
test=
"dataFormat != null and dataFormat != ''"
>
#{dataFormat},
</if>
<if
test=
"deviceType != null and deviceType != ''"
>
#{deviceType},
</if>
<if
test=
"protocolType != null and protocolType != ''"
>
#{protocolType},
</if>
<if
test=
"status != null and status != ''"
>
#{status},
</if>
<if
test=
"remark != null"
>
#{remark},
</if>
<if
test=
"createBy != null"
>
#{createBy},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"updateBy != null"
>
#{updateBy},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
</trim>
</insert>
<update
id=
"updateProduct"
parameterType=
"com.mqttsnet.thinglinks.link.api.domain.product.entity.Product"
>
update product
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"appId != null and appId != ''"
>
app_id = #{appId},
</if>
<if
test=
"templateId != null"
>
template_id = #{templateId},
</if>
<if
test=
"productName != null and productName != ''"
>
product_name = #{productName},
</if>
<if
test=
"productIdentification != null and productIdentification != ''"
>
product_identification = #{productIdentification},
</if>
<if
test=
"productType != null and productType != ''"
>
product_type = #{productType},
</if>
<if
test=
"manufacturerId != null and manufacturerId != ''"
>
manufacturer_id = #{manufacturerId},
</if>
<if
test=
"manufacturerName != null and manufacturerName != ''"
>
manufacturer_name = #{manufacturerName},
</if>
<if
test=
"model != null and model != ''"
>
model = #{model},
</if>
<if
test=
"dataFormat != null and dataFormat != ''"
>
data_format = #{dataFormat},
</if>
<if
test=
"deviceType != null and deviceType != ''"
>
device_type = #{deviceType},
</if>
<if
test=
"protocolType != null and protocolType != ''"
>
protocol_type = #{protocolType},
</if>
<if
test=
"status != null and status != ''"
>
status = #{status},
</if>
<if
test=
"remark != null"
>
remark = #{remark},
</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>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteProductById"
parameterType=
"Long"
>
delete from product where id = #{id}
</delete>
<delete
id=
"deleteProductByIds"
parameterType=
"String"
>
delete from product where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
thinglinks-ui/src/api/link/product.js
0 → 100644
浏览文件 @
f3721445
import
request
from
'
@/utils/request
'
// 查询产品管理列表
export
function
listProduct
(
query
)
{
return
request
({
url
:
'
/link/product/list
'
,
method
:
'
get
'
,
params
:
query
})
}
// 查询产品管理详细
export
function
getProduct
(
id
)
{
return
request
({
url
:
'
/link/product/
'
+
id
,
method
:
'
get
'
})
}
// 新增产品管理
export
function
addProduct
(
data
)
{
return
request
({
url
:
'
/link/product
'
,
method
:
'
post
'
,
data
:
data
})
}
// 修改产品管理
export
function
updateProduct
(
data
)
{
return
request
({
url
:
'
/link/product
'
,
method
:
'
put
'
,
data
:
data
})
}
// 删除产品管理
export
function
delProduct
(
id
)
{
return
request
({
url
:
'
/link/product/
'
+
id
,
method
:
'
delete
'
})
}
thinglinks-ui/src/views/link/product/index.vue
0 → 100644
浏览文件 @
f3721445
<
template
>
<div
class=
"app-container"
>
<el-form
:model=
"queryParams"
ref=
"queryForm"
:inline=
"true"
v-show=
"showSearch"
label-width=
"68px"
>
<el-form-item
label=
"产品名称"
prop=
"productName"
>
<el-input
v-model=
"queryParams.productName"
placeholder=
"请输入产品名称"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"厂商ID"
prop=
"manufacturerId"
>
<el-input
v-model=
"queryParams.manufacturerId"
placeholder=
"请输入厂商ID"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"厂商名称"
prop=
"manufacturerName"
>
<el-input
v-model=
"queryParams.manufacturerName"
placeholder=
"请输入厂商名称"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item
label=
"产品型号"
prop=
"model"
>
<el-input
v-model=
"queryParams.model"
placeholder=
"请输入产品型号"
clearable
size=
"small"
@
keyup.enter.native=
"handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button
type=
"primary"
icon=
"el-icon-search"
size=
"mini"
@
click=
"handleQuery"
>
搜索
</el-button>
<el-button
icon=
"el-icon-refresh"
size=
"mini"
@
click=
"resetQuery"
>
重置
</el-button>
</el-form-item>
</el-form>
<el-row
:gutter=
"10"
class=
"mb8"
>
<el-col
:span=
"1.5"
>
<el-button
type=
"primary"
plain
icon=
"el-icon-plus"
size=
"mini"
@
click=
"handleAdd"
v-hasPermi=
"['link:product: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=
"['link:product: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=
"['link:product:remove']"
>
删除
</el-button>
</el-col>
<el-col
:span=
"1.5"
>
<el-button
type=
"warning"
plain
icon=
"el-icon-download"
size=
"mini"
@
click=
"handleExport"
v-hasPermi=
"['link:product:export']"
>
导出
</el-button>
</el-col>
<right-toolbar
:showSearch.sync=
"showSearch"
@
queryTable=
"getList"
></right-toolbar>
</el-row>
<el-table
v-loading=
"loading"
:data=
"productList"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
width=
"55"
align=
"center"
/>
<el-table-column
label=
"id"
align=
"center"
prop=
"id"
/>
<el-table-column
label=
"应用ID"
align=
"center"
prop=
"appId"
>
<template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.link_application_type"
:value=
"scope.row.appId"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"产品名称"
align=
"center"
prop=
"productName"
/>
<el-table-column
label=
"厂商ID"
align=
"center"
prop=
"manufacturerId"
/>
<el-table-column
label=
"厂商名称"
align=
"center"
prop=
"manufacturerName"
/>
<el-table-column
label=
"产品型号"
align=
"center"
prop=
"model"
/>
<el-table-column
label=
"设备类型"
align=
"center"
prop=
"deviceType"
>
<
template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.link_product_device_type"
:value=
"scope.row.deviceType"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"协议类型"
align=
"center"
prop=
"protocolType"
>
<
template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.link_device_protocol_type"
:value=
"scope.row.protocolType"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"状态"
align=
"center"
prop=
"status"
>
<
template
slot-scope=
"scope"
>
<dict-tag
:options=
"dict.type.sys_normal_disable"
:value=
"scope.row.status"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"产品描述"
align=
"center"
prop=
"remark"
/>
<el-table-column
label=
"操作"
align=
"center"
class-name=
"small-padding fixed-width"
>
<
template
slot-scope=
"scope"
>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-edit"
@
click=
"handleUpdate(scope.row)"
v-hasPermi=
"['link:product:edit']"
>
修改
</el-button>
<el-button
size=
"mini"
type=
"text"
icon=
"el-icon-delete"
@
click=
"handleDelete(scope.row)"
v-hasPermi=
"['link:product:remove']"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page.sync=
"queryParams.pageNum"
:limit.sync=
"queryParams.pageSize"
@
pagination=
"getList"
/>
<!-- 添加或修改产品管理对话框 -->
<el-dialog
:title=
"title"
:visible.sync=
"open"
width=
"40%"
append-to-body
>
<el-form
ref=
"form"
:model=
"form"
:rules=
"rules"
label-width=
"120px"
>
<el-row>
<el-col
:span=
"11"
>
<el-form-item
label=
"应用ID"
prop=
"appId"
>
<el-select
v-model=
"form.appId"
placeholder=
"请选择应用ID"
>
<el-option
v-for=
"dict in dict.type.link_application_type"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"11"
>
<el-form-item
label=
"产品模型模板"
prop=
"templateId"
>
<el-input
v-model=
"form.templateId"
placeholder=
"请输入产品模型模板"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"11"
>
<el-form-item
label=
"产品名称"
prop=
"productName"
>
<el-input
v-model=
"form.productName"
placeholder=
"请输入产品名称:自定义,支持中文、英文大小写、数字、下划线和中划线"
/>
</el-form-item>
</el-col>
<el-col
:span=
"11"
>
<el-form-item
label=
"产品标识"
prop=
"productIdentification"
>
<el-input
v-model=
"form.productIdentification"
placeholder=
"请输入产品标识"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"11"
>
<el-form-item
label=
"产品类型"
prop=
"productType"
>
<el-select
v-model=
"form.productType"
placeholder=
"请选择支持以下两种产品类型•0:普通产品,需直连设备。•1:网关产品,可挂载子设备。"
>
<el-option
v-for=
"dict in dict.type.link_product_type"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"11"
>
<el-form-item
label=
"厂商ID"
prop=
"manufacturerId"
>
<el-input
v-model=
"form.manufacturerId"
placeholder=
"请输入厂商ID:支持英文大小写,数字,下划线和中划线"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"11"
>
<el-form-item
label=
"厂商名称"
prop=
"manufacturerName"
>
<el-input
v-model=
"form.manufacturerName"
placeholder=
"请输入厂商名称 :支持中文、英文大小写、数字、下划线和中划线"
/>
</el-form-item>
</el-col>
<el-col
:span=
"11"
>
<el-form-item
label=
"产品型号"
prop=
"model"
>
<el-input
v-model=
"form.model"
placeholder=
"请输入产品型号,建议包含字母或数字来保证可扩展性。支持英文大小写、数字、下划线和中划线"
/>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"11"
>
<el-form-item
label=
"数据格式"
prop=
"dataFormat"
>
<el-input
v-model=
"form.dataFormat"
placeholder=
"请输入数据格式,默认为JSON无需修改。"
/>
</el-form-item>
</el-col>
<el-col
:span=
"11"
>
<el-form-item
label=
"设备类型"
prop=
"deviceType"
>
<el-select
v-model=
"form.deviceType"
placeholder=
"请选择设备类型:支持英文大小写、数字、下划线和中划线"
>
<el-option
v-for=
"dict in dict.type.link_product_device_type"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"11"
>
<el-form-item
label=
"协议类型"
prop=
"protocolType"
>
<el-select
v-model=
"form.protocolType"
placeholder=
"请选择设备接入平台的协议类型,默认为MQTT无需修改。"
>
<el-option
v-for=
"dict in dict.type.link_device_protocol_type"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col
:span=
"11"
>
<el-form-item
label=
"状态"
prop=
"status"
>
<el-select
v-model=
"form.status"
placeholder=
"请选择状态(字典值:启用 停用)"
>
<el-option
v-for=
"dict in dict.type.sys_normal_disable"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"22"
>
<el-form-item
label=
"产品描述"
prop=
"remark"
>
<el-input
v-model=
"form.remark"
type=
"textarea"
placeholder=
"请输入产品描述"
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
<div
slot=
"footer"
class=
"dialog-footer"
>
<el-button
type=
"primary"
@
click=
"submitForm"
>
确 定
</el-button>
<el-button
@
click=
"cancel"
>
取 消
</el-button>
</div>
</el-dialog>
</div>
</template>
<
script
>
import
{
listProduct
,
getProduct
,
delProduct
,
addProduct
,
updateProduct
}
from
"
@/api/link/product
"
;
export
default
{
name
:
"
Product
"
,
dicts
:
[
'
link_application_type
'
,
'
link_product_device_type
'
,
'
link_product_type
'
,
'
link_device_protocol_type
'
,
'
sys_normal_disable
'
],
data
()
{
return
{
// 遮罩层
loading
:
true
,
// 选中数组
ids
:
[],
// 非单个禁用
single
:
true
,
// 非多个禁用
multiple
:
true
,
// 显示搜索条件
showSearch
:
true
,
// 总条数
total
:
0
,
// 产品管理表格数据
productList
:
[],
// 弹出层标题
title
:
""
,
// 是否显示弹出层
open
:
false
,
// 查询参数
queryParams
:
{
pageNum
:
1
,
pageSize
:
10
,
productName
:
null
,
manufacturerId
:
null
,
manufacturerName
:
null
,
model
:
null
,
},
// 表单参数
form
:
{},
// 表单校验
rules
:
{
appId
:
[
{
required
:
true
,
message
:
"
应用ID不能为空
"
,
trigger
:
"
change
"
}
],
productName
:
[
{
required
:
true
,
message
:
"
产品名称:自定义,支持中文、英文大小写、数字、下划线和中划线不能为空
"
,
trigger
:
"
blur
"
}
],
productIdentification
:
[
{
required
:
true
,
message
:
"
产品标识不能为空
"
,
trigger
:
"
blur
"
}
],
productType
:
[
{
required
:
true
,
message
:
"
支持以下两种产品类型•0:普通产品,需直连设备。•1:网关产品,可挂载子设备。不能为空
"
,
trigger
:
"
change
"
}
],
manufacturerId
:
[
{
required
:
true
,
message
:
"
厂商ID:支持英文大小写,数字,下划线和中划线不能为空
"
,
trigger
:
"
blur
"
}
],
manufacturerName
:
[
{
required
:
true
,
message
:
"
厂商名称 :支持中文、英文大小写、数字、下划线和中划线不能为空
"
,
trigger
:
"
blur
"
}
],
model
:
[
{
required
:
true
,
message
:
"
产品型号,建议包含字母或数字来保证可扩展性。支持英文大小写、数字、下划线和中划线不能为空
"
,
trigger
:
"
blur
"
}
],
dataFormat
:
[
{
required
:
true
,
message
:
"
数据格式,默认为JSON无需修改。不能为空
"
,
trigger
:
"
blur
"
}
],
deviceType
:
[
{
required
:
true
,
message
:
"
设备类型:支持英文大小写、数字、下划线和中划线不能为空
"
,
trigger
:
"
change
"
}
],
protocolType
:
[
{
required
:
true
,
message
:
"
设备接入平台的协议类型,默认为MQTT无需修改。不能为空
"
,
trigger
:
"
change
"
}
],
status
:
[
{
required
:
true
,
message
:
"
状态(字典值:启用 停用)不能为空
"
,
trigger
:
"
change
"
}
],
}
};
},
created
()
{
this
.
getList
();
}
,
methods
:
{
/** 查询产品管理列表 */
getList
()
{
this
.
loading
=
true
;
listProduct
(
this
.
queryParams
).
then
(
response
=>
{
this
.
productList
=
response
.
rows
;
this
.
total
=
response
.
total
;
this
.
loading
=
false
;
});
}
,
// 取消按钮
cancel
()
{
this
.
open
=
false
;
this
.
reset
();
}
,
// 表单重置
reset
()
{
this
.
form
=
{
id
:
null
,
appId
:
null
,
templateId
:
null
,
productName
:
null
,
productIdentification
:
null
,
productType
:
null
,
manufacturerId
:
null
,
manufacturerName
:
null
,
model
:
null
,
dataFormat
:
null
,
deviceType
:
null
,
protocolType
:
null
,
status
:
null
,
remark
:
null
,
createBy
:
null
,
createTime
:
null
,
updateBy
:
null
,
updateTime
:
null
};
this
.
resetForm
(
"
form
"
);
}
,
/** 搜索按钮操作 */
handleQuery
()
{
this
.
queryParams
.
pageNum
=
1
;
this
.
getList
();
}
,
/** 重置按钮操作 */
resetQuery
()
{
this
.
resetForm
(
"
queryForm
"
);
this
.
handleQuery
();
}
,
// 多选框选中数据
handleSelectionChange
(
selection
)
{
this
.
ids
=
selection
.
map
(
item
=>
item
.
id
)
this
.
single
=
selection
.
length
!==
1
this
.
multiple
=
!
selection
.
length
}
,
/** 新增按钮操作 */
handleAdd
()
{
this
.
reset
();
this
.
open
=
true
;
this
.
title
=
"
添加产品管理
"
;
}
,
/** 修改按钮操作 */
handleUpdate
(
row
)
{
this
.
reset
();
const
id
=
row
.
id
||
this
.
ids
getProduct
(
id
).
then
(
response
=>
{
this
.
form
=
response
.
data
;
this
.
open
=
true
;
this
.
title
=
"
修改产品管理
"
;
});
}
,
/** 提交按钮 */
submitForm
()
{
this
.
$refs
[
"
form
"
].
validate
(
valid
=>
{
if
(
valid
)
{
if
(
this
.
form
.
id
!=
null
)
{
updateProduct
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"
修改成功
"
);
this
.
open
=
false
;
this
.
getList
();
});
}
else
{
addProduct
(
this
.
form
).
then
(
response
=>
{
this
.
$modal
.
msgSuccess
(
"
新增成功
"
);
this
.
open
=
false
;
this
.
getList
();
});
}
}
});
}
,
/** 删除按钮操作 */
handleDelete
(
row
)
{
const
ids
=
row
.
id
||
this
.
ids
;
this
.
$modal
.
confirm
(
'
是否确认删除产品管理编号为"
'
+
ids
+
'
"的数据项?
'
).
then
(
function
()
{
return
delProduct
(
ids
);
}).
then
(()
=>
{
this
.
getList
();
this
.
$modal
.
msgSuccess
(
"
删除成功
"
);
}).
catch
(()
=>
{
});
}
,
/** 导出按钮操作 */
handleExport
()
{
this
.
download
(
'
link/product/export
'
,
{
...
this
.
queryParams
},
`link_product.xlsx`
)
}
}
};
</
script
>
thinglinks-ui/src/views/login.vue
浏览文件 @
f3721445
<
template
>
<div
class=
"login"
>
<el-form
ref=
"loginForm"
:model=
"loginForm"
:rules=
"loginRules"
class=
"login-form"
>
<h3
class=
"title"
>
小南网络科技
</h3>
<h3
class=
"title"
>
ThingLinks物联网一体化平台
</h3>
<el-form-item
prop=
"username"
>
<el-input
v-model=
"loginForm.username"
type=
"text"
auto-complete=
"off"
placeholder=
"账号"
>
<svg-icon
slot=
"prefix"
icon-class=
"user"
class=
"el-input__icon input-icon"
/>
...
...
@@ -67,8 +67,8 @@ export default {
codeUrl
:
""
,
cookiePassword
:
""
,
loginForm
:
{
username
:
"
thinglinks
"
,
password
:
"
123456
"
,
username
:
""
,
password
:
""
,
rememberMe
:
false
,
code
:
""
,
uuid
:
""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录