我必须将数据从资源表移动到事件表以删除资源表。 考虑一下,Table模式如下, MySQL的> desc事件
+-----------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+----------------+
| event_id | bigint(20) | NO | PRI | NULL | auto_increment |
| path | varchar(255) | YES | | NULL | |
+-----------------+--------------+------+-----+---------+----------------+
的MySQL> desc资源;
+--------------------+--------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+----------------+
| resource_id | bigint(20) | NO | PRI | NULL | auto_increment |
| jcr_id | varchar(500) | YES | | NULL | |
+--------------------+--------------+------+-----+---------+----------------+
事件路径包含jcr_id或resource_id,如果它包含jcr_id,则从资源表中输入,然后使用jcr_id更新事件路径值,然后删除。
在迭代每个resource_id时考虑遵循Psuedo代码,
result = select event_id from event where path=_resource_id;
if result is empty
delete from resource where resource_id= _resource_id;
else
update event set path=jcr_id where event_id= result;
delete from resource where resource_id= _resource_id;
答案 0 :(得分:0)
试试这个。
<route>
<from ref="minaEndpoint" />
<threads>
<bean ref="work-to-do" method="work"/>
</threads>
</route>