Search in sources :

Example 21 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class AdminServiceImpl method getProjectByAdminId.

/**
 * 根据管理员id获取管理的项目list
 *
 * @param adminId
 * @return
 */
public List<Project> getProjectByAdminId(Long adminId) {
    List<Project> projects = new ArrayList<Project>();
    Admin admin = sqlSession.selectOne("com.itrus.portal.db.AdminMapper.selectByPrimaryKey", adminId);
    if (null != projects && StringUtils.isNotBlank(admin.getProjects())) {
        String[] projectIds = admin.getProjects().split(",");
        Long[] projectIdsLong = new Long[projectIds.length];
        for (int i = 0; i < projectIds.length; i++) {
            if ("0".equals(projectIds[i])) {
                // 返回所有项目id
                List<Long> allProject = sqlSession.selectList("com.itrus.portal.db.ProjectMapper.selectAllProjectIds");
                projectIdsLong = new Long[allProject.size()];
                for (int j = 0; j < allProject.size(); j++) {
                    projectIdsLong[j] = allProject.get(j);
                }
                break;
            }
            projectIdsLong[i] = Long.parseLong(projectIds[i]);
        }
        ProjectExample projectExample = new ProjectExample();
        ProjectExample.Criteria criteria = projectExample.or();
        criteria.andIdIn(Arrays.asList(projectIdsLong));
        projects = sqlSession.selectList("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample);
    }
    return projects;
}
Also used : Project(com.itrus.portal.db.Project) ProjectExample(com.itrus.portal.db.ProjectExample) ArrayList(java.util.ArrayList) Admin(com.itrus.portal.db.Admin)

Example 22 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class ProjectServiceImpl method getProjectByName.

/**
 * 根据项目名称,获取项目
 * @param name
 * @return
 */
public Project getProjectByName(String name) {
    Project project = null;
    ProjectExample example = new ProjectExample();
    ProjectExample.Criteria criteria = example.or();
    criteria.andNameEqualTo(name);
    project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByExample", example);
    return project;
}
Also used : Project(com.itrus.portal.db.Project) ProjectExample(com.itrus.portal.db.ProjectExample)

Example 23 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class OnlineServiceImpl method selectProject.

/*
	   *得到所有的项目   
       */
public Map<Long, Project> selectProject() {
    ProjectExample projectex = new ProjectExample();
    Map<Long, Project> projectexs = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectex, "id");
    return projectexs;
}
Also used : Project(com.itrus.portal.db.Project) ProjectExample(com.itrus.portal.db.ProjectExample)

Example 24 with ProjectExample

use of com.itrus.portal.db.ProjectExample in project portal by ixinportal.

the class PersonalBillServiceImpl method getProjectMapByBills.

/**
 * 根据订单list查找出对应的projectMap
 *
 * @param bills
 * @return
 */
public Map<Long, Project> getProjectMapByBills(List<PersonalBill> bills) {
    Map<Long, Project> projectMap = new HashMap<Long, Project>();
    List<Long> projectIds = new ArrayList<Long>();
    for (PersonalBill bill : bills) {
        projectIds.add(bill.getProject());
    }
    if (!projectIds.isEmpty()) {
        ProjectExample projectExample = new ProjectExample();
        ProjectExample.Criteria criteria = projectExample.or();
        criteria.andIdIn(projectIds);
        projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", projectExample, "id");
    }
    return projectMap;
}
Also used : Project(com.itrus.portal.db.Project) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample) ArrayList(java.util.ArrayList)

Aggregations

ProjectExample (com.itrus.portal.db.ProjectExample)24 Project (com.itrus.portal.db.Project)16 HashMap (java.util.HashMap)13 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)13 ArrayList (java.util.ArrayList)11 List (java.util.List)8 Map (java.util.Map)7 Admin (com.itrus.portal.db.Admin)4 CustomerService (com.itrus.portal.db.CustomerService)3 CustomerServiceExample (com.itrus.portal.db.CustomerServiceExample)3 EnterpriseQq (com.itrus.portal.db.EnterpriseQq)3 EnterpriseQqExample (com.itrus.portal.db.EnterpriseQqExample)3 JSONObject (com.alibaba.fastjson.JSONObject)2 AdminExample (com.itrus.portal.db.AdminExample)2 FileConfig (com.itrus.portal.db.FileConfig)2 FileConfigExample (com.itrus.portal.db.FileConfigExample)2 Calendar (java.util.Calendar)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 Bill (com.itrus.portal.db.Bill)1 ProjectKeyInfo (com.itrus.portal.db.ProjectKeyInfo)1