mirror of
https://gitee.com/beecue/fastbee.git
synced 2026-02-05 00:25:55 +08:00
fix(多数据源): 多数据源事务处理优化
This commit is contained in:
@@ -52,7 +52,7 @@ import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* 业务 服务层实现
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@@ -73,7 +73,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 查询业务信息
|
||||
*
|
||||
*
|
||||
* @param id 业务ID
|
||||
* @return 业务信息
|
||||
*/
|
||||
@@ -87,7 +87,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 查询业务列表
|
||||
*
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
* @return 业务集合
|
||||
*/
|
||||
@@ -99,7 +99,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
@@ -162,7 +162,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 查询据库列表
|
||||
*
|
||||
*
|
||||
* @param tableNames 表名称组
|
||||
* @return 数据库表集合
|
||||
*/
|
||||
@@ -197,7 +197,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 查询所有表信息
|
||||
*
|
||||
*
|
||||
* @return 表信息集合
|
||||
*/
|
||||
@Override
|
||||
@@ -208,12 +208,12 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 修改业务
|
||||
*
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@DSTransactional
|
||||
public void updateGenTable(GenTable genTable)
|
||||
{
|
||||
String options = JSON.toJSONString(genTable.getParams());
|
||||
@@ -230,12 +230,12 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 删除业务对象
|
||||
*
|
||||
*
|
||||
* @param tableIds 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@DSTransactional
|
||||
public void deleteGenTableByIds(Long[] tableIds)
|
||||
{
|
||||
genTableMapper.deleteGenTableByIds(tableIds);
|
||||
@@ -244,7 +244,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 导入表结构
|
||||
*
|
||||
*
|
||||
* @param tableList 导入表列表
|
||||
*/
|
||||
@Override
|
||||
@@ -303,7 +303,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 预览代码
|
||||
*
|
||||
*
|
||||
* @param tableId 表编号
|
||||
* @return 预览数据列表
|
||||
*/
|
||||
@@ -342,7 +342,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 生成代码(下载方式)
|
||||
*
|
||||
*
|
||||
* @param tableName 表名称
|
||||
* @return 数据
|
||||
*/
|
||||
@@ -358,7 +358,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 生成代码(自定义路径)
|
||||
*
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*/
|
||||
@Override
|
||||
@@ -400,11 +400,11 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 同步数据库
|
||||
*
|
||||
*
|
||||
* @param tableName 表名称
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@DSTransactional
|
||||
public void synchDb(String tableName)
|
||||
{
|
||||
GenTable table = genTableMapper.selectGenTableByName(tableName);
|
||||
@@ -455,7 +455,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 批量生成代码(下载方式)
|
||||
*
|
||||
*
|
||||
* @param tableNames 表数组
|
||||
* @return 数据
|
||||
*/
|
||||
@@ -514,7 +514,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 修改保存参数校验
|
||||
*
|
||||
*
|
||||
* @param genTable 业务信息
|
||||
*/
|
||||
@Override
|
||||
@@ -552,7 +552,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 设置主键列信息
|
||||
*
|
||||
*
|
||||
* @param table 业务表信息
|
||||
*/
|
||||
public void setPkColumn(GenTable table)
|
||||
@@ -588,7 +588,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 设置主子表信息
|
||||
*
|
||||
*
|
||||
* @param table 业务表信息
|
||||
*/
|
||||
public void setSubTable(GenTable table)
|
||||
@@ -602,7 +602,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 设置代码生成其他选项值
|
||||
*
|
||||
*
|
||||
* @param genTable 设置后的生成对象
|
||||
*/
|
||||
public void setTableFromOptions(GenTable genTable)
|
||||
@@ -626,7 +626,7 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
|
||||
/**
|
||||
* 获取代码生成地址
|
||||
*
|
||||
*
|
||||
* @param table 业务表信息
|
||||
* @param template 模板文件路径
|
||||
* @return 生成地址
|
||||
@@ -640,4 +640,4 @@ public class GenTableServiceImpl implements IGenTableService
|
||||
}
|
||||
return genPath + File.separator + VelocityUtils.getFileName(template, table);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,19 +21,19 @@ import ${packageName}.service.I${ClassName}Service;
|
||||
|
||||
/**
|
||||
* ${functionName}Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author ${author}
|
||||
* @date ${datetime}
|
||||
*/
|
||||
@Service
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
{
|
||||
@Autowired
|
||||
private ${ClassName}Mapper ${className}Mapper;
|
||||
|
||||
/**
|
||||
* 查询${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return ${functionName}
|
||||
*/
|
||||
@@ -45,7 +45,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
|
||||
/**
|
||||
* 查询${functionName}列表
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return ${functionName}
|
||||
*/
|
||||
@@ -57,12 +57,12 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
|
||||
/**
|
||||
* 新增${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
@DSTransactional
|
||||
#end
|
||||
@Override
|
||||
public int insert${ClassName}(${ClassName} ${className})
|
||||
@@ -83,12 +83,12 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
|
||||
/**
|
||||
* 修改${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
@DSTransactional
|
||||
#end
|
||||
@Override
|
||||
public int update${ClassName}(${ClassName} ${className})
|
||||
@@ -107,12 +107,12 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
|
||||
/**
|
||||
* 批量删除${functionName}
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField}s 需要删除的${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
@DSTransactional
|
||||
#end
|
||||
@Override
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
@@ -125,12 +125,12 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
|
||||
/**
|
||||
* 删除${functionName}信息
|
||||
*
|
||||
*
|
||||
* @param ${pkColumn.javaField} ${functionName}主键
|
||||
* @return 结果
|
||||
*/
|
||||
#if($table.sub)
|
||||
@Transactional
|
||||
@DSTransactional
|
||||
#end
|
||||
@Override
|
||||
public int delete${ClassName}By${pkColumn.capJavaField}(${pkColumn.javaType} ${pkColumn.javaField})
|
||||
@@ -144,7 +144,7 @@ public class ${ClassName}ServiceImpl implements I${ClassName}Service
|
||||
|
||||
/**
|
||||
* 新增${subTable.functionName}信息
|
||||
*
|
||||
*
|
||||
* @param ${className} ${functionName}对象
|
||||
*/
|
||||
public void insert${subClassName}(${ClassName} ${className})
|
||||
|
||||
Reference in New Issue
Block a user