###mybatis批量保存信息,如果信息已经存在,则更新
数据唯一索引建立在authority_identifier,application_id,resource_names上,如果出现冲突就会更新字段
INSERT INTO `upms_resource`(line_no,id,create_time,update_time,version,resource_name,resource_type,authority_identifier,url,application_identifier,parent_resource_id,application_id) VALUES (null, 1151669296037425196,NOW(), NOW(), 0,'userList', 'BUTTON', 'open-api:user:lis','/auth/open-api/user/list' , 'finance-system', 1151669296037425154, 1) on duplicate key update resource_name=VALUES(resource_name),resource_type=VALUES(resource_type),url=VALUES(ur),parent_resource_id=VALUES(parent_resource_id);
crm_taobao_traderates是淘宝的店铺评论表,如果维护了数据库的唯一约束就会更新数据
crm_taobao_traderates
series,tid,oid,role,nick,result,taobao_created,rated_nick,item_title,item_price,content,reply,num_iid,valid_score,create_dtme,last_updtme,create_user_id,cancelsign,insertdata,updatedata,data_sign,last_update_user_id,ec_shop_num_id,tenant_num_id,source_json,append_sign,append_json
INSERT INTO ( )
(#{o.series}, #{o.tid}, #{o.oid}, #{o.role}, #{o.nick}, #{o.result}, #{o.taobaoCreated}, #{o.ratedNick}, #{o.itemTitle}, #{o.itemPrice},REPLACE(REPLACE(#{o.content},char(10),''),char(13),'') , #{o.reply}, #{o.numIid}, #{o.validScore}, now(), null, 0, 'N', 'Y', 'N', #{o.dataSign}, 0, #{o.ecShopNumId},#{o.tenantNumId},#{o.sourceJson},#{o.appendSign},#{o.appendJson})
ON DUPLICATE KEY UPDATE last_updtme=now()
insert into (series,append_json,append_sign)
(#{o.series},#{o.appendJson},#{o.appendSign})
on duplicate key update append_json=VALUES(append_json),append_sign=VALUES(append_sign)