INSERT INTO
  #{dynamic_securityFlow}.TLK_GUN_INVENTORY_RECORD (
    PARENT,
    LASTMODIFIED,
    FORMNAME,
    STATE,
    AUDITUSER,
    AUDITDATE,
    AUTHOR,
    AUTHOR_DEPT_INDEX,
    CREATED,
    FORMID,
    ISTMP,
    VERSIONS,
    APPLICATIONID,
    STATEINT,
    STATELABEL,
    AUDITORNAMES,
    LASTFLOWOPERATION,
    LASTMODIFIER,
    DOMAINID,
    AUDITORLIST,
    COAUDITORLIST,
    STATELABELINFO,
    PREVAUDITNODE,
    PREVAUDITUSER,
    OPTIONITEM,
    SIGN,
    KINGGRIDSIGNATURE,
    ITEM_REMARK,
    ID,
    ITEM_GUNMODEL,
    ITEM_GUNNO,
    ITEM_GUNSTATUS,
    ITEM_INVENTORYTYPE,
    ITEM_SECURITYNAME,
    ITEM_SECURITYCERTIFICATENUM,
    ITEM_SECURITYCERTIFICATETYPE,
    ITEM_INVENTORYDATE,
    ITEM_REGISTRANT,
    ITEM_REGISTRANTDATE,
    ITEM_LOSTMAN,
    ITEM_LOSECERTIFICATETYPE,
    ITEM_LOSECERTIFICATENUM,
    ITEM_LOSEREASON,
    ITEM_CANCELREASON,
    ITEM_GUNID,
    AUTHORDEPTID,
    AUTHOR_USER_INDEX,
    SUBFORMIDS,
    INITIATOR
  )
VALUES
  (
    NULL,
    '#{LASTMODIFIED}',
    '#{FORMNAME}',
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    '#{CREATED}',
    '__FUbyEd0oCT5QJouZzza',
    0,
    1,
    '__wGomeHJBz6CpLFCCl4y',
    0,
    '',
    '',
    NULL,
    NULL,
    '#{dynamic_domain_id}',
    '{}',
    '{}',
    '[{\"nodes\":[{\"nodeId\":\"\",\"stateLabel\":\"\",\"state\":\"\",\"auditors\":[],\"coAuditors\":[]}]}]',
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    '#{ITEM_REMARK}',
    REPLACE ( '#{id}', '__NlWHIGoKdaOTsCfOQtN', '__FUbyEd0oCT5QJouZzza' ),
    '#{ITEM_GUNMODEL}',
    '#{ITEM_GUNNO}',
    '#{ITEM_GUNSTATUS}',
    '#{ITEM_INVENTORYTYPE}',
    '#{ITEM_SECURITYNAME}',
    '#{ITEM_SECURITYCERTIFICATENUM}',
    '#{ITEM_SECURITYCERTIFICATETYPE}',
    '#{ITEM_INVENTORYDATE}',
    '#{ITEM_REGISTRANT}',
    '#{ITEM_REGISTRANTDATE}',
    '#{ITEM_LOSTMAN}',
    '#{ITEM_LOSECERTIFICATETYPE}',
    '#{ITEM_LOSECERTIFICATENUM}',
    '#{ITEM_LOSEREASON}',
    '#{ITEM_CANCELREASON}',
    REPLACE ( '#{ITEM_GUNID}', '__D8cUSnel3yRvBM9g4P3', '__1NKM7JInoCac6Ot7kXm' ),
    '#{AUTHORDEPTID}',
    '#{AUTHOR_USER_INDEX}',
    '#{SUBFORMIDS}',
    '#{INITIATOR}'
  ) ON DUPLICATE KEY
UPDATE
  LASTMODIFIED = '#{LASTMODIFIED}',
  ITEM_REMARK = '#{ITEM_REMARK}',
  ITEM_GUNMODEL = '#{ITEM_GUNMODEL}',
  ITEM_GUNNO = '#{ITEM_GUNNO}',
  ITEM_GUNSTATUS = '#{ITEM_GUNSTATUS}',
  ITEM_INVENTORYTYPE = '#{ITEM_INVENTORYTYPE}',
  ITEM_SECURITYNAME = '#{ITEM_SECURITYNAME}',
  ITEM_SECURITYCERTIFICATENUM = '#{ITEM_SECURITYCERTIFICATENUM}',
  ITEM_SECURITYCERTIFICATETYPE = '#{ITEM_SECURITYCERTIFICATETYPE}',
  ITEM_INVENTORYDATE = '#{ITEM_INVENTORYDATE}',
  ITEM_REGISTRANT = '#{ITEM_REGISTRANT}',
  ITEM_REGISTRANTDATE = '#{ITEM_REGISTRANTDATE}',
  ITEM_LOSTMAN = '#{ITEM_LOSTMAN}',
  ITEM_LOSECERTIFICATETYPE = '#{ITEM_LOSECERTIFICATETYPE}',
  ITEM_LOSECERTIFICATENUM = '#{ITEM_LOSECERTIFICATENUM}',
  ITEM_LOSEREASON = '#{ITEM_LOSEREASON}',
  ITEM_CANCELREASON = '#{ITEM_CANCELREASON}',
  ITEM_GUNID = REPLACE ( '#{ITEM_GUNID}', '__D8cUSnel3yRvBM9g4P3', '__1NKM7JInoCac6Ot7kXm' );