多表关联-java层出来

一种方法:无值传递(交给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");
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值