绑定关系
parent
1262ac5fda
commit
68b5336df8
|
|
@ -3,10 +3,9 @@ package com.ljsd.common.mogodb;
|
||||||
import org.springframework.data.annotation.Transient;
|
import org.springframework.data.annotation.Transient;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
//使用下划线,是为了在json转换时,能转为正确的值
|
//使用下划线,是为了在json转换时,能转为正确的值
|
||||||
public abstract class MongoBase {
|
public abstract class MongoBase {
|
||||||
|
public static final String _COLLECTION_NAME = "user";
|
||||||
|
|
||||||
private String rootId;
|
private String rootId;
|
||||||
|
|
||||||
|
|
@ -14,6 +13,10 @@ public abstract class MongoBase {
|
||||||
@Transient
|
@Transient
|
||||||
private String rootCollection;
|
private String rootCollection;
|
||||||
|
|
||||||
|
public MongoBase(){
|
||||||
|
setRootCollection(_COLLECTION_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
public void init(String id,String mongoKey) {
|
public void init(String id,String mongoKey) {
|
||||||
this.rootId = id;
|
this.rootId = id;
|
||||||
this.mongoKey = mongoKey;
|
this.mongoKey = mongoKey;
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ public class Item extends MongoBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Item(int itemId,int itemNum){
|
public Item(int itemId,int itemNum){
|
||||||
this.setRootCollection(User._COLLECTION_NAME);
|
// this.setRootCollection(User._COLLECTION_NAME);
|
||||||
this.itemId = itemId;
|
this.itemId = itemId;
|
||||||
this.itemNum = itemNum;
|
this.itemNum = itemNum;
|
||||||
this.endingTime = (int)(System.currentTimeMillis()/1000);
|
this.endingTime = (int)(System.currentTimeMillis()/1000);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue