mybatis防重复插入(oracle数据库)

 

 //使用mybatis标签控制是否防重复插入
​
 INSERT INTO HMAOP_HEAD_CHECKIN
			(
			ID,
			TELNUM,
			CHANNELID,
			SRVID,
			PARAMS,
			UPDATETIME,
			OPERSTATUS,
			STATUS,
			TOKEN,
			EVENTID,
			UNIQUEID,
			ORDERID,
			PAYDATE
			)
		SELECT
			#id#,
			#telnum#,
			#channelid#,
			#srvid#,
			#params#,
			SYSDATE,
			'0',
			'0',
			#token#,
			#eventid#,
			#uniqueid#,
			#orderid#,
			#paydate#
		FROM DUAL
		 
        WHERE
		NOT EXISTS
			(
				SELECT 1 FROM HMAOP_HEAD_CHECKIN WHERE
				TELNUM = #telnum#
				AND
				SRVID = #srvid#
				AND
				EVENTID = #eventid#
				AND
				UNIQUEID = #uniqueid#
				
					AND UPDATETIME >= #updatetimeStart#
				
				
					AND UPDATETIME < #updatetimeEnd#
				
			)
		
	

 

你可能感兴趣的:(java)