</pre><pre name= "code" class= "SQL" >insert into Invite_rejectlog_num (player_id,month,count,last_modify_ Time) VALUES (#{playerid},#{month},#{count},#{lastmodifytime}) on DUPLICATE KEY UPDATE count=count+1;
Unique constraint ID and month required
Ava Month calculation comparison
Calendar Caldelm = Calendar.getinstance (); Caldelm.set (calendar.month, 0); System.out.println (Caldelm.get (Calendar.month)); Caldelm.add (Calendar.month,-1); System.out.println (Caldelm.get (Calendar.month));//IX traversal the month to delete int isdel = Caldelm.get (calendar.month); int IX = 8;// Cache Minimum month calendar calDelM2 = Calendar.getinstance (); Caldelm2.set (Calendar.month, ix); IX = Caldelm2.get (Calendar.month) ;//Ix<isdelcalendar calDelM3 = Calendar.getinstance (); Caldelm3.set (Calendar.month, Caldelm.get (Calendar.MONTH)) ; for (; Caldelm2.compareto (calDelM3)! =-1;) {System.out.println ("================"); System.out.println ("calDelM2:" + caldelm2.get (calendar.month) + "+" Caldelm: "+ caldelm.get (calendar.month) +" Calde LM3: "+ caldelm3.get (calendar.month)); System.out.println (Caldelm2.compareto (calDelM3)); Caldelm.add (Calendar.month,-1); Isdel = Caldelm.get ( Calendar.month); Caldelm3.set (Calendar.month, Caldelm.get (Calendar.month)); System.out.println ("del:" + Isdel); System.out.println ("================");}
MySQL If there is an ID then the data is incremented by 1 and does not exist to add. Comparison of Java month calculations