2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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);
    }
}