<fix> 解决事务失效问题
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package com.hcframe.base.module.data.module;
|
package com.hcframe.base.module.data.module;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.hcframe.base.common.WebPageInfo;
|
import com.hcframe.base.common.WebPageInfo;
|
||||||
import com.hcframe.base.common.utils.MyPageHelper;
|
import com.hcframe.base.common.utils.MyPageHelper;
|
||||||
import com.hcframe.base.common.utils.StringUtils;
|
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.DataSourceUtil;
|
||||||
import com.hcframe.base.module.datasource.utils.DataUnit;
|
import com.hcframe.base.module.datasource.utils.DataUnit;
|
||||||
import com.hcframe.base.module.tableconfig.entity.OsSysTable;
|
import com.hcframe.base.module.tableconfig.entity.OsSysTable;
|
||||||
import com.github.pagehelper.PageInfo;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -34,7 +33,6 @@ public class BaseMapperImpl implements BaseMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
|
||||||
public <E> int save(DataMap<E> dataMap) {
|
public <E> int save(DataMap<E> dataMap) {
|
||||||
String key;
|
String key;
|
||||||
DatasourceConfig datasourceConfig = new DatasourceConfig();
|
DatasourceConfig datasourceConfig = new DatasourceConfig();
|
||||||
@@ -79,7 +77,6 @@ public class BaseMapperImpl implements BaseMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
|
||||||
public int save(String tableName, String pkName, Map<String, Object> data) {
|
public int save(String tableName, String pkName, Map<String, Object> data) {
|
||||||
JudgesNull(tableName, "data can not be null!");
|
JudgesNull(tableName, "data can not be null!");
|
||||||
JudgesNull(data, "tableName 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;
|
Object id;
|
||||||
try {
|
try {
|
||||||
id = tableMapper.getSequence(tableName);
|
id = tableMapper.getSequence(tableName);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ public class TableServiceImpl implements TableService {
|
|||||||
return versionValid(osSysTable, map, version, pk);
|
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)) {
|
if (!StringUtils.isEmpty(version)) {
|
||||||
DataMap dataMap = DataMap.builder().sysOsTable(osSysTable).pkValue(pk).data(map).build();
|
DataMap dataMap = DataMap.builder().sysOsTable(osSysTable).pkValue(pk).data(map).build();
|
||||||
Map<String, Object> data = baseMapper.selectByPk(dataMap);
|
Map<String, Object> data = baseMapper.selectByPk(dataMap);
|
||||||
@@ -96,7 +96,7 @@ public class TableServiceImpl implements TableService {
|
|||||||
return updateByPk(osSysTable, map, pk);
|
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");
|
map.remove("ROW_ID");
|
||||||
// 设置更新项
|
// 设置更新项
|
||||||
DataMap dataMap = DataMap.builder()
|
DataMap dataMap = DataMap.builder()
|
||||||
@@ -264,7 +264,7 @@ public class TableServiceImpl implements TableService {
|
|||||||
return baseMapper.selectByCondition(condition);
|
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();
|
DataMap dataMap = DataMap.builder().sysOsTable(tableName).build();
|
||||||
Condition.ConditionBuilder builder = Condition.creatCriteria(dataMap);
|
Condition.ConditionBuilder builder = Condition.creatCriteria(dataMap);
|
||||||
if (!StringUtils.isEmpty(data)) {
|
if (!StringUtils.isEmpty(data)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user