📄 studentmanager.java
字号:
package com.tcg.demo;
import static com.tcg.core.AppService.getService;
import com.tcg.core.PaginationSupport;
import com.tcg.core.Utils.Condition;
import com.tcg.core.Utils.DwrBackParams;
import com.tcg.core.Utils.QueryTranslate;
import com.tcg.demo.bean.Student;
import java.util.List;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date: 2008-10-25
* Time: 20:14:57
* To change this template use File | Settings | File Templates.
*/
public class StudentManager {
public StudentManager()
{
}
public void addStudent(Student student)
{
getService().save(student);
}
public void deleteStudent(Student student)
{
getService().delete(Student.class,student.getId());
}
public void updateStudent(List <Student> list)
{
for (Student student : list) {
getService().save(student);
}
}
public PaginationSupport pageListStudent(DwrBackParams params)
{
String hql="from Student";
int pageSize=params.getLimit();
int currentPage=params.getStart()/pageSize+1;
List<Condition> conditions = params.getConditions();
if(null!=conditions&&conditions.size()>0)
{
QueryTranslate queryTranslate = new QueryTranslate(hql, conditions);
hql = queryTranslate.toString();
}
PaginationSupport paginationSupport = getService().findPage(hql,currentPage ,pageSize );
return paginationSupport;
}
public static void main(String[] args) {
StudentManager s = new StudentManager();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -