JAva自増流水番号(日付+乱数)
436 ワード
/**
* @ java
* 14 + 6
* @ shaomy
* @ :2015-1-29 10:57:41
* @ :@return
* @ :String
*/
public String getNumberForPK(){
String id="";
SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
String temp = sf.format(new Date());
int random=(int) (Math.random()*10000);
id=temp+random;
return id;
}