You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.5 KiB

package com.eco.plugin.xx.xytsso.db.dao;
import com.eco.plugin.xx.xytsso.db.bean.DBEntity;
import com.fr.stable.db.dao.BaseDAO;
import com.fr.stable.db.dao.DAOProvider;
import com.fr.stable.db.session.DAOSession;
import com.fr.stable.query.QueryFactory;
import com.fr.stable.query.condition.QueryCondition;
import com.fr.stable.query.restriction.RestrictionFactory;
import java.util.List;
/**
* @author xx
* @version 10.0
* Created by xx on 2021-12-03
**/
public class OrgDao extends BaseDAO<DBEntity> {
public OrgDao(DAOSession session) {
super(session);
}
@Override
protected Class<DBEntity> getEntityClass() {
return DBEntity.class;
}
public final static DAOProvider DAO = new DAOProvider() {
@Override
public Class getEntityClass() {
return DBEntity.class;
}
@Override
public Class<? extends BaseDAO> getDAOClass() {
return OrgDao.class;
}
};
public void add(DBEntity entity) throws Exception {
getSession().persist(entity);
}
public void remove(String id) throws Exception {
getSession().remove(QueryFactory.create()
.addRestriction(RestrictionFactory.eq("id", id)),
this.getEntityClass());
}
public void update(DBEntity entity) throws Exception {
getSession().merge(entity);
}
public List<DBEntity> getAllOrg() throws Exception {
QueryCondition condition = QueryFactory.create();
return find(condition);
}
}