Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a1df91e7
authored
Apr 26, 2021
by
tyfanchz
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
根据平台产品id查询支持的指令集
1 parent
66c844ac
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
12 deletions
src/main/java/com/glsx/smart/controller/ProductController.java
src/main/java/com/glsx/smart/dao/mapper/SmartProductMapper.java
src/main/java/com/glsx/smart/service/SmartProductService.java
src/main/java/com/glsx/smart/service/impl/SmartProductServiceImpl.java
src/main/resources/mapper/SmartProductMapper.xml
src/main/java/com/glsx/smart/controller/ProductController.java
View file @
a1df91e
package
com
.
glsx
.
smart
.
controller
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -13,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>Description: 产品列表业务
* <p>Project: chejia-smart
...
...
@@ -113,6 +112,18 @@ public class ProductController {
}
/**
* 查询产品支持的指令
*
* @param platformProductId 平台产品 ID
* @return 结果
*/
@RequestMapping
(
value
=
"/getSupportedCommands"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
List
<
String
>
getSupportedCommands
(
String
platformProductId
)
{
log
.
info
(
"$$$$ /product/getSupportedCommands param: {}"
,
platformProductId
);
return
productService
.
getSupportedCommands
(
platformProductId
);
}
/**
* 上下架产品。
*
* @param id 产品 id
...
...
src/main/java/com/glsx/smart/dao/mapper/SmartProductMapper.java
View file @
a1df91e
package
com
.
glsx
.
smart
.
dao
.
mapper
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartProduct
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -27,4 +26,6 @@ public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<Smar
int
countByProductName
(
String
productName
);
List
<
SmartProduct
>
getAllProductList
();
List
<
String
>
getSupportedCommands
(
String
platformProductId
);
}
src/main/java/com/glsx/smart/service/SmartProductService.java
View file @
a1df91e
package
com
.
glsx
.
smart
.
service
;
import
java.util.List
;
import
com.alibaba.fastjson.JSONArray
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.smart.dao.entity.SmartDeviceOrder
;
import
com.glsx.smart.dao.entity.SmartProduct
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -34,5 +33,7 @@ public interface SmartProductService {
List
<
SmartDeviceOrder
>
getCommandSetById
(
Long
id
);
List
<
String
>
getSupportedCommands
(
String
platformProductId
);
Boolean
putOnOff
(
Long
id
);
}
src/main/java/com/glsx/smart/service/impl/SmartProductServiceImpl.java
View file @
a1df91e
package
com
.
glsx
.
smart
.
service
.
impl
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.pagehelper.PageInfo
;
...
...
@@ -19,12 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* <p>Description: 产品列表业务
* <p>Project: chejia-smart
...
...
@@ -205,6 +204,11 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
return
deviceOrderMapper
.
select
(
example
);
}
@Override
public
List
<
String
>
getSupportedCommands
(
String
platformProductId
)
{
return
productMapper
.
getSupportedCommands
(
platformProductId
);
}
/**
* 上下架产品。
*
...
...
src/main/resources/mapper/SmartProductMapper.xml
View file @
a1df91e
...
...
@@ -104,4 +104,11 @@
left join smart_sys_code ssc on ssc.dict_key = spt.category_key
where sp.status = 1
</select>
<select
id=
"getSupportedCommands"
resultType=
"java.lang.String"
>
select distinct ss.order_code
from smart_product p
left join smart_scence_supstatus ss on ss.product_id = p.type_id
where p.platform_product_id = #{platformProductId,jdbcType=VARCHAR}
</select>
</mapper>
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment