Search in sources :

Example 1 with R

use of com.artlongs.framework.vo.R in project act-eagle-allone by mailtous.

the class SysUserController method assignPerm.

/**
 * 保存---分配角色
 * @param funcId
 * @param roleAssignVoList
 * @return
 */
@PostAction("assign/role/{userId}")
public RenderJSON assignPerm(Long userId, List<RoleAssignVo> roleAssignVoList) {
    SysUser sysUser = sysUserService.get(userId);
    if (null == sysUser)
        return json(R.fail("用户不存在。"));
    R r = sysUserService.assignRole(roleAssignVoList, sysUser);
    return json(r);
}
Also used : R(com.artlongs.framework.vo.R) SysUser(com.artlongs.sys.model.SysUser) PostAction(org.osgl.mvc.annotation.PostAction)

Example 2 with R

use of com.artlongs.framework.vo.R in project act-eagle-allone by mailtous.

the class SysUserService method createNewUser.

/**
 * 创建新用户,密码加密过
 * @param sysUser
 * @return
 */
public R createNewUser(SysUser sysUser) {
    R vo = new R<>();
    SysUser dbUser = getByName(sysUser.getUserName());
    if (null == dbUser) {
        // 对前端输入的明文密码,进行加密
        sysUser.setEncodePwd(sysUser.getPwd());
        sysUser.setCreateDate(new Date());
        sysUser.setModifyDate(new Date());
        sysUser.setDelStatus(SysUser.UN_DEL);
        int r = sysUserDao.save(sysUser);
        vo = r > 0 ? vo.setSuccess("用户创建成功!") : vo.setFail("用户创建失败!");
    } else {
        vo.setFail("用户已经存在!");
    }
    return vo;
}
Also used : R(com.artlongs.framework.vo.R) SysUser(com.artlongs.sys.model.SysUser) Date(java.util.Date)

Example 3 with R

use of com.artlongs.framework.vo.R in project act-eagle-allone by mailtous.

the class SysFuncController method assignPerm.

/**
 * 保存--权限分配
 * @param funcId
 * @param roleAssignVoList
 * @return
 */
@PostAction("assign/perm/{funcId}")
public RenderJSON assignPerm(Long funcId, List<RoleAssignVo> roleAssignVoList) {
    SysFunc sysFunc = sysFuncService.get(new Long(funcId));
    if (null == sysFunc)
        return json(R.fail("功能或菜单不存在。"));
    R r = sysPermissionService.savePermissionOfAssign(roleAssignVoList);
    return json(r);
}
Also used : R(com.artlongs.framework.vo.R) SysFunc(com.artlongs.sys.model.SysFunc) PostAction(org.osgl.mvc.annotation.PostAction)

Example 4 with R

use of com.artlongs.framework.vo.R in project act-eagle-allone by mailtous.

the class SysLoginController method loginPost.

@PostAction("post")
public RenderAny loginPost(String userName, String pwd, H.Session session, H.Response response) {
    R vo = loginCheck(userName, pwd, session, response);
    if (vo.isSucc()) {
        to("/sys/home");
    }
    ctx.renderArg("loginMsg", vo.getMsg());
    return render("login.html");
}
Also used : R(com.artlongs.framework.vo.R) PostAction(org.osgl.mvc.annotation.PostAction)

Example 5 with R

use of com.artlongs.framework.vo.R in project act-eagle-allone by mailtous.

the class SysUserService method checkLogin.

public R checkLogin(String userName, String pwd) {
    R r = new R();
    SysUser sysUser = sysUserDao.checkLogin(userName, pwd);
    r.setItem(sysUser);
    return null != sysUser ? r.setSuccess("登录成功。") : r.setFail("用户名或密码错误!");
}
Also used : R(com.artlongs.framework.vo.R) SysUser(com.artlongs.sys.model.SysUser)

Aggregations

R (com.artlongs.framework.vo.R)5 SysUser (com.artlongs.sys.model.SysUser)3 PostAction (org.osgl.mvc.annotation.PostAction)3 SysFunc (com.artlongs.sys.model.SysFunc)1 Date (java.util.Date)1