|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.zc.business.service.impl; |
|
|
|
|
|
|
|
import com.ruoyi.common.annotation.DataScope; |
|
|
|
import com.ruoyi.common.annotation.DataSource; |
|
|
|
import com.ruoyi.common.core.domain.model.LoginUser; |
|
|
|
import com.ruoyi.common.enums.DataSourceType; |
|
|
@ -11,6 +12,8 @@ import com.zc.business.mapper.MiddleDatabaseMapper; |
|
|
|
import com.zc.business.service.IMiddleDatabaseService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
@ -21,6 +24,8 @@ import java.util.List; |
|
|
|
* @date 2024-01-03 |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) |
|
|
|
public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { |
|
|
|
|
|
|
|
|
|
|
@ -34,7 +39,7 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { |
|
|
|
* @param mdDeviceData 气象检测器数据 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
// @DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
@Override |
|
|
|
public boolean insertMiddleDatabaseDeviceData(MdDeviceData mdDeviceData) |
|
|
|
{ |
|
|
@ -48,7 +53,7 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { |
|
|
|
* @param listDevice 设备列表 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
// @DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
@Override |
|
|
|
public boolean updateMiddleDatabaseDeviceByList(List<DcDevice> listDevice) |
|
|
|
{ |
|
|
@ -65,7 +70,7 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { |
|
|
|
* @param device 设备 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
// @DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
@Override |
|
|
|
public boolean updateMiddleDatabaseDevice(DcDevice device) |
|
|
|
{ |
|
|
@ -78,13 +83,12 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { |
|
|
|
* @param mdEvent 事件 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
@Override |
|
|
|
public boolean insertMiddleDatabaseEvent(MdEvent mdEvent){ |
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
|
/* LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
|
if (loginUser != null) { |
|
|
|
mdEvent.setCreatorUserId(loginUser.getUserId()); |
|
|
|
} |
|
|
|
}*/ |
|
|
|
return middleDatabaseMapper.insertMiddleDatabaseEvent(mdEvent); |
|
|
|
} |
|
|
|
|
|
|
@ -94,7 +98,7 @@ public class MiddleDatabaseServiceImpl implements IMiddleDatabaseService { |
|
|
|
* @param mdEvent 事件 |
|
|
|
* @return 结果 |
|
|
|
*/ |
|
|
|
@DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
// @DataSource(value = DataSourceType.SLAVE)//切换数据源
|
|
|
|
@Override |
|
|
|
public boolean updateMiddleDatabaseEvent(MdEvent mdEvent){ |
|
|
|
LoginUser loginUser = SecurityUtils.getLoginUser(); |
|
|
|