All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openurp.web.action.api.TeacherAction Maven / Gradle / Ivy

There is a newer version: 0.41.3
Show newest version
/*
 * OpenURP, Agile University Resource Planning Solution.
 *
 * Copyright © 2014, The OpenURP Software.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful.
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
package org.openurp.web.action.api;

import java.util.Date;

import org.beangle.commons.collection.page.PageLimit;
import org.beangle.commons.dao.query.builder.OqlBuilder;
import org.beangle.commons.lang.Strings;
import org.openurp.base.hr.model.Teacher;
import org.openurp.edu.web.action.BaseAction;

/**
 * 教师web service api
* entry: api/teacher
*/ public class TeacherAction extends BaseAction { /** * Entry : api/teacher!get.action
* Accept params:
*
    *
  • term 工号或姓名
  • *
  • pageNo 页数
  • *
  • pageSize 页长
  • *
  • teacher.属性
  • *
* Return: json
*/ public String json() { String codeOrName = get("term"); OqlBuilder query = OqlBuilder.from(Teacher.class, "teacher"); // query.where("teacher.project.id=:projectId", getIntId("project")); populateConditions(query); // Integer teacherDepartId = getInt("teacher.department.id"); // if (teacherDepartId != null) { // query.where("teacher.department.id = :departmentId", teacherDepartId); // } if (Strings.isNotEmpty(codeOrName)) { query.where("(teacher.name like :name or teacher.staff.code like :code)", '%' + codeOrName + '%', '%' + codeOrName + '%'); } Date now = new Date(); query.where(":now1 >= teacher.beginOn and (teacher.endOn is null or :now2 <= teacher.endOn)", now, now) .orderBy("teacher.name"); PageLimit pageLimit = getPageLimit(); query.limit(pageLimit); put("teachers", entityDao.search(query)); put("pageLimit", pageLimit); return forward(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy