use of com.bc.pmpheep.back.po.WriterRolePermission in project pmph by BCSquad.
the class WriterRolePermissionServiceTest method testAddWriterRolePermission.
@Test
@Rollback(Const.ISROLLBACK)
public void testAddWriterRolePermission() throws Exception {
WriterRolePermission writerRolePermission = this.addWriterRolePermission();
Assert.assertNotNull("addWriterRolePermission是否添加成功", writerRolePermissionService.addWriterRolePermission(writerRolePermission));
}
use of com.bc.pmpheep.back.po.WriterRolePermission in project pmph by BCSquad.
the class WriterRolePermissionServiceTest method testGetWriterRolePermissionById.
@Test
@Rollback(Const.ISROLLBACK)
public void testGetWriterRolePermissionById() {
WriterRolePermission writerRolePermission = this.addWriterRolePermission();
WriterRolePermission wrp = writerRolePermissionService.getWriterRolePermissionById(writerRolePermission.getId());
Assert.assertNotNull("获取失败", wrp);
}
use of com.bc.pmpheep.back.po.WriterRolePermission in project pmph by BCSquad.
the class WriterRolePermissionServiceTest method testDeleteWriterRolePermissionById.
@Test
@Rollback(Const.ISROLLBACK)
public void testDeleteWriterRolePermissionById() {
WriterRolePermission writerRolePermission = this.addWriterRolePermission();
Integer bInteger = writerRolePermissionService.deleteWriterRolePermissionById(writerRolePermission.getId());
Assert.assertTrue("删除成功失败", bInteger > 0 ? true : false);
}
use of com.bc.pmpheep.back.po.WriterRolePermission in project pmph by BCSquad.
the class WriterRoleServiceTest method testGetListRoleResource.
@Test
@Rollback(Const.ISROLLBACK)
public void testGetListRoleResource() {
WriterRole writerRole = this.addWriterRole();
List<WriterPermission> list = writerRoleService.getListRoleResource(writerRole.getId());
Assert.assertNotNull("是否查询成功", list);
List<WriterRolePermission> list1 = writerRoleService.getListWriterRolePermission(writerRole.getId());
Assert.assertNotNull("是否查询成功", list1);
List<Long> ids = writerRoleService.getListPmphWriterPermissionIdByRoleId(writerRole.getId());
Assert.assertNotNull("是否查询成功", ids);
}
use of com.bc.pmpheep.back.po.WriterRolePermission in project pmph by BCSquad.
the class WriterRoleServiceImpl method addRoleResource.
@Override
public Integer addRoleResource(Long roleId, List<Long> permissionIds) throws CheckedServiceException {
// 添加时先删除当前权限
deleteRoleResourceByRoleId(roleId);
if (ObjectUtil.isNull(roleId) || permissionIds.size() < 0) {
throw new CheckedServiceException(CheckedExceptionBusiness.ROLE_MANAGEMENT, CheckedExceptionResult.NULL_PARAM, "角色ID或资源ID为空时禁止新增");
}
List<WriterRolePermission> lists = new ArrayList<WriterRolePermission>();
WriterRolePermission writerRolePermission;
for (Long permissionId : permissionIds) {
writerRolePermission = new WriterRolePermission();
writerRolePermission.setRoleId(roleId);
writerRolePermission.setPermissionId(permissionId);
lists.add(writerRolePermission);
}
return roleDao.addRoleResource(lists);
}
Aggregations