insert into #{dynamic_securityFlow}.tlk_selfemprecords (LASTMODIFIED,FORMNAME,STATE,CREATED,FORMID,ISTMP,VERSIONS,APPLICATIONID,DOMAINID,ITEM_companyProblem,ITEM_stationProblem,ITEM_inspectionContent,ITEM_inspectionRecords,ITEM_handleRegulatory,ITEM_rectificationRequire,ITEM_reviewSituation,ITEM_isInSystem,ITEM_companyName,ITEM_dutyStation,ITEM_officePoliceAddress,ITEM_inspecter,ITEM_inspectTime,ITEM_dataSoure,ITEM_q1,ITEM_q1Remark,ITEM_q2,ITEM_q2Remark,ITEM_q3,ITEM_q3Remark,ITEM_q4,ITEM_q4Remark,ITEM_q5,ITEM_q5Remark,ITEM_q6,ITEM_q6Remark,ITEM_q7,ITEM_q7Remark,ITEM_q8,ITEM_q8Remark,ITEM_q9,ITEM_q9Remark,ITEM_q10,ITEM_q10Remark,ITEM_p1,ITEM_p1Remark,ITEM_p2,ITEM_p2Remark,ITEM_p3,ITEM_p3Remark,ITEM_p4,ITEM_p4Remark,ITEM_p5,ITEM_p5Remark,ITEM_p6,ITEM_p6Remark,ITEM_p7,ITEM_p7Remark,ITEM_p8,ITEM_p8Remark,ITEM_p9,ITEM_p9Remark,ITEM_p10,ITEM_p10Remark,ITEM_p11,ITEM_p11Remark,ITEM_p12,ITEM_p12Remark,ITEM_registerPoliceAddress,ITEM_creater,ITEM_sourceSignature,ITEM_targetSignature,ITEM_createTime,ID,ITEM_DOMAIN) VALUES ('#{LASTMODIFIED}','#{FORMNAME}','#{STATE}','#{CREATED}','#{FORMID}',0,1,'#{APPLICATIONID}','#{dynamic_domain_id}','#{ITEM_companyProblem}','#{ITEM_stationProblem}','#{ITEM_inspectionContent}','#{ITEM_inspectionRecords}','#{ITEM_handleRegulatory}','#{ITEM_rectificationRequire}','#{ITEM_reviewSituation}','#{ITEM_isInSystem}','#{ITEM_companyName}','#{ITEM_dutyStation}','#{ITEM_officePoliceAddress}','#{ITEM_inspecter}','#{ITEM_inspectTime}','#{ITEM_dataSoure}','#{ITEM_q1}','#{ITEM_q1Remark}','#{ITEM_q2}','#{ITEM_q2Remark}','#{ITEM_q3}','#{ITEM_q3Remark}','#{ITEM_q4}','#{ITEM_q4Remark}','#{ITEM_q5}','#{ITEM_q5Remark}','#{ITEM_q6}','#{ITEM_q6Remark}','#{ITEM_q7}','#{ITEM_q7Remark}','#{ITEM_q8}','#{ITEM_q8Remark}','#{ITEM_q9}','#{ITEM_q9Remark}','#{ITEM_q10}','#{ITEM_q10Remark}','#{ITEM_p1}','#{ITEM_p1Remark}','#{ITEM_p2}','#{ITEM_p2Remark}','#{ITEM_p3}','#{ITEM_p3Remark}','#{ITEM_p4}','#{ITEM_p4Remark}','#{ITEM_p5}','#{ITEM_p5Remark}','#{ITEM_p6}','#{ITEM_p6Remark}','#{ITEM_p7}','#{ITEM_p7Remark}','#{ITEM_p8}','#{ITEM_p8Remark}','#{ITEM_p9}','#{ITEM_p9Remark}','#{ITEM_p10}','#{ITEM_p10Remark}','#{ITEM_p11}','#{ITEM_p11Remark}','#{ITEM_p12}','#{ITEM_p12Remark}','#{ITEM_registerPoliceAddress}','#{ITEM_creater}','#{ITEM_sourceSignature}','#{ITEM_targetSignature}','#{ITEM_createTime}','#{ID}','#{ITEM_DOMAIN}') ON DUPLICATE KEY UPDATE domainid='#{dynamic_domain_id}';

update tlk_selfemprecords set LASTMODIFIED = '#{LASTMODIFIED}',FORMNAME = '#{FORMNAME}',STATE = '#{STATE}',CREATED = '#{CREATED}',FORMID = '#{FORMID}',ISTMP = 0,VERSIONS = 1,APPLICATIONID = '#{APPLICATIONID}',ITEM_companyProblem = '#{ITEM_companyProblem}',ITEM_stationProblem = '#{ITEM_stationProblem}',ITEM_inspectionContent = '#{ITEM_inspectionContent}',ITEM_inspectionRecords = '#{ITEM_inspectionRecords}',ITEM_handleRegulatory = '#{ITEM_handleRegulatory}',ITEM_rectificationRequire = '#{ITEM_rectificationRequire}',ITEM_reviewSituation = '#{ITEM_reviewSituation}',ITEM_isInSystem = '#{ITEM_isInSystem}',ITEM_companyName = '#{ITEM_companyName}',ITEM_dutyStation = '#{ITEM_dutyStation}',ITEM_officePoliceAddress = '#{ITEM_officePoliceAddress}',ITEM_inspecter = '#{ITEM_inspecter}',ITEM_inspectTime = '#{ITEM_inspectTime}',ITEM_dataSoure = '#{ITEM_dataSoure}',ITEM_q1 = '#{ITEM_q1}',ITEM_q1Remark = '#{ITEM_q1Remark}',ITEM_q2 = '#{ITEM_q2}',ITEM_q2Remark = '#{ITEM_q2Remark}',ITEM_q3 = '#{ITEM_q3}',ITEM_q3Remark = '#{ITEM_q3Remark}',ITEM_q4 = '#{ITEM_q4}',ITEM_q4Remark = '#{ITEM_q4Remark}',ITEM_q5 = '#{ITEM_q5}',ITEM_q5Remark = '#{ITEM_q5Remark}',ITEM_q6 = '#{ITEM_q6}',ITEM_q6Remark = '#{ITEM_q6Remark}',ITEM_q7 = '#{ITEM_q7}',ITEM_q7Remark = '#{ITEM_q7Remark}',ITEM_q8 = '#{ITEM_q8}',ITEM_q8Remark = '#{ITEM_q8Remark}',ITEM_q9 = '#{ITEM_q9}',ITEM_q9Remark = '#{ITEM_q9Remark}',ITEM_q10 = '#{ITEM_q10}',ITEM_q10Remark = '#{ITEM_q10Remark}',ITEM_p1 = '#{ITEM_p1}',ITEM_p1Remark = '#{ITEM_p1Remark}',ITEM_p2 = '#{ITEM_p2}',ITEM_p2Remark = '#{ITEM_p2Remark}',ITEM_p3 = '#{ITEM_p3}',ITEM_p3Remark = '#{ITEM_p3Remark}',ITEM_p4 = '#{ITEM_p4}',ITEM_p4Remark = '#{ITEM_p4Remark}',ITEM_p5 = '#{ITEM_p5}',ITEM_p5Remark = '#{ITEM_p5Remark}',ITEM_p6 = '#{ITEM_p6}',ITEM_p6Remark = '#{ITEM_p6Remark}',ITEM_p7 = '#{ITEM_p7}',ITEM_p7Remark = '#{ITEM_p7Remark}',ITEM_p8 = '#{ITEM_p8}',ITEM_p8Remark = '#{ITEM_p8Remark}',ITEM_p9 = '#{ITEM_p9}',ITEM_p9Remark = '#{ITEM_p9Remark}',ITEM_p10 = '#{ITEM_p10}',ITEM_p10Remark = '#{ITEM_p10Remark}',ITEM_p11 = '#{ITEM_p11}',ITEM_p11Remark = '#{ITEM_p11Remark}',ITEM_p12 = '#{ITEM_p12}',ITEM_p12Remark = '#{ITEM_p12Remark}',ITEM_registerPoliceAddress = '#{ITEM_registerPoliceAddress}',ITEM_creater = '#{ITEM_creater}',ITEM_sourceSignature = '#{ITEM_sourceSignature}',ITEM_targetSignature = '#{ITEM_targetSignature}',ITEM_createTime = '#{ITEM_createTime}' where id = '#{ID}' and LASTMODIFIED > '#{LASTMODIFIED}';