一种方法:无值传递(交给java处理)
/**
* 根据教师状态查询教师信息列表(可多状态)
*/
@Override
public PaginationSupport getTeacherListByTypes(
LinkedHashMap<String, String> sort, int page, int countPerPage,
Integer[] teacherStates, Long fieldId) {
List<String> pn = new ArrayList<String>();
pn.add("fieldId");
//pn.add("teacSchoolEndTime");
List<Object> pv = new ArrayList<Object>();
pv.add(fieldId!=null?"%,"+fieldId.toString()+",%":"%%");
//pv.add(new Date());
String[] pns = new String[pn.size()];
pn.toArray(pns);
String hql="select distinct tti from SysTeaTeactherInfo tti " +
"left join tti.sysTeaProfFields tpf where concat(',',trim(str(tpf.fieldId)),',',tpf.fieldFatherStr) like :fieldId " ;
// String hql = "select new Test(tti.teacherName,ept.teacSchoolStartTime) from SysTeaTeactherInfo tti " +
// "left join SysEduProjectTeacher ept on ept.sysTeaTeactherInfo.teacherId = tti.teacherId" +
// "left join tti.sysTeaProfFields tpf where tpf.fieldId like :fieldId " ;
//
// if(sort!=null&&sort.size()>0){
// String order = addOrder(sort);
// if(order!=null&&order!=""){
// hql = hql+" order by "+order;
// }
// }else{
// hql +=" order by rcd.croomBeginTime asc";
// }
return this.findByHqlOnPage(hql, page, countPerPage,new String[]{"fieldId"},new Object[]{"%,"+fieldId.toString()+",%"});
}
//教师是否在校
if(this.getSysEduProjectTeachers()!=null){
Date comeTime = null;
Date endTime = null;
Iterator<SysEduProjectTeacher> it = this.getSysEduProjectTeachers().iterator();
while(it.hasNext()){
SysEduProjectTeacher sysEduProjectTeacher = it.next();
Date comeDate = sysEduProjectTeacher.getTeacSchoolStartTime();
Date endDate = sysEduProjectTeacher.getTeacSchoolEndTime();
if(endDate.compareTo(nowDate)>=0){
comeTime = comeDate;
endTime = endDate;
}
}
super.putMap("comeTime", comeTime==null?"不在校":DateUtil.toString(comeTime));
super.putMap("endTime", endTime==null?"不在校":DateUtil.toString(endTime));
}else{
super.putMap("comeTime", "不在校");
super.putMap("endTime", "不在校");
}
if(this.getSysEduProjectLessons()!=null){
double sum = 0;
Iterator<SysEduProjectLesson> it = this.getSysEduProjectLessons().iterator();
while(it.hasNext()){
SysEduProjectLesson sysEduProjectLesson = it.next();
sum += sysEduProjectLesson.getLessonTeacherPoint();
}
double avg = sum/this.getSysEduProjectLessons().size();
avg = Math.round(avg*100);
avg = avg/100.0;
super.putMap("avg", avg);
}else {
super.putMap("avg", "0");
}