| 21 | import java.util.List; |
| 22 | |
| 23 | @Service |
| 24 | public class SysRoleService implements BaseService<TsysRole, TsysRoleExample> { |
| 25 | //角色mapper |
| 26 | @Autowired |
| 27 | private TsysRoleMapper tsysRoleMapper; |
| 28 | //自定义角色dao |
| 29 | @Autowired |
| 30 | private RoleDao roleDao; |
| 31 | //自动生成的权限角色映射mapper |
| 32 | @Autowired |
| 33 | private TsysPermissionRoleMapper tsysPermissionRoleMapper; |
| 34 | |
| 35 | |
| 36 | /** |
| 37 | * 分页查询 |
| 38 | * @param pageNum |
| 39 | * @param pageSize |
| 40 | * @return |
| 41 | */ |
| 42 | public PageInfo<TsysRole> list(Tablepar tablepar){ |
| 43 | TsysRoleExample testExample=new TsysRoleExample(); |
| 44 | testExample.setOrderByClause("id+0 DESC"); |
| 45 | if(tablepar.getSearchText()!=null&&!"".equals(tablepar.getSearchText())){ |
| 46 | testExample.createCriteria().andNameLike("%"+tablepar.getSearchText()+"%"); |
| 47 | } |
| 48 | |
| 49 | PageHelper.startPage(tablepar.getPage(), tablepar.getLimit()); |
| 50 | List<TsysRole> list= tsysRoleMapper.selectByExample(testExample); |
| 51 | PageInfo<TsysRole> pageInfo = new PageInfo<TsysRole>(list); |
| 52 | return pageInfo; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * 查询全部角色集合 |
| 57 | * @return |
| 58 | */ |
| 59 | public List<TsysRole> queryList(){ |
| 60 | TsysRoleExample tsysRoleExample=new TsysRoleExample(); |
| 61 | return tsysRoleMapper.selectByExample(tsysRoleExample); |
| 62 | } |
| 63 | |
| 64 | |
| 65 | /** |
| 66 | * |
| 67 | */ |
| 68 | @Override |
| 69 | @Transactional |
| 70 | public int deleteByPrimaryKey(String ids) { |
| 71 | List<String> lista=ConvertUtil.toListStrArray(ids); |
| 72 | //先删除角色下面的所有权限 |
| 73 | TsysPermissionRoleExample permissionRoleExample=new TsysPermissionRoleExample(); |
| 74 | permissionRoleExample.createCriteria().andRoleIdIn(lista); |
| 75 | tsysPermissionRoleMapper.deleteByExample(permissionRoleExample); |
| 76 | //在删除角色 |
| 77 | TsysRoleExample example=new TsysRoleExample(); |
| 78 | example.createCriteria().andIdIn(lista); |
| 79 | return tsysRoleMapper.deleteByExample(example); |
| 80 | } |
nothing calls this directly
no outgoing calls
no test coverage detected