Search in sources :

Example 1 with TestMsg

use of com.ngtesting.platform.entity.TestMsg in project ngtesting-platform by aaronchen2k.

the class MsgServiceImpl method create.

@Override
public TestMsg create(TestRun run, Constant.MsgType action, UserVo optUser) {
    TestMsg msg = new TestMsg();
    msg.setName("用户" + StringUtil.highlightDict(optUser.getName()) + action.msg + "测试集" + StringUtil.highlightDict(run.getName()));
    msg.setDescr(run.getDescr());
    msg.setUserId(run.getUserId());
    msg.setOptUserId(optUser.getId());
    saveOrUpdate(msg);
    return msg;
}
Also used : TestMsg(com.ngtesting.platform.entity.TestMsg)

Example 2 with TestMsg

use of com.ngtesting.platform.entity.TestMsg in project ngtesting-platform by aaronchen2k.

the class MsgServiceImpl method getById.

@Override
public TestMsgVo getById(Long id) {
    TestMsg po = (TestMsg) get(TestMsg.class, id);
    TestMsgVo vo = genVo(po);
    return vo;
}
Also used : TestMsg(com.ngtesting.platform.entity.TestMsg) TestMsgVo(com.ngtesting.platform.vo.TestMsgVo)

Example 3 with TestMsg

use of com.ngtesting.platform.entity.TestMsg in project ngtesting-platform by aaronchen2k.

the class MsgServiceImpl method list.

@Override
public List<TestMsgVo> list(Long userId, Boolean isRead) {
    DetachedCriteria dc = DetachedCriteria.forClass(TestMsg.class);
    dc.add(Restrictions.eq("userId", userId));
    if (isRead != null) {
        dc.add(Restrictions.eq("isRead", isRead));
    }
    dc.add(Restrictions.eq("deleted", Boolean.FALSE));
    dc.add(Restrictions.eq("disabled", Boolean.FALSE));
    dc.addOrder(Order.desc("createTime"));
    List<TestMsg> pos = findAllByCriteria(dc);
    List<TestMsgVo> vos = genVos(pos);
    return vos;
}
Also used : TestMsg(com.ngtesting.platform.entity.TestMsg) TestMsgVo(com.ngtesting.platform.vo.TestMsgVo) DetachedCriteria(org.hibernate.criterion.DetachedCriteria)

Example 4 with TestMsg

use of com.ngtesting.platform.entity.TestMsg in project ngtesting-platform by aaronchen2k.

the class MsgServiceImpl method delete.

@Override
public void delete(Long msgId, Long userId) {
    TestMsg po = (TestMsg) get(TestMsg.class, msgId);
    po.setDeleted(true);
    saveOrUpdate(po);
}
Also used : TestMsg(com.ngtesting.platform.entity.TestMsg)

Example 5 with TestMsg

use of com.ngtesting.platform.entity.TestMsg in project ngtesting-platform by aaronchen2k.

the class MsgServiceImpl method genVos.

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

Aggregations

TestMsg (com.ngtesting.platform.entity.TestMsg)7 TestMsgVo (com.ngtesting.platform.vo.TestMsgVo)4 JSONObject (com.alibaba.fastjson.JSONObject)1 AuthPassport (com.ngtesting.platform.util.AuthPassport)1 UserVo (com.ngtesting.platform.vo.UserVo)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1