DAO 通过 Chain 插入数据库 可以获取自增量ID值吗?
15 回复
chain不行,但map可以
NutMap map = new NutMap(".table", "t_user");
map.put("*+id", 0);
map.put("name", "wendal");
map.put("age", 110);
dao.insert(map);
int id = map.getInt("id");
NutMap map = new NutMap(".table", form.getT_NAME());
map.put("*+ID", 0);
map.put("M_CODE", form.getCODE());
map.put("UID", requestUser.getID());
打印出 INSERT INTO FRM_TEST(+ID,M_CODE,UID,CTIME,UTIME,RANK,fld_name,fld_testint) VALUES(?,?,?,?,?,?,?,?)
字段名称编程+ID了??
怎么办
NutMap map = new NutMap(".table", parent.getT_NAME());
map.put("+ID", 0);
map.put("M_CODE", form.getCODE());
map.put("UID", requestUser.getID());
map.put("CTIME", Times.now());
map.put("UTIME", Times.now());
String rank = data.get("RANK");
if (Strings.isBlank(rank)) {
map.put("RANK", 0);
} else {
map.put("RANK", Integer.parseInt(rank));
}
for (S_FORM_FLDObj fld : parentFields) {
String v = data.get(fld.getF_NAME());
if (v != null) {
map.put(fld.getF_NAME(), v);
}
}
dao.insert(map);
System.out.println(Json.toJson(map));
data.put("ID", "" + map.getInt("ID"));
添加回复
请先登陆