📄 dutydao.java
字号:
/**
*
*/
package com.qrsx.qrsxcrm.dao;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.criterion.Example;
import org.hibernate.criterion.MatchMode;
import com.qrsx.qrsxcrm.model.Dept;
import com.qrsx.qrsxcrm.model.Duty;
/**
* @author Administrator
*
*/
public class DutyDAO extends BaseDAO
{
@SuppressWarnings("unchecked")
public DutyDAO(Class Duty) {
super(Duty);
// TODO Auto-generated constructor stub
}
public void updates(Duty duty)
{
Duty duty1 = new Duty();
duty1=(Duty) session.get(Duty.class, duty.getId());
duty1.setDutyName(duty.getDutyName());
duty1.setDescription(duty.getDescription());
duty1.setDutyId(duty.getDutyId());
session.update(duty1);
}
@SuppressWarnings("unchecked")
public List<Duty> lists(Duty duty , int firstrows,int pagesize){
Example example = Example.create(duty);
example.ignoreCase().enableLike(MatchMode.ANYWHERE);//对查询对象进行忽略大小写的模糊查询,适用于动态查询
Criteria criteria = session.createCriteria(duty.getClass()).add(example);
criteria.setFirstResult(firstrows);
criteria.setMaxResults(pagesize);
List<Duty> list = criteria.list();
return list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -