RoleService.java
2.13 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package com.fh.service.system.role.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.fh.dao.DaoSupport;
import com.fh.entity.system.Role;
import com.fh.service.system.role.RoleManager;
import com.fh.util.PageData;
@Service("roleService")
public class RoleService implements RoleManager{
@Resource(name = "daoSupport")
private DaoSupport dao;
/**列出此组下级角色
* @param pd
* @return
* @throws Exception
*/
@SuppressWarnings("unchecked")
public List<Role> listAllRolesByPId(PageData pd) throws Exception {
return (List<Role>) dao.findForList("RoleMapper.listAllRolesByPId", pd);
}
/**通过id查找
* @param pd
* @return
* @throws Exception
*/
public PageData findObjectById(PageData pd) throws Exception {
return (PageData)dao.findForObject("RoleMapper.findObjectById", pd);
}
/**添加
* @param pd
* @throws Exception
*/
public void add(PageData pd) throws Exception {
dao.save("RoleMapper.insert", pd);
}
/**保存修改
* @param pd
* @throws Exception
*/
public void edit(PageData pd) throws Exception {
dao.update("RoleMapper.edit", pd);
}
/**删除角色
* @param ROLE_ID
* @throws Exception
*/
public void deleteRoleById(String ROLE_ID) throws Exception {
dao.delete("RoleMapper.deleteRoleById", ROLE_ID);
}
/**给当前角色附加菜单权限
* @param role
* @throws Exception
*/
public void updateRoleRights(Role role) throws Exception {
dao.update("RoleMapper.updateRoleRights", role);
}
/**通过id查找
* @param roleId
* @return
* @throws Exception
*/
public Role getRoleById(String ROLE_ID) throws Exception {
return (Role) dao.findForObject("RoleMapper.getRoleById", ROLE_ID);
}
/**给全部子角色加菜单权限
* @param pd
* @throws Exception
*/
public void setAllRights(PageData pd) throws Exception {
dao.update("RoleMapper.setAllRights", pd);
}
/**权限(增删改查)
* @param msg 区分增删改查
* @param pd
* @throws Exception
*/
public void saveB4Button(String msg,PageData pd) throws Exception {
dao.update("RoleMapper."+msg, pd);
}
}