Search in sources :

Example 1 with AppExample

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

the class AppController method list.

@RequestMapping(produces = "text/html")
public String list(Model uiModel, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, HttpSession session) {
    Map<Long, Project> projectmap = getProjectMapOfAdmin();
    if (page == null || page < 1) {
        page = 1;
    }
    if (size == null || size < 1) {
        size = 10;
    }
    AppExample appex = new AppExample();
    Integer count = sqlSession.selectOne("com.itrus.portal.db.AppMapper.countByExample", appex);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    Integer offset = size * (page - 1);
    appex.setOffset(offset);
    appex.setLimit(size);
    List<App> appList = sqlSession.selectList("com.itrus.portal.db.AppMapper.selectByExample", appex);
    uiModel.addAttribute("page", page);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    uiModel.addAttribute("projectmap", projectmap);
    uiModel.addAttribute("appList", appList);
    String delMsg = (String) session.getAttribute(APP_DEL_MSG);
    if (StringUtils.isNotBlank(delMsg)) {
        uiModel.addAttribute("message", delMsg);
        session.removeAttribute(APP_DEL_MSG);
    }
    return "apps/list";
}
Also used : App(com.itrus.portal.db.App) Project(com.itrus.portal.db.Project) AppExample(com.itrus.portal.db.AppExample) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with AppExample

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

the class AppServiceImpl method getAppList.

/**
 * 根据项目id返回应用管理和增值应用的相关信息
 * @param id
 * @param type 类型.web.app,客户端,目前是客户端,跟发布平台的值相同:{1:"web", 2:"客户端", 3:"app"}
 * @return
 */
public List<AppBean> getAppList(Long id, String type) throws Exception {
    // 查询当前项目下的应用信息
    List<AppBean> appBeanList = new ArrayList<>();
    List<ExtraProduct> extraProductList = null;
    AppExample appExample = new AppExample();
    AppExample.Criteria ac = appExample.createCriteria();
    ac.andProjectEqualTo(id);
    if ("1".equals(type)) {
        ac.andPcEqualTo(true);
    } else if (("2".equals(type))) {
        ac.andWindowsEqualTo(true);
    } else if (("3".equals(type))) {
        // TODO 未区分app 默认为安卓
        ac.andAndroidEqualTo(true);
    }
    List<App> appList = sqlSession.selectList("com.itrus.portal.db.AppMapper.selectByExample", appExample);
    // 查询当前项目下增值应用信息
    List<ExtraProductRelease> extraProductReleases = extraProductReleaseService.getByprojectAndType(id, type);
    // 增值应用集合
    if (extraProductReleases != null) {
        extraProductList = extraProductService.getproductByEPR(extraProductReleases);
    }
    if (appList != null) {
        for (App app : appList) {
            AppBean appBean = new AppBean();
            appBean.setType("1");
            appBean.setName(app.getName());
            appBean.setAppId(app.getId());
            appBean.setUrl(app.getAppUrl());
            appBean.setOpenType(app.getOpenType());
            appBean.setShortName(app.getShortName());
            appBeanList.add(appBean);
        }
    }
    // }
    return appBeanList;
}
Also used : App(com.itrus.portal.db.App) ExtraProduct(com.itrus.portal.db.ExtraProduct) ExtraProductRelease(com.itrus.portal.db.ExtraProductRelease) ArrayList(java.util.ArrayList) AppBean(com.itrus.portal.entity.AppBean) AppExample(com.itrus.portal.db.AppExample)

Aggregations

App (com.itrus.portal.db.App)2 AppExample (com.itrus.portal.db.AppExample)2 ExtraProduct (com.itrus.portal.db.ExtraProduct)1 ExtraProductRelease (com.itrus.portal.db.ExtraProductRelease)1 Project (com.itrus.portal.db.Project)1 AppBean (com.itrus.portal.entity.AppBean)1 ArrayList (java.util.ArrayList)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1