use of com.bc.pmpheep.back.po.WriterRole in project pmph by BCSquad.
the class WriterRoleServiceTest method testAddUserRole.
@Test
@Rollback(Const.ISROLLBACK)
public void testAddUserRole() {
WriterRole writerRole = this.addWriterRole();
int num = -1;
num = writerRoleService.addUserRole(writerRole.getId(), writerRole.getId());
Assert.assertNotNull("是否添加成功", num >= 0);
}
use of com.bc.pmpheep.back.po.WriterRole in project pmph by BCSquad.
the class MigrationStageTwo method writerRole.
protected void writerRole() {
String tableName = "sys_role";
// 增加new_pk字段
JdbcHelper.addColumn(tableName);
List<Map<String, Object>> maps = JdbcHelper.queryForList(tableName);
List<Map<String, Object>> excel = new LinkedList<>();
int count = 0;
for (Map<String, Object> map : maps) {
Double roleId = (Double) map.get("roleid");
String rolename = (String) map.get("rolename");
Integer isDisabled = (Integer) map.get("isvalid");
Integer sort = (Integer) map.get("sortno");
if (ObjectUtil.notNull(sort) && sort < 0) {
sort = 999;
}
String note = (String) map.get("memo");
WriterRole writerRole = new WriterRole();
writerRole.setRoleName(rolename);
writerRole.setIsDisabled(isDisabled != 1);
writerRole.setSort(sort);
writerRole.setNote(note);
writerRole = writerRoleService.add(writerRole);
count++;
Long pk = writerRole.getId();
JdbcHelper.updateNewPrimaryKey(tableName, pk, "roleid", roleId);
}
if (excel.size() > 0) {
try {
excelHelper.exportFromMaps(excel, "作家角色表", "writer_role");
} catch (IOException ex) {
logger.error("异常数据导出到Excel失败", ex);
}
}
logger.info("writer_role表迁移完成");
logger.info("原数据库表共有{}条数据,迁移了{}条数据", maps.size(), count);
// 记录信息
Map<String, Object> msg = new HashMap<String, Object>();
msg.put("result", "writer_role表迁移完成" + count + "/" + maps.size());
SQLParameters.STATISTICS.add(msg);
}
use of com.bc.pmpheep.back.po.WriterRole in project pmph by BCSquad.
the class WriterRoleServiceTest method testAdd.
@Test
@Rollback(Const.ISROLLBACK)
public void testAdd() {
WriterRole writerRole = this.addWriterRole();
Assert.assertNotNull("是否添加成功", writerRole.getId());
}
use of com.bc.pmpheep.back.po.WriterRole in project pmph by BCSquad.
the class WriterRoleServiceTest method testDeleteRoleAndResource.
@Test
@Rollback(Const.ISROLLBACK)
public void testDeleteRoleAndResource() {
WriterRole writerRole = this.addWriterRole();
List<Long> ids = new ArrayList<>();
int num = 0;
ids.add(writerRole.getId());
writerRoleService.addRoleResource(writerRole.getId(), ids);
num = writerRoleService.deleteRoleAndResource(ids);
Assert.assertTrue("删除失败", num > 0 ? true : false);
}
use of com.bc.pmpheep.back.po.WriterRole in project pmph by BCSquad.
the class WriterUserServiceTest method testGetListsTest.
/**
* 查询
*/
@Test
@Rollback(Const.ISROLLBACK)
public void testGetListsTest() {
WriterUser writerUser = this.addWriterUser();
// WriterUser wtUser;
// List<WriterUser> pmUsers;
// List<WriterPermission> listPermissions;
// wtUser = writerUserService.login("test1", "123");
List<WriterRole> pr = writerUserService.getListUserRole(writerUser.getId());
Assert.assertNotNull("获取失败", pr);
}
Aggregations