update GoodPurchasePlan set orgUnit_id = (select md.oid from (select min(td.orgUnit_id) as oid,td.goodPurchasePlan_id as pid from(select it.id, it.orgUnit_id,it.goodPurchasePlan_id from GoodPurchaseItem it inner join  goodpurchasePlan p on p.id = it.goodPurchasePlan_id) td group by td.goodPurchasePlan_id) md where md.pid = id);
update godownentry set subtype='同步入库' where type='入库单' and remark like '%同步%';
update godownentry set subtype='手工入库' where type='入库单' and (remark is null or remark not like '%同步%');
update godownentry set subtype='手工出库' where type='退库单' and (remark is null or remark not like '%同步%');
update invoiceplan set submittime=applicationtime where submittime is null;
update userecord set statussequence = (case status when '未审核' then 0 when '已审核' then 1 when '已申请' then 2 else statussequence end) 
where statussequence is null or statussequence <> (case status when '未审核' then 0 when '已审核' then 1 when '已申请' then 2 else statussequence end) and status in ('未审核','已审核','已申请');