Commit 9dadf665 by tyfanchz

获取产品指令集功能

1 parent 4f2b2053
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.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.plat.common.utils.StringUtils; import com.glsx.plat.common.utils.StringUtils;
import com.glsx.smart.dao.entity.SmartDeviceOrder;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.exception.BusinessException; import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum; import com.glsx.smart.exception.ResultEnum;
...@@ -69,12 +71,12 @@ public class ProductController { ...@@ -69,12 +71,12 @@ public class ProductController {
* @param id 产品 id * @param id 产品 id
*/ */
@RequestMapping(value = "/getCommandSetById", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getCommandSetById", method = {RequestMethod.GET, RequestMethod.POST})
public void getCommandSetById(Long id) { public List<SmartDeviceOrder> getCommandSetById(String id) {
log.info("$$$$ /product/getCommandSetById param: {}", id); log.info("$$$$ /product/getCommandSetById param: {}", id);
if (id == null) { if (StringUtils.isBlank(id)) {
throw new BusinessException(ResultEnum.PARAM_ERROR); throw new BusinessException(ResultEnum.PARAM_ERROR);
} }
productService.getCommandSetById(id); return productService.getCommandSetById(id);
} }
/** /**
......
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartDeviceOrder;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
/** /**
...@@ -18,7 +20,7 @@ public interface SmartProductService { ...@@ -18,7 +20,7 @@ public interface SmartProductService {
void save(SmartProduct product); void save(SmartProduct product);
void getCommandSetById(Long id); List<SmartDeviceOrder> getCommandSetById(String productId);
boolean checkShopProductId(String shopProductId); boolean checkShopProductId(String shopProductId);
......
...@@ -5,13 +5,16 @@ import java.util.Date; ...@@ -5,13 +5,16 @@ import java.util.Date;
import java.util.List; import java.util.List;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartDeviceOrder;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.dao.mapper.SmartDeviceOrderMapper;
import com.glsx.smart.dao.mapper.SmartProductMapper; import com.glsx.smart.dao.mapper.SmartProductMapper;
import com.glsx.smart.exception.BusinessException; import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum; import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.BaseService; import com.glsx.smart.service.BaseService;
import com.glsx.smart.service.SmartProductService; import com.glsx.smart.service.SmartProductService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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;
...@@ -28,6 +31,9 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -28,6 +31,9 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
@Resource @Resource
private SmartProductMapper productMapper; private SmartProductMapper productMapper;
@Autowired
private SmartDeviceOrderMapper deviceOrderMapper;
/** /**
* 获取产品列表。 * 获取产品列表。
* *
...@@ -86,11 +92,14 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -86,11 +92,14 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
/** /**
* 根据产品 id 获取指令集。 * 根据产品 id 获取指令集。
* *
* @param id 产品 id * @param productId 产品 id
* @return 结果
*/ */
@Override @Override
public void getCommandSetById(Long id) { public List<SmartDeviceOrder> getCommandSetById(String productId) {
SmartDeviceOrder example = new SmartDeviceOrder();
example.setProductId(productId);
return deviceOrderMapper.select(example);
} }
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!