Commit a1df91e7 by tyfanchz

根据平台产品id查询支持的指令集

1 parent 66c844ac
package com.glsx.smart.controller; package com.glsx.smart.controller;
import java.util.List;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -13,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -13,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* <p>Description: 产品列表业务 * <p>Description: 产品列表业务
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -113,6 +112,18 @@ public class ProductController { ...@@ -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 * @param id 产品 id
......
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -27,4 +26,6 @@ public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<Smar ...@@ -27,4 +26,6 @@ public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<Smar
int countByProductName(String productName); int countByProductName(String productName);
List<SmartProduct> getAllProductList(); List<SmartProduct> getAllProductList();
List<String> getSupportedCommands(String platformProductId);
} }
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartDeviceOrder; import com.glsx.smart.dao.entity.SmartDeviceOrder;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -34,5 +33,7 @@ public interface SmartProductService { ...@@ -34,5 +33,7 @@ public interface SmartProductService {
List<SmartDeviceOrder> getCommandSetById(Long id); List<SmartDeviceOrder> getCommandSetById(Long id);
List<String> getSupportedCommands(String platformProductId);
Boolean putOnOff(Long id); Boolean putOnOff(Long id);
} }
package com.glsx.smart.service.impl; 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.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -19,12 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,12 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; 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>Description: 产品列表业务
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -205,6 +204,11 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -205,6 +204,11 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
return deviceOrderMapper.select(example); return deviceOrderMapper.select(example);
} }
@Override
public List<String> getSupportedCommands(String platformProductId) {
return productMapper.getSupportedCommands(platformProductId);
}
/** /**
* 上下架产品。 * 上下架产品。
* *
......
...@@ -104,4 +104,11 @@ ...@@ -104,4 +104,11 @@
left join smart_sys_code ssc on ssc.dict_key = spt.category_key left join smart_sys_code ssc on ssc.dict_key = spt.category_key
where sp.status = 1 where sp.status = 1
</select> </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> </mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!