<fix> 解决事务失效问题

This commit is contained in:
lhc
2022-04-27 16:48:09 +08:00
parent c45f8fb7bc
commit f022d3e56a
2 changed files with 5 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
package com.hcframe.base.module.data.module;
import com.github.pagehelper.PageInfo;
import com.hcframe.base.common.WebPageInfo;
import com.hcframe.base.common.utils.MyPageHelper;
import com.hcframe.base.common.utils.StringUtils;
@@ -11,10 +12,8 @@ import com.hcframe.base.module.datasource.entity.DatasourceConfig;
import com.hcframe.base.module.datasource.utils.DataSourceUtil;
import com.hcframe.base.module.datasource.utils.DataUnit;
import com.hcframe.base.module.tableconfig.entity.OsSysTable;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -34,7 +33,6 @@ public class BaseMapperImpl implements BaseMapper {
}
@Override
@Transactional
public <E> int save(DataMap<E> dataMap) {
String key;
DatasourceConfig datasourceConfig = new DatasourceConfig();
@@ -79,7 +77,6 @@ public class BaseMapperImpl implements BaseMapper {
}
@Override
@Transactional
public int save(String tableName, String pkName, Map<String, Object> data) {
JudgesNull(tableName, "data can not be null!");
JudgesNull(data, "tableName can not be null!");
@@ -613,7 +610,7 @@ public class BaseMapperImpl implements BaseMapper {
}
}
private Object getSequence(String tableName, String pkName) {
public Object getSequence(String tableName, String pkName) {
Object id;
try {
id = tableMapper.getSequence(tableName);

View File

@@ -82,7 +82,7 @@ public class TableServiceImpl implements TableService {
return versionValid(osSysTable, map, version, pk);
}
private ResultVO<Map<String,Object>> versionValid(OsSysTable osSysTable, Map<String, Object> map, Integer version, Object pk) {
public ResultVO<Map<String,Object>> versionValid(OsSysTable osSysTable, Map<String, Object> map, Integer version, Object pk) {
if (!StringUtils.isEmpty(version)) {
DataMap dataMap = DataMap.builder().sysOsTable(osSysTable).pkValue(pk).data(map).build();
Map<String, Object> data = baseMapper.selectByPk(dataMap);
@@ -96,7 +96,7 @@ public class TableServiceImpl implements TableService {
return updateByPk(osSysTable, map, pk);
}
private ResultVO<Map<String,Object>> updateByPk(OsSysTable osSysTable, Map<String, Object> map, Object pk) {
public ResultVO<Map<String,Object>> updateByPk(OsSysTable osSysTable, Map<String, Object> map, Object pk) {
map.remove("ROW_ID");
// 设置更新项
DataMap dataMap = DataMap.builder()
@@ -264,7 +264,7 @@ public class TableServiceImpl implements TableService {
return baseMapper.selectByCondition(condition);
}
private Condition.ConditionBuilder getMapList(OsSysTable tableName, String data) {
public Condition.ConditionBuilder getMapList(OsSysTable tableName, String data) {
DataMap dataMap = DataMap.builder().sysOsTable(tableName).build();
Condition.ConditionBuilder builder = Condition.creatCriteria(dataMap);
if (!StringUtils.isEmpty(data)) {