Search in sources :

Example 1 with TestProject

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

the class ProjectServiceImpl method genGroupVos.

@Override
public List<TestProjectVo> genGroupVos(List<TestProject> pos) {
    List<TestProjectVo> voList = new LinkedList<TestProjectVo>();
    for (TestProject po : pos) {
        TestProjectVo vo = genVo(po);
        voList.add(vo);
    }
    return voList;
}
Also used : TestProjectVo(com.ngtesting.platform.vo.TestProjectVo) TestProject(com.ngtesting.platform.entity.TestProject) LinkedList(java.util.LinkedList)

Example 2 with TestProject

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

the class ProjectServiceImpl method delete.

@Override
public Boolean delete(Long id) {
    if (id == null) {
        return null;
    }
    TestProject po = (TestProject) get(TestProject.class, id);
    po.setDeleted(true);
    saveOrUpdate(po);
    // 项目组被删除,删除子项目
    if (po.getType().equals(ProjectType.group)) {
        for (TestProject child : po.getChildren()) {
            child.setDeleted(true);
            saveOrUpdate(child);
        }
    }
    return true;
}
Also used : TestProject(com.ngtesting.platform.entity.TestProject)

Example 3 with TestProject

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

the class BaseDaoImpl method moveNode.

@Override
public Integer moveNode(String nodeTable, Long nodeId, Long newParentId) {
    Query query = this.getSession().createSQLQuery("CALL move_node(:node_table, :project_id, :parent_id)").addEntity(TestProject.class).setParameter("node_table", nodeTable).setParameter("project_id", nodeId).setParameter("parent_id", newParentId);
    TestProject projec = (TestProject) query.uniqueResult();
    return 1;
}
Also used : Query(org.hibernate.Query) TestProject(com.ngtesting.platform.entity.TestProject)

Example 4 with TestProject

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

the class BaseDaoImpl method updateNode.

@Override
public Integer updateNode(String nodeTable, Long nodeId, String statusName, String statusValue) {
    Query query = this.getSession().createSQLQuery("CALL update_node(:node_table, :node_id, :status_name, :status_value)").addEntity(TestProject.class).setParameter("node_table", nodeTable).setParameter("node_id", nodeId).setParameter("status_name", statusName).setParameter("status_value", statusValue);
    TestProject projec = (TestProject) query.uniqueResult();
    return 1;
}
Also used : Query(org.hibernate.Query) TestProject(com.ngtesting.platform.entity.TestProject)

Example 5 with TestProject

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

the class CustomFieldServiceImpl method saveRelationsProjects.

@Override
public boolean saveRelationsProjects(Long fieldId, List<TestProjectVo> projects) {
    if (projects == null) {
        return false;
    }
    TestCustomField field = (TestCustomField) get(TestCustomField.class, fieldId);
    Set<TestProject> projectSet = field.getProjectSet();
    for (Object obj : projects) {
        TestProjectVo vo = JSON.parseObject(JSON.toJSONString(obj), TestProjectVo.class);
        if (vo.getSelecting() != vo.getSelected()) {
            // 变化了
            TestProject project = (TestProject) get(TestProject.class, vo.getId());
            if (vo.getSelecting() && !projectSet.contains(project)) {
                // 勾选
                projectSet.add(project);
            } else if (project != null) {
                // 取消
                projectSet.remove(project);
            }
        }
    }
    saveOrUpdate(field);
    return true;
}
Also used : TestProject(com.ngtesting.platform.entity.TestProject) TestProjectVo(com.ngtesting.platform.vo.TestProjectVo) TestCustomField(com.ngtesting.platform.entity.TestCustomField)

Aggregations

TestProject (com.ngtesting.platform.entity.TestProject)17 TestProjectVo (com.ngtesting.platform.vo.TestProjectVo)6 JSONObject (com.alibaba.fastjson.JSONObject)4 AuthPassport (com.ngtesting.platform.util.AuthPassport)4 HashMap (java.util.HashMap)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)4 TestCustomField (com.ngtesting.platform.entity.TestCustomField)3 LinkedList (java.util.LinkedList)3 TestRelationProjectRoleEntity (com.ngtesting.platform.entity.TestRelationProjectRoleEntity)2 Query (org.hibernate.Query)2 DetachedCriteria (org.hibernate.criterion.DetachedCriteria)2 TestUser (com.ngtesting.platform.entity.TestUser)1 UserVo (com.ngtesting.platform.vo.UserVo)1 List (java.util.List)1 Filter (org.hibernate.Filter)1