优化仿真分析项库ID绑定
This commit is contained in:
@@ -14,13 +14,13 @@ public interface SimulationPoolMapper {
|
||||
|
||||
|
||||
@Insert("INSERT INTO simulation_pool(poolName,comment,currentVersion,parentVersion,creator,tenantId) VALUES(#{brief.poolName},#{brief.comment},#{brief.currentVersion},#{brief.parentVersion},#{brief.creator},#{brief.tenantId})")
|
||||
@Options(useGeneratedKeys=true,keyProperty="id")
|
||||
int addTaskPoolBreif(@Param("brief") TaskPoolBrief brief);
|
||||
|
||||
@Delete("DELETE FROM simulation_pool WHERE poolName=#{poolName}")
|
||||
int deleteTaskPoolBrief(@Param("poolName")String poolName);
|
||||
|
||||
@Insert("INSERT INTO simulation_pool_versions(poolName,poolVersion,parentVersion,versionContents,poolId,creator) VALUES (#{version.poolName},#{version.poolVersion},#{version.parentVersion},#{version.versionContents},#{version.poolId},#{version.creator})")
|
||||
@Options(useGeneratedKeys=true,keyProperty="id")
|
||||
int addTaskPoolVersion(@Param("version") TaskPoolVersion version);
|
||||
|
||||
@Update("UPDATE simulation_pool_versions SET versionContents=#{versionContents} WHERE poolName=#{poolName} AND poolVersion=#{version}")
|
||||
|
||||
@@ -740,6 +740,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
poolBrief.tenantId = ThreadLocalContext.getTenantId();
|
||||
poolBrief.currentVersion = "V1.0"; //新建时初始版本号
|
||||
String poolName = poolBrief.poolName;
|
||||
int poolId = 0;
|
||||
if(poolName == null)
|
||||
{
|
||||
response = SdmResponse.failed("仿真分析项库名称不能为空");
|
||||
@@ -759,12 +760,13 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
}
|
||||
else
|
||||
{
|
||||
poolId = poolBrief.id;
|
||||
response = realAddSimulationPoolItems(poolTree,"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int poolId = 0;
|
||||
|
||||
|
||||
if(response.getCode() == ResultCode.SUCCESS.getCode())
|
||||
{
|
||||
@@ -775,12 +777,13 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
TaskPoolVersion poolVersion = new TaskPoolVersion();
|
||||
poolVersion.poolName = poolName;
|
||||
poolVersion.poolVersion = poolBrief.currentVersion;
|
||||
poolVersion.poolId = poolId;
|
||||
poolVersion.versionContents = JSONObject.toJSONString(createPoolTree);
|
||||
if(mapper.queryTaskPoolVersion(poolName,poolVersion.poolVersion).size() > 0)
|
||||
{
|
||||
response = SdmResponse.failed("分析项库版本号已存在");
|
||||
}
|
||||
else if((poolId = mapper.addTaskPoolVersion(poolVersion)) <= 0)
|
||||
else if(mapper.addTaskPoolVersion(poolVersion) <= 0)
|
||||
{
|
||||
response = SdmResponse.failed("插入分析项库版本信息失败");
|
||||
}
|
||||
@@ -1385,16 +1388,16 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
poolVersion.poolVersion = generateVersion(currPoolBrief.currentVersion,updateBean.versionType);
|
||||
poolVersion.poolName = currPoolBrief.poolName;
|
||||
poolVersion.parentVersion = currPoolBrief.currentVersion;
|
||||
poolVersion.poolId = currPoolBrief.id;
|
||||
SdmResponse updateResponse = updateCurrentTaskPoolTree(updateBean);
|
||||
if(updateResponse.getCode() == ResultCode.SUCCESS.getCode())
|
||||
{
|
||||
SdmResponse treeRespond = getCurrentPoolTree(currPoolBrief.poolName);
|
||||
if (treeRespond.getData() != null)
|
||||
{
|
||||
mapper.deleteTaskPoolBrief(currPoolBrief.poolName);
|
||||
currPoolBrief.parentVersion = currPoolBrief.currentVersion;
|
||||
currPoolBrief.currentVersion = poolVersion.poolVersion;
|
||||
mapper.updateTaskPoolBrief(currPoolBrief);
|
||||
poolVersion.poolId = mapper.addTaskPoolBreif(currPoolBrief);
|
||||
TaskPoolTree poolTree = (TaskPoolTree) treeRespond.getData();
|
||||
poolVersion.versionContents = JSONObject.toJSONString(poolTree);
|
||||
mapper.addTaskPoolVersion(poolVersion);
|
||||
|
||||
Reference in New Issue
Block a user