|
...
|
...
|
@@ -14,6 +14,7 @@ import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
...
|
...
|
@@ -42,6 +43,8 @@ public class IotProductController extends BaseController |
|
|
|
{
|
|
|
|
@Autowired
|
|
|
|
private IIotProductService IotProductService;
|
|
|
|
@Autowired
|
|
|
|
private PublicService publicService;
|
|
|
|
/**
|
|
|
|
* 查询产品列表
|
|
|
|
*/
|
|
...
|
...
|
@@ -87,10 +90,13 @@ public class IotProductController extends BaseController |
|
|
|
@PreAuthorize("@ss.hasPermi('iot:IotProduct:add')")
|
|
|
|
@Log(title = "产品", businessType = BusinessType.INSERT)
|
|
|
|
@PostMapping
|
|
|
|
@Transactional
|
|
|
|
public AjaxResult add(@RequestBody IotProduct iotProduct)
|
|
|
|
{
|
|
|
|
iotProduct.setSys_user_id(SecurityUtils.getUserId());
|
|
|
|
return toAjax(IotProductService.insertIotProduct(iotProduct));
|
|
|
|
int i = IotProductService.insertIotProduct(iotProduct);
|
|
|
|
i+=publicService.updateBySql(" INSERT INTO `iot_product_authorize`(`username`,`action`,`permission`,`topic`)VALUES('"+iotProduct.getMqtt_username()+"','all','allow','/"+iotProduct.getRole_id()+"/"+iotProduct.getMqtt_username()+"/#')");
|
|
|
|
return toAjax(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
...
|
...
|
|