package com.landtool.lanbase.modules.org.redis;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import com.landtool.lanbase.common.utils.RedisUtils;
|
import com.landtool.lanbase.modules.org.entity.OrgUnit;
|
|
@Component
|
public class OrgUnitRedis {
|
private static final String NAME="OrgUnit:";
|
|
@Autowired
|
private RedisUtils redisUtils;
|
|
public void saveOrUpdate(OrgUnit unit) {
|
if(unit==null){
|
return ;
|
}
|
|
String id=NAME+unit.getUnitid();
|
redisUtils.set(id, unit);
|
|
String username=NAME+unit.getUnidcode();
|
redisUtils.set(username, unit);
|
}
|
|
public void delete(OrgUnit unit) {
|
if(unit==null){
|
return ;
|
}
|
|
redisUtils.delete(NAME+unit.getUnitid());
|
redisUtils.delete(NAME+unit.getUnidcode());
|
}
|
|
public OrgUnit get(Object key){
|
return redisUtils.get(NAME+key, OrgUnit.class);
|
}
|
}
|