Search in sources :

Example 1 with RoleVo

use of com.ngtesting.platform.vo.RoleVo in project ngtesting-platform by aaronchen2k.

the class SysRoleServiceImpl method genVos.

@Override
public List<RoleVo> genVos(List<SysRole> pos) {
    List<RoleVo> vos = new LinkedList<RoleVo>();
    for (SysRole po : pos) {
        RoleVo vo = genVo(po);
        vos.add(vo);
    }
    return vos;
}
Also used : RoleVo(com.ngtesting.platform.vo.RoleVo) SysRole(com.ngtesting.platform.entity.SysRole) LinkedList(java.util.LinkedList)

Example 2 with RoleVo

use of com.ngtesting.platform.vo.RoleVo in project ngtesting-platform by aaronchen2k.

the class SysRoleAction method get.

@AuthPassport(validate = true)
@RequestMapping(value = "get", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> get(HttpServletRequest request, @RequestBody JSONObject req) {
    Map<String, Object> ret = new HashMap<String, Object>();
    String accountId = req.getString("id");
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    SysRole po = (SysRole) roleService.get(SysRole.class, Long.valueOf(accountId));
    RoleVo vo = roleService.genVo(po);
    ret.put("data", vo);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : RoleVo(com.ngtesting.platform.vo.RoleVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) SysRole(com.ngtesting.platform.entity.SysRole) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 3 with RoleVo

use of com.ngtesting.platform.vo.RoleVo in project ngtesting-platform by aaronchen2k.

the class SysRoleAction method list.

@AuthPassport(validate = true)
@RequestMapping(value = "list", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> list(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long orgId = json.getLong("orgId");
    String keywords = json.getString("keywords");
    String disabled = json.getString("disabled");
    int page = json.getInteger("page") == null ? 0 : json.getInteger("page") - 1;
    int pageSize = json.getInteger("pageSize") == null ? Constant.PAGE_SIZE : json.getInteger("pageSize");
    Page pageData = roleService.listByPage(orgId, keywords, disabled, page, pageSize);
    List<RoleVo> vos = roleService.genVos(pageData.getItems());
    ret.put("collectionSize", pageData.getTotal());
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : RoleVo(com.ngtesting.platform.vo.RoleVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) Page(com.ngtesting.platform.vo.Page) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 4 with RoleVo

use of com.ngtesting.platform.vo.RoleVo in project ngtesting-platform by aaronchen2k.

the class SysRoleAction method save.

@AuthPassport(validate = true)
@RequestMapping(value = "save", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> save(HttpServletRequest request, @RequestBody JSONObject json) {
    Map<String, Object> ret = new HashMap<String, Object>();
    UserVo userVo = (UserVo) request.getSession().getAttribute(Constant.HTTP_SESSION_USER_KEY);
    Long orgId = userVo.getDefaultOrgId();
    RoleVo vo = json.getObject("role", RoleVo.class);
    SysRole po = roleService.save(vo, orgId);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : RoleVo(com.ngtesting.platform.vo.RoleVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) SysRole(com.ngtesting.platform.entity.SysRole) JSONObject(com.alibaba.fastjson.JSONObject) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with RoleVo

use of com.ngtesting.platform.vo.RoleVo in project ngtesting-platform by aaronchen2k.

the class SysRoleServiceImpl method genVo.

@Override
public RoleVo genVo(SysRole role) {
    RoleVo vo = new RoleVo();
    BeanUtilEx.copyProperties(vo, role);
    return vo;
}
Also used : RoleVo(com.ngtesting.platform.vo.RoleVo)

Aggregations

RoleVo (com.ngtesting.platform.vo.RoleVo)5 JSONObject (com.alibaba.fastjson.JSONObject)3 SysRole (com.ngtesting.platform.entity.SysRole)3 AuthPassport (com.ngtesting.platform.util.AuthPassport)3 UserVo (com.ngtesting.platform.vo.UserVo)3 HashMap (java.util.HashMap)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 Page (com.ngtesting.platform.vo.Page)1 LinkedList (java.util.LinkedList)1