Search in sources :

Example 6 with TestEnvVo

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

the class EnvAction method List.

@AuthPassport(validate = true)
@RequestMapping(value = "query", 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 projectId = json.getLong("projectId");
    List<TestEnv> ls = envService.list(projectId);
    List<TestEnvVo> vos = envService.genVos(ls);
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : UserVo(com.ngtesting.platform.vo.UserVo) TestEnv(com.ngtesting.platform.entity.TestEnv) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestEnvVo(com.ngtesting.platform.vo.TestEnvVo) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 7 with TestEnvVo

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

the class EnvServiceImpl method save.

@Override
public TestEnv save(JSONObject json, UserVo optUser) {
    Long id = json.getLong("id");
    TestEnv po;
    TestEnvVo vo = JSON.parseObject(JSON.toJSONString(json), TestEnvVo.class);
    Constant.MsgType action;
    if (id != null) {
        po = (TestEnv) get(TestEnv.class, id);
        action = Constant.MsgType.update;
    } else {
        po = new TestEnv();
        action = Constant.MsgType.create;
    }
    po.setName(vo.getName());
    po.setDescr(vo.getDescr());
    po.setProjectId(vo.getProjectId());
    saveOrUpdate(po);
    return po;
}
Also used : TestEnv(com.ngtesting.platform.entity.TestEnv) Constant(com.ngtesting.platform.config.Constant) TestEnvVo(com.ngtesting.platform.vo.TestEnvVo)

Aggregations

TestEnvVo (com.ngtesting.platform.vo.TestEnvVo)7 TestEnv (com.ngtesting.platform.entity.TestEnv)5 JSONObject (com.alibaba.fastjson.JSONObject)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 Constant (com.ngtesting.platform.config.Constant)1 LinkedList (java.util.LinkedList)1