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.
97 lines
3.5 KiB
97 lines
3.5 KiB
package com.fr.plugin.loginAuth.dbAccessProvider; |
|
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 秃破天际 |
|
* @version 10.0 |
|
* Created by 秃破天际 on 2021-04-25 |
|
**/ |
|
public class AuthUserMacDAO extends BaseDAO<AuthUserMacEntity> { |
|
public AuthUserMacDAO(DAOSession session) { |
|
super(session); |
|
} |
|
|
|
@Override |
|
protected Class<AuthUserMacEntity> getEntityClass() { |
|
return AuthUserMacEntity.class; |
|
} |
|
|
|
public final static DAOProvider DAO = new DAOProvider() { |
|
@Override |
|
public Class getEntityClass() { |
|
return AuthUserMacEntity.class; |
|
} |
|
|
|
@Override |
|
public Class<? extends BaseDAO> getDAOClass() { |
|
return AuthUserMacDAO.class; |
|
} |
|
}; |
|
|
|
public List<AuthUserMacEntity> getAuthUserMac(String username, String mac ) throws Exception{ |
|
QueryCondition condition = QueryFactory.create().addRestriction(RestrictionFactory.eq(AuthUserMacEntity.COLUMN_WC, username)) |
|
.addRestriction(RestrictionFactory.eq(AuthUserMacEntity.COLUMN_DM, mac)); |
|
return find(condition); |
|
} |
|
|
|
public void add( AuthUserMacEntity item) throws Exception { |
|
getSession().persist(item); |
|
} |
|
|
|
public List<AuthUserMacEntity> getAuthUserMac2(String username, String mac, String deviceType) throws Exception { |
|
QueryCondition condition = QueryFactory.create().addRestriction(RestrictionFactory.eq(AuthUserMacEntity.COLUMN_WC, username)) |
|
.addRestriction(RestrictionFactory.eq(AuthUserMacEntity.COLUMN_DM, mac)).addRestriction(RestrictionFactory.eq(AuthUserMacEntity.COLUMN_DT,deviceType)); |
|
return find(condition); |
|
} |
|
// |
|
// public void addOrUpdate( List<AuthUserMacEntity> list )throws Exception { |
|
// for( AuthUserMacEntity item : list ){ |
|
// addOrUpdate(item); |
|
// } |
|
// } |
|
// |
|
// public List<AuthUserMacEntity> removeByKey(String key )throws Exception{ |
|
// QueryCondition condition = QueryFactory.create().addRestriction(RestrictionFactory.eq(AuthUserMacEntity.COLUMN_AS, key)); |
|
// List<AuthUserMacEntity> list = find(condition); |
|
// for( AuthUserMacEntity item : list ){ |
|
// remove( item.getId() ); |
|
// } |
|
// return list; |
|
// } |
|
// |
|
// public List<AuthUserMacEntity> getByKey(String key )throws Exception{ |
|
// QueryCondition condition = QueryFactory.create().addRestriction(RestrictionFactory.eq(AuthUserMacEntity.COLUMN_AS, key)); |
|
// return find(condition); |
|
// } |
|
// |
|
// public void add(AuthUserMacEntity entity) throws Exception { |
|
// getSession().persist(entity); |
|
// } |
|
// |
|
// public void update(AuthUserMacEntity entity) throws Exception { |
|
// getSession().merge(entity); |
|
// } |
|
// |
|
// public void addOrUpdate(AuthUserMacEntity entity) throws Exception { |
|
// if (entity != null && this.getById(entity.getId()) != null) { |
|
// update(entity); |
|
// } else { |
|
// add(entity); |
|
// } |
|
// } |
|
// |
|
// public AuthUserMacEntity getById(String id) throws Exception { |
|
// return this.getSession().getById(id, AuthUserMacEntity.class); |
|
// } |
|
// |
|
// public void remove(String id) throws Exception { |
|
// this.getSession().remove(QueryFactory.create().addRestriction(RestrictionFactory.eq("id", id)), this.getEntityClass()); |
|
// } |
|
}
|
|
|