绑定关系

back_recharge
wangyuan 2019-03-14 14:46:29 +08:00
parent 1262ac5fda
commit 68b5336df8
2 changed files with 6 additions and 3 deletions

View File

@ -3,10 +3,9 @@ package com.ljsd.common.mogodb;
import org.springframework.data.annotation.Transient;
import java.lang.ref.WeakReference;
//使用下划线是为了在json转换时能转为正确的值
public abstract class MongoBase {
public static final String _COLLECTION_NAME = "user";
private String rootId;
@ -14,6 +13,10 @@ public abstract class MongoBase {
@Transient
private String rootCollection;
public MongoBase(){
setRootCollection(_COLLECTION_NAME);
}
public void init(String id,String mongoKey) {
this.rootId = id;
this.mongoKey = mongoKey;

View File

@ -18,7 +18,7 @@ public class Item extends MongoBase {
}
public Item(int itemId,int itemNum){
this.setRootCollection(User._COLLECTION_NAME);
// this.setRootCollection(User._COLLECTION_NAME);
this.itemId = itemId;
this.itemNum = itemNum;
this.endingTime = (int)(System.currentTimeMillis()/1000);