3
13693261870
2022-09-16 63ba114e70e380442fcbed4a5157ee52c9491216
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package com.landtool.lanbase.modules.sys.service.impl;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.function.Consumer;
 
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import com.landtool.lanbase.modules.org.entity.OrgUser;
import com.landtool.lanbase.modules.sys.dao.RoleResCatalogMapper;
import com.landtool.lanbase.modules.sys.entity.Role_ResCatalog;
import com.landtool.lanbase.modules.sys.service.RoleResCatalogService;
@Service("RoleResCatalogService")
public class RoleResCatalogServiceImpl implements RoleResCatalogService {
 
    @Autowired
    RoleResCatalogMapper mapper;
    @Override
    public boolean insertRoleResCatalogRel(Role_ResCatalog bean) {
        Integer count=mapper.insertRoleResCatalogRel(bean);
        return count>0?true:false;
    }
 
    @Override
    public List<Role_ResCatalog> queryRoleResCatalogRel(Role_ResCatalog bean) {
         
        return     mapper.queryRoleResCatalogRel(bean);
    }
 
    @Override
    public boolean updateRoleResCatalogRel(Role_ResCatalog bean) {
        
        Integer count=mapper.updateRoleResCatalogRel(bean);
        return count>0?true:false;
    }
 
    @Override
    public void saveBatch(Long roleid, List<Long> list) {
   OrgUser user=(OrgUser) SecurityUtils.getSubject().getPrincipal();
      Long userid=user.getUserid();
      List<Role_ResCatalog> rolecatalogrel=new ArrayList<>();
    list.forEach(new Consumer<Long>() {
 
        @Override
        public void accept(Long arg0) {
            Role_ResCatalog rt=new Role_ResCatalog();
            rt.setCatalogid(arg0);
            rt.setAdduserid(userid);
            rt.setStatus(1);//0:已删除    1:正常
            rt.setRoleid(roleid);
            rt.setCreatetime(new Date());
            rolecatalogrel.add(rt);
            mapper.insertRoleResCatalogRel(rt);
        }
        
    });
    
    
    }
 
    @Override
    public void deleteBatch(Long roleId) {
        mapper.deleteBatch(roleId);
        
    }
 
    @Override
    public void deleteBatchByRoleIds(Long[] roleIds) {
        mapper.deleteBatchByRoleIds(roleIds);
    }
 
}