Search in sources :

Example 6 with Role

use of com.ibeiliao.deployment.admin.vo.account.Role in project Corgi by kevinYin.

the class RoleServiceImpl method save.

/**
 * 保存角色数据
 *
 * @param entity
 *            角色数据
 */
private void save(Role entity) {
    validate(entity);
    Role role = getRoleByName(entity.getRoleName());
    if (role != null) {
        throw new ServiceException(ApiCode.FAILURE, "角色已存在:" + entity.getRoleName());
    } else {
        RolePO po = VOUtil.from(entity, RolePO.class);
        Date now = new Date();
        po.setOperator(AdminContext.getAccountId());
        po.setCreateTime(now);
        po.setLastModify(now);
        roleDao.save(po);
    }
    logger.info("admin#role#save | 更新角色成功 | roleName: {}, operator: {}", entity.getRoleName(), AdminContext.getAccountId());
}
Also used : Role(com.ibeiliao.deployment.admin.vo.account.Role) ServiceException(com.ibeiliao.deployment.exception.ServiceException) RolePO(com.ibeiliao.deployment.admin.po.account.RolePO) Date(java.util.Date)

Aggregations

Role (com.ibeiliao.deployment.admin.vo.account.Role)6 MenuResource (com.ibeiliao.deployment.admin.utils.resource.MenuResource)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 RolePO (com.ibeiliao.deployment.admin.po.account.RolePO)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 HashMap (java.util.HashMap)2 List (java.util.List)2 AdminLog (com.ibeiliao.deployment.admin.annotation.log.AdminLog)1 PageResult (com.ibeiliao.deployment.admin.common.PageResult)1 RestResult (com.ibeiliao.deployment.admin.common.RestResult)1 MenuItem (com.ibeiliao.deployment.admin.utils.resource.MenuItem)1 AccountRoleRelation (com.ibeiliao.deployment.admin.vo.account.AccountRoleRelation)1 AdminAccount (com.ibeiliao.deployment.admin.vo.account.AdminAccount)1 AppDefine (com.ibeiliao.deployment.admin.vo.account.AppDefine)1 RoleMenuRelation (com.ibeiliao.deployment.admin.vo.account.RoleMenuRelation)1 RoleResRelation (com.ibeiliao.deployment.admin.vo.account.RoleResRelation)1 ServiceException (com.ibeiliao.deployment.exception.ServiceException)1