Search in sources :

Example 1 with CustomFieldOptionVo

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

the class CustomFieldOptionServiceImpl method genVos.

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

Example 2 with CustomFieldOptionVo

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

the class CustomFieldOptionServiceImpl method genVo.

@Override
public CustomFieldOptionVo genVo(TestCustomFieldOption po) {
    CustomFieldOptionVo vo = new CustomFieldOptionVo();
    BeanUtilEx.copyProperties(vo, po);
    return vo;
}
Also used : CustomFieldOptionVo(com.ngtesting.platform.vo.CustomFieldOptionVo)

Example 3 with CustomFieldOptionVo

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

the class CustomFieldOptionAction method changeOrder.

@AuthPassport(validate = true)
@RequestMapping(value = "changeOrder", method = RequestMethod.POST)
@ResponseBody
public Map<String, Object> changeOrder(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 fieldId = json.getLong("fieldId");
    Long id = json.getLong("id");
    String act = json.getString("act");
    boolean success = customFieldOptionService.changeOrderPers(id, act, fieldId);
    List<CustomFieldOptionVo> vos = customFieldOptionService.listVos(fieldId);
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : CustomFieldOptionVo(com.ngtesting.platform.vo.CustomFieldOptionVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) 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 4 with CustomFieldOptionVo

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

the class CustomFieldOptionAction 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);
    CustomFieldOptionVo option = JSON.parseObject(JSON.toJSONString(json.getJSONObject("model")), CustomFieldOptionVo.class);
    TestCustomFieldOption po = customFieldOptionService.save(option);
    List<CustomFieldOptionVo> vos = customFieldOptionService.listVos(po.getFieldId());
    ret.put("data", vos);
    ret.put("code", Constant.RespCode.SUCCESS.getCode());
    return ret;
}
Also used : CustomFieldOptionVo(com.ngtesting.platform.vo.CustomFieldOptionVo) UserVo(com.ngtesting.platform.vo.UserVo) HashMap(java.util.HashMap) JSONObject(com.alibaba.fastjson.JSONObject) TestCustomFieldOption(com.ngtesting.platform.entity.TestCustomFieldOption) AuthPassport(com.ngtesting.platform.util.AuthPassport) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 5 with CustomFieldOptionVo

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

the class CustomFieldOptionServiceImpl method listVos.

@Override
public List<CustomFieldOptionVo> listVos(Long fieldId) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestCustomFieldOption.class);
    dc.add(Restrictions.eq("fieldId", fieldId));
    dc.add(Restrictions.eq("disabled", Boolean.FALSE));
    dc.add(Restrictions.eq("deleted", Boolean.FALSE));
    dc.addOrder(Order.asc("ordr"));
    List ls = findAllByCriteria(dc);
    List<CustomFieldOptionVo> vos = genVos(ls);
    return vos;
}
Also used : CustomFieldOptionVo(com.ngtesting.platform.vo.CustomFieldOptionVo) DetachedCriteria(org.hibernate.criterion.DetachedCriteria) List(java.util.List) LinkedList(java.util.LinkedList)

Aggregations

CustomFieldOptionVo (com.ngtesting.platform.vo.CustomFieldOptionVo)5 JSONObject (com.alibaba.fastjson.JSONObject)2 TestCustomFieldOption (com.ngtesting.platform.entity.TestCustomFieldOption)2 AuthPassport (com.ngtesting.platform.util.AuthPassport)2 UserVo (com.ngtesting.platform.vo.UserVo)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 List (java.util.List)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1