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