cn.foxtech.common.entity.manager.EntityServiceManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fox-edge-server-common-entity-service Show documentation
Show all versions of fox-edge-server-common-entity-service Show documentation
fox-edge-server-common-entity-service
package cn.foxtech.common.entity.manager;
import cn.foxtech.common.entity.entity.*;
import cn.foxtech.common.entity.service.redis.IBaseFinder;
import cn.foxtech.common.entity.service.usermenu.UserMenuEntityService;
import cn.foxtech.common.entity.service.usermenu.UserMenuMaker;
import cn.foxtech.common.entity.service.userpermission.UserPermissionEntityService;
import cn.foxtech.common.entity.service.userpermission.UserPermissionMaker;
import cn.foxtech.common.entity.service.userrole.UserRoleEntityService;
import cn.foxtech.common.entity.service.userrole.UserRoleMaker;
import cn.foxtech.common.utils.ContainerUtils;
import java.util.List;
import java.util.Map;
public abstract class EntityServiceManager extends EntityObjectManager {
public ChannelEntity getChannelEntity(String channelName, String channelType) {
ChannelEntity entity = new ChannelEntity();
entity.setChannelName(channelName);
entity.setChannelType(channelType);
return super.getEntity(entity.makeServiceKey(), ChannelEntity.class);
}
public ChannelEntity getChannelEntity(Long id) {
return super.getEntity(id, ChannelEntity.class);
}
public List getChannelEntity(String channelType) {
return this.getEntityList(ChannelEntity.class, (Object value) -> {
ChannelEntity entity = (ChannelEntity) value;
boolean result = true;
result &= entity.getChannelType().equals(channelType);
return result;
});
}
public ConfigEntity getConfigEntity(String serviceName, String serviceType, String configName) {
ConfigEntity entity = new ConfigEntity();
entity.setServiceName(serviceName);
entity.setServiceType(serviceType);
entity.setConfigName(configName);
return super.getEntity(entity.makeServiceKey(), ConfigEntity.class);
}
public DeviceEntity getDeviceEntity(String deviceName) {
DeviceEntity entity = new DeviceEntity();
entity.setDeviceName(deviceName);
return super.getEntity(entity.makeServiceKey(), DeviceEntity.class);
}
public List selectUserMenuEntityListByPage(Map body) {
UserMenuEntityService entityService = (UserMenuEntityService) this.entityMySQLComponent.getEntityService(UserMenuEntity.class);
List poList = entityService.selectEntityListByPage(body);
List poEntityList = ContainerUtils.buildClassList(poList, BaseEntity.class);
return UserMenuMaker.makePoList2EntityList(poEntityList);
}
public List selectUserRoleEntityListByPage(Map body) {
UserRoleEntityService entityService = (UserRoleEntityService) this.entityMySQLComponent.getEntityService(UserRoleEntity.class);
List poList = entityService.selectEntityListByPage(body);
List poEntityList = ContainerUtils.buildClassList(poList, BaseEntity.class);
return UserRoleMaker.makePoList2EntityList(poEntityList);
}
public List selectUserPermissionEntityListByPage(Map body) {
UserPermissionEntityService entityService = (UserPermissionEntityService) this.entityMySQLComponent.getEntityService(UserPermissionEntity.class);
List poList = entityService.selectEntityListByPage(body);
List poEntityList = ContainerUtils.buildClassList(poList, BaseEntity.class);
return UserPermissionMaker.makePoList2EntityList(poEntityList);
}
public UserMenuEntity getUserMenuEntity(String name) {
UserMenuEntity entity = new UserMenuEntity();
entity.setName(name);
return super.getEntity(entity.makeServiceKey(), UserMenuEntity.class);
}
public UserRoleEntity getUserRoleEntity(String name) {
UserRoleEntity entity = new UserRoleEntity();
entity.setName(name);
return super.getEntity(entity.makeServiceKey(), UserRoleEntity.class);
}
public UserPermissionEntity getUserPermissionEntity(String name) {
UserPermissionEntity entity = new UserPermissionEntity();
entity.setName(name);
return super.getEntity(entity.makeServiceKey(), UserPermissionEntity.class);
}
public UserEntity getUserEntity(String username) {
UserEntity entity = new UserEntity();
entity.setUsername(username);
return super.getEntity(entity.makeServiceKey(), UserEntity.class);
}
public List getEntityList(Class clazz, IBaseFinder finder) {
return this.entityRedisComponent.getEntityList(clazz, finder);
}
public T getEntity(Class clazz, IBaseFinder finder) {
return (T) this.entityRedisComponent.getEntity(clazz, finder);
}
public int getEntityCount(Class clazz, IBaseFinder finder) {
return this.entityRedisComponent.getEntityCount(clazz, finder);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy