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 OrgUserDefUnitRedis {
|
private static final String NAME = "OrgUserDefUnit:";
|
|
@Autowired
|
private RedisUtils redisUtils;
|
|
public void saveOrUpdate(OrgUnit unit, Long userid) {
|
if (unit == null) {
|
return;
|
}
|
|
String id = NAME + userid;
|
redisUtils.set(id, unit);
|
}
|
|
public void delete(Long userid) {
|
redisUtils.delete(NAME + userid);
|
}
|
|
public OrgUnit get(Object key) {
|
return redisUtils.get(NAME + key, OrgUnit.class);
|
}
|
}
|