Skip to content

Commit

Permalink
fix: 带条件的fetchLinks失效了
Browse files Browse the repository at this point in the history
  • Loading branch information
wendal committed Apr 17, 2017
1 parent fb4fc2f commit d82c835
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<artifactId>nutz</artifactId>
<packaging>jar</packaging>
<name>Nutz</name>
<version>1.r.62-SNAPSHOT</version>
<version>1.r.61</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down
4 changes: 2 additions & 2 deletions src/org/nutz/Nutz.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class Nutz {
* @return nutz 项目的版本号
*/
public static String version() {
return String.format("%d.%s.%d-SNAPSHOT",
return String.format("%d.%s.%d",
majorVersion(),
releaseLevel(),
minorVersion());
Expand All @@ -50,7 +50,7 @@ public static int majorVersion() {
* 发布流水
*/
public static int minorVersion() {
return 62;
return 61;
}

/**
Expand Down
14 changes: 7 additions & 7 deletions src/org/nutz/dao/impl/NutDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ public <T> T fetchLinks(final T obj, final String regex, final Condition cnd) {
return null;
Lang.each(obj, false, new Each<Object>() {
public void invoke(int index, Object ele, int length) {
_fetchLinks(ele, regex, true, true, true);
_fetchLinks(ele, regex, true, true, true, cnd);
}
});
return obj;
Expand Down Expand Up @@ -1082,7 +1082,7 @@ public <T> T fetchByJoin(Class<T> klass, String regex, Entity<T> en, MappingFiel
String key = en.getTableName() + "." + mf.getColumnNameInSql();
T t = fetchByJoin(klass, regex, Cnd.where(key, "=", value));
if (t != null)
_fetchLinks(t, regex, false, true, true);
_fetchLinks(t, regex, false, true, true, null);
return t;
}

Expand All @@ -1096,7 +1096,7 @@ public <T> T fetchByJoin(Class<T> classOfT, String regex, Condition cnd) {
_exec(pojo);
T t = pojo.getObject(classOfT);
if (t != null)
_fetchLinks(t, regex, false, true, true);
_fetchLinks(t, regex, false, true, true, null);
return t;
}

Expand All @@ -1110,19 +1110,19 @@ public <T> List<T> queryByJoin(Class<T> classOfT, String regex, Condition cnd) {
List<T> list = pojo.getList(classOfT);
if (list != null && list.size() > 0)
for (T t : list) {
_fetchLinks(t, regex, false, true, true);
_fetchLinks(t, regex, false, true, true, null);
}
return list;
}

protected Object _fetchLinks(Object t, String regex, boolean visitOne, boolean visitMany, boolean visitManyMany) {
protected Object _fetchLinks(Object t, String regex, boolean visitOne, boolean visitMany, boolean visitManyMany, final Condition cnd) {
EntityOperator opt = _optBy(t);
if (null == opt)
return t;
if (visitMany)
opt.entity.visitMany(t, regex, doLinkQuery(opt, null));
opt.entity.visitMany(t, regex, doLinkQuery(opt, cnd));
if (visitManyMany)
opt.entity.visitManyMany(t, regex, doLinkQuery(opt, null));
opt.entity.visitManyMany(t, regex, doLinkQuery(opt, cnd));
if (visitOne)
opt.entity.visitOne(t, regex, doFetch(opt));
opt.exec();
Expand Down

0 comments on commit d82c835

Please sign in to comment.