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";
}
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;
}
Aggregations