| @@ -62,7 +62,7 @@ public interface ExperimentDao { | |||
| * @return 影响行数 | |||
| * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 | |||
| */ | |||
| int insertOrUpdateBatch(@Param("entities") List<Experiment> entities); | |||
| int insertOrUpdateBatch(List<Experiment> entities); | |||
| /** | |||
| * 修改数据 | |||
| @@ -62,7 +62,7 @@ public interface ExperimentInsDao { | |||
| * @return 影响行数 | |||
| * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 | |||
| */ | |||
| int insertOrUpdateBatch(@Param("entities") List<ExperimentIns> entities); | |||
| int insertOrUpdateBatch(List<ExperimentIns> entities); | |||
| /** | |||
| * 修改数据 | |||
| @@ -47,9 +47,7 @@ public class ExperimentInstanceStatusTask { | |||
| } | |||
| if (!StringUtils.equals(oldStatus,experimentIns.getStatus())){ | |||
| experimentIns.setUpdateTime(new Date()); | |||
| if (!experimentIds.contains(experimentIns.getExperimentId())){ | |||
| experimentIds.add(experimentIns.getExperimentId()); | |||
| } | |||
| experimentIds.add(experimentIns.getExperimentId()); | |||
| updateList.add(experimentIns); | |||
| } | |||
| experimentInsDao.update(experimentIns); | |||
| @@ -76,13 +74,15 @@ public class ExperimentInstanceStatusTask { | |||
| String subStatus = statusList.toString().substring(1, statusList.toString().length() - 1); | |||
| Experiment experiment = experimentDao.queryById(experimentId); | |||
| if (!StringUtils.equals(subStatus,experiment.getStatusList())){ | |||
| experiment.setStatusList(subStatus); | |||
| updateexperiments.add(experiment); | |||
| } | |||
| } | |||
| if (updateexperiments.size() > 0){ | |||
| if (updateexperiments.size() > 0) { | |||
| experimentDao.insertOrUpdateBatch(updateexperiments); | |||
| for (int index = 0; index < updateexperiments.size(); index++) { | |||
| experimentIds.remove(index); | |||
| } | |||
| } | |||
| experimentIds.clear(); | |||
| System.out.println(experimentIds); | |||
| } | |||
| } | |||
| @@ -160,24 +160,25 @@ | |||
| </foreach> | |||
| </insert> | |||
| <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into experiment(name,workflow_id, global_param, status_list, description, create_by, create_time, update_by, update_time, state) | |||
| <update id="insertOrUpdateBatch"> | |||
| insert into experiment (id, name, workflow_id, global_param, status_list, description, create_by, create_time, update_by, update_time, state) | |||
| values | |||
| <foreach collection="entities" item="entity" separator=","> | |||
| (#{entity.name},#{entity.workflowId}, #{entity.globalParam}, #{entity.statusList}, #{entity.description}, #{entity.createBy}, #{entity.createTime}, | |||
| #{entity.updateBy}, #{entity.updateTime}, #{entity.state}) | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| (#{item.id}, #{item.name}, #{item.workflowId}, #{item.globalParam}, #{item.statusList}, #{item.description}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state}) | |||
| </foreach> | |||
| on duplicate key update | |||
| name=values(name), | |||
| workflow_id = values(workflow_id), | |||
| global_param = values(global_param), | |||
| description = values(description), | |||
| create_by = values(create_by), | |||
| create_time = values(create_time), | |||
| update_by = values(update_by), | |||
| update_time = values(update_time), | |||
| state = values(state) | |||
| </insert> | |||
| ON DUPLICATE KEY UPDATE | |||
| name = VALUES(name), | |||
| workflow_id = VALUES(workflow_id), | |||
| global_param = VALUES(global_param), | |||
| status_list = VALUES(status_list), | |||
| description = VALUES(description), | |||
| create_by = VALUES(create_by), | |||
| create_time = VALUES(create_time), | |||
| update_by = VALUES(update_by), | |||
| update_time = VALUES(update_time), | |||
| state = VALUES(state); | |||
| </update> | |||
| <!--通过主键修改数据--> | |||
| <update id="update"> | |||
| @@ -223,18 +223,39 @@ | |||
| </foreach> | |||
| </insert> | |||
| <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> | |||
| insert into | |||
| experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,start_time,finish_time,create_by,create_time,update_by,update_time,state) | |||
| <!-- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">--> | |||
| <!-- insert into--> | |||
| <!-- experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,start_time,finish_time,create_by,create_time,update_by,update_time,state)--> | |||
| <!-- values--> | |||
| <!-- <foreach collection="entities" item="entity" separator=",">--> | |||
| <!-- (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesResult},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})--> | |||
| <!-- </foreach>--> | |||
| <!-- on duplicate key update--> | |||
| <!-- experiment_id = values(experiment_id)argo_ins_name = values(argo_ins_name)argo_ins_ns = values(argo_ins_ns)status = values(status) nodes_status = values(nodes_status) create_by = values(create_by)create_time = values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state)--> | |||
| <!-- </insert>--> | |||
| <update id="insertOrUpdateBatch"> | |||
| insert into experiment_ins (id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_result, nodes_logs, global_param, start_time, finish_time, create_by, create_time, update_by, update_time, state) | |||
| values | |||
| <foreach collection="entities" item="entity" separator=","> | |||
| (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesResult},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) | |||
| <foreach collection="list" item="item" index="index" separator=","> | |||
| (#{item.id}, #{item.experimentId}, #{item.argoInsName}, #{item.argoInsNs}, #{item.status}, #{item.nodesStatus}, #{item.nodesResult}, #{item.nodesLogs}, #{item.globalParam}, #{item.startTime}, #{item.finishTime}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state}) | |||
| </foreach> | |||
| on duplicate key update | |||
| experiment_id = values(experiment_id)argo_ins_name = values(argo_ins_name)argo_ins_ns = | |||
| values(argo_ins_ns)status = values(status) nodes_status = values(nodes_status) create_by = values(create_by)create_time = | |||
| values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state) | |||
| </insert> | |||
| ON DUPLICATE KEY UPDATE | |||
| experiment_id = VALUES(experiment_id), | |||
| argo_ins_name = VALUES(argo_ins_name), | |||
| argo_ins_ns = VALUES(argo_ins_ns), | |||
| status = VALUES(status), | |||
| nodes_status = VALUES(nodes_status), | |||
| nodes_result = VALUES(nodes_result), | |||
| nodes_logs = VALUES(nodes_logs), | |||
| global_param = VALUES(global_param), | |||
| start_time = VALUES(start_time), | |||
| finish_time = VALUES(finish_time), | |||
| create_by = VALUES(create_by), | |||
| create_time = VALUES(create_time), | |||
| update_by = VALUES(update_by), | |||
| update_time = VALUES(update_time), | |||
| state = VALUES(state); | |||
| </update> | |||
| <update id="update"> | |||
| update experiment_ins | |||