jiapeng 7 年之前
父节点
当前提交
e4e4665de2

+ 12 - 0
jfwAptOrm/src/main/java/org/jfw/apt/orm/annotation/dao/method/Exclude.java

1
package org.jfw.apt.orm.annotation.dao.method;
2

3
import java.lang.annotation.ElementType;
4
import java.lang.annotation.Retention;
5
import java.lang.annotation.RetentionPolicy;
6
import java.lang.annotation.Target;
7

8
@Target(ElementType.METHOD)
9
@Retention(RetentionPolicy.SOURCE)
10
public @interface Exclude {
11
	String[] value();
12
}

+ 25 - 1
jfwAptOrm/src/main/java/org/jfw/apt/orm/daoHandler/BaseQueryHandler.java

6
6
7
import org.jfw.apt.Util;
7
import org.jfw.apt.Util;
8
import org.jfw.apt.exception.AptException;
8
import org.jfw.apt.exception.AptException;
9
import org.jfw.apt.orm.annotation.dao.method.Exclude;
9
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
10
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
10
import org.jfw.apt.orm.core.model.CalcColumn;
11
import org.jfw.apt.orm.core.model.CalcColumn;
11
import org.jfw.apt.orm.core.model.DataEntry;
12
import org.jfw.apt.orm.core.model.DataEntry;
15
import org.jfw.apt.orm.core.model.where.WherePart;
16
import org.jfw.apt.orm.core.model.where.WherePart;
16
17
17
public abstract class BaseQueryHandler extends BaseDaoHandler {
18
public abstract class BaseQueryHandler extends BaseDaoHandler {
19
	private static final String[] EMPTY_STRING_ARRAY = new String[0];
18
20
19
	public static final String PAGE_PREFIX = "org.jfw.util.PageQueryResult<";
21
	public static final String PAGE_PREFIX = "org.jfw.util.PageQueryResult<";
20
	public static final int PAGE_RCN_INDEX = PAGE_PREFIX.length();
22
	public static final int PAGE_RCN_INDEX = PAGE_PREFIX.length();
90
		cw.l("}finally{").writeClosing("ps").l("}");
92
		cw.l("}finally{").writeClosing("ps").l("}");
91
	}
93
	}
92
94
95
	
96
	protected void handleExclude(){
97
		Exclude exclude =  ref.getAnnotation(Exclude.class);
98
		
99
		if(null!= exclude && exclude.value().length>0){
100
			String[] excludeColumns =exclude.value();
101
			for (ListIterator<CalcColumn> it = this.fields.listIterator(); it.hasNext();) {
102
				CalcColumn cc = it.next();
103
				for(String ec:excludeColumns){
104
					if(ec.equals(cc.getJavaName())){
105
						it.remove();
106
						break;
107
					}
108
				}
109
			}
110
			
111
		}
112
	}
113
93
	protected void prepareDataEntry() throws AptException {
114
	protected void prepareDataEntry() throws AptException {
94
		String drc = this.getDefReturnClassName();
115
		String drc = this.getDefReturnClassName();
95
116
129
			}
150
			}
130
		}
151
		}
131
		for (ListIterator<CalcColumn> it = this.fields.listIterator(); it.hasNext();) {
152
		for (ListIterator<CalcColumn> it = this.fields.listIterator(); it.hasNext();) {
132
			if (!it.next().isQueryable())
153
			CalcColumn cc = it.next();
154
			if (!cc.isQueryable()){
133
				it.remove();
155
				it.remove();
156
			}
134
		}
157
		}
158
		this.handleExclude();
135
	}
159
	}
136
160
137
	protected void buildWhere() throws AptException {
161
	protected void buildWhere() throws AptException {

+ 2 - 0
jfwAptOrm/src/main/java/org/jfw/apt/orm/daoHandler/BaseSelectHandler.java

22
			if (!it.next().isQueryable())
22
			if (!it.next().isQueryable())
23
				it.remove();
23
				it.remove();
24
		}
24
		}
25
		this.handleExclude();
26
		
25
	}
27
	}
26
	
28
	
27
	@Override
29
	@Override