mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-18 17:05:55 +08:00
多租户调整
This commit is contained in:
@@ -32,7 +32,7 @@ public class ProductAuthorizeController extends BaseController
|
||||
/**
|
||||
* 查询产品授权码列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:authorize:list')")
|
||||
@PreAuthorize("@ss.hasPermi('iot:product:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ProductAuthorize productAuthorize)
|
||||
{
|
||||
|
||||
@@ -35,10 +35,10 @@ public interface ProductMapper
|
||||
/**
|
||||
* 查询产品简短列表
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param product 产品
|
||||
* @return 产品集合
|
||||
*/
|
||||
public List<IdAndName> selectProductShortList(Long userId);
|
||||
public List<IdAndName> selectProductShortList(Product product);
|
||||
|
||||
/**
|
||||
* 新增产品
|
||||
|
||||
@@ -426,6 +426,13 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
device.setTenantId(sysUser.getUserId());
|
||||
device.setTenantName(sysUser.getUserName());
|
||||
device.setRssi(0);
|
||||
// 随机经纬度
|
||||
if(device.getLongitude()==null || device.getLongitude().equals("")){
|
||||
device.setLongitude(BigDecimal.valueOf(116.23-(Math.random()*15)));
|
||||
}
|
||||
if(device.getLatitude()==null || device.getLatitude().equals("")){
|
||||
device.setLatitude(BigDecimal.valueOf(39.54-(Math.random()*15)));
|
||||
}
|
||||
Product product=productService.selectProductByProductId(device.getProductId());
|
||||
device.setImgUrl(product.getImgUrl());
|
||||
deviceMapper.insertDevice(device);
|
||||
|
||||
@@ -76,8 +76,14 @@ public class ProductServiceImpl implements IProductService
|
||||
@Override
|
||||
public List<IdAndName> selectProductShortList()
|
||||
{
|
||||
Product product =new Product();
|
||||
SysUser user = getLoginUser().getUser();
|
||||
return productMapper.selectProductShortList(user.getUserId());
|
||||
List<SysRole> roles=user.getRoles();
|
||||
// 租户
|
||||
if(roles.stream().anyMatch(a->a.getRoleKey().equals("tenant"))){
|
||||
product.setTenantId(user.getUserId());
|
||||
}
|
||||
return productMapper.selectProductShortList(product);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user