Commit 77301e4e authored by yanzg's avatar yanzg

修改实例化关系

parent 8923370e
...@@ -801,7 +801,7 @@ public class TableStruct { ...@@ -801,7 +801,7 @@ public class TableStruct {
// 生成覆盖值 // 生成覆盖值
if (replaceFields != null) { if (replaceFields != null) {
for (TableFieldVo field : replaceFields) { for (TableFieldVo field : replaceFields) {
sqlGroupAdd.addPara(field.inputName, DaoConst.CODE_FIELD, String.format("a.%s=?", field.name)); sqlGroupAdd.addPara(field.inputName, DaoConst.CODE_FIELD, String.format(",a.%s=?", field.name));
} }
} }
// 当没有字段时,直接修改主键 // 当没有字段时,直接修改主键
......
...@@ -24,6 +24,16 @@ public class TestDbPrintSql { ...@@ -24,6 +24,16 @@ public class TestDbPrintSql {
SqlData sqlData = cache.getNameCache().get(DaoConst.GROUP_ADD); SqlData sqlData = cache.getNameCache().get(DaoConst.GROUP_ADD);
System.out.println(JsonHelper.serialize(sqlData, true)); System.out.println(JsonHelper.serialize(sqlData, true));
} }
@Test
public void testTableStruct1() {
TableSqlCache cache = new TableSqlCache();
TableStruct table = new TableStruct("test", TestTableGroupVo1.class);
table.init(cache);
SqlData sqlData = cache.getNameCache().get(DaoConst.GROUP_ADD);
System.out.println(JsonHelper.serialize(sqlData, true));
}
@Test @Test
public void testTable() { public void testTable() {
......
...@@ -13,10 +13,16 @@ public class TestTableGroupVo { ...@@ -13,10 +13,16 @@ public class TestTableGroupVo {
@TableAnnotation(value = "total", type = DaoConst.FIELD_REPLACE_GROUP) @TableAnnotation(value = "total", type = DaoConst.FIELD_REPLACE_GROUP)
private int total; private int total;
@TableAnnotation(value = "total1", type = DaoConst.FIELD_REPLACE_GROUP)
private int total1;
@TableAnnotation(value = "has", type = DaoConst.FIELD_ADD_GROUP) @TableAnnotation(value = "has", type = DaoConst.FIELD_ADD_GROUP)
private int has; private int has;
@TableAnnotation(value = "has1", type = DaoConst.FIELD_ADD_GROUP)
private int has1;
public String getId() { public String getId() {
return id; return id;
} }
...@@ -41,6 +47,14 @@ public class TestTableGroupVo { ...@@ -41,6 +47,14 @@ public class TestTableGroupVo {
this.total = total; this.total = total;
} }
public int getTotal1() {
return total1;
}
public void setTotal1(int total1) {
this.total1 = total1;
}
public int getHas() { public int getHas() {
return has; return has;
} }
...@@ -48,4 +62,12 @@ public class TestTableGroupVo { ...@@ -48,4 +62,12 @@ public class TestTableGroupVo {
public void setHas(int has) { public void setHas(int has) {
this.has = has; this.has = has;
} }
public int getHas1() {
return has1;
}
public void setHas1(int has1) {
this.has1 = has1;
}
} }
import com.yanzuoguang.dao.DaoConst;
import com.yanzuoguang.dao.TableAnnotation;
@TableAnnotation("db_time")
public class TestTableGroupVo1 {
@TableAnnotation("id")
private String id;
@TableAnnotation("createDate")
private String createDate;
@TableAnnotation(value = "total", type = DaoConst.FIELD_REPLACE_GROUP)
private int total;
@TableAnnotation(value = "total1", type = DaoConst.FIELD_REPLACE_GROUP)
private int total1;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getTotal1() {
return total1;
}
public void setTotal1(int total1) {
this.total1 = total1;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment