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.
59 lines
1.5 KiB
59 lines
1.5 KiB
package com.eco.plugin.xx.xytsso.db.dao; |
|
|
|
import com.eco.plugin.xx.xytsso.db.bean.UserEntity; |
|
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 UserDao extends BaseDAO<UserEntity> { |
|
|
|
public UserDao(DAOSession session) { |
|
super(session); |
|
} |
|
|
|
@Override |
|
protected Class<UserEntity> getEntityClass() { |
|
return UserEntity.class; |
|
} |
|
|
|
public final static DAOProvider DAO = new DAOProvider() { |
|
@Override |
|
public Class getEntityClass() { |
|
return UserEntity.class; |
|
} |
|
|
|
@Override |
|
public Class<? extends BaseDAO> getDAOClass() { |
|
return UserDao.class; |
|
} |
|
}; |
|
|
|
public void add(UserEntity 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(UserEntity entity) throws Exception { |
|
getSession().merge(entity); |
|
} |
|
|
|
public List<UserEntity> getAllUser() throws Exception { |
|
QueryCondition condition = QueryFactory.create(); |
|
return find(condition); |
|
} |
|
}
|
|
|