@Override protected Resultable querySelectionsResult( QueryFactory queryFactory, int rows, int page, String[] selections, Order order) { EntityQueryable query = queryFactory .createEntityQuery(EnterpriseBasic.class) .setPage(page) .setRow(rows) .orderDesc("id"); query.eq("channelId", getChannelId()); if (!EwcmsContextUtil.getGroupnames().contains("GROUP_ADMIN")) { Organ organ = particularFac.findOrganByUserName(); if (organ == null) { query.eq("organ.id", null); } else { query.eq("organ.id", organ.getId()); } } List<Long> ids = getIds(Long.class); query.in("id", ids); return query.queryResult(); }
@Override protected Resultable queryResult( QueryFactory queryFactory, String cacheKey, int rows, int page, Order order) { EntityQueryable query = queryFactory .createEntityQuery(EnterpriseBasic.class) .setPage(page) .setRow(rows) .orderDesc("id"); query.eq("channelId", getChannelId()); Long id = getParameterValue(Long.class, "id", "查询编号错误,应该是整型"); if (isNotNull(id)) query.eq("id", id); String name = getParameterValue(String.class, "name", ""); if (isStringNotEmpty(name)) query.likeAnywhere("name", name); if (!EwcmsContextUtil.getGroupnames().contains("GROUP_ADMIN")) { Organ organ = particularFac.findOrganByUserName(); if (organ == null) { query.eq("organ.id", null); } else { query.eq("organ.id", organ.getId()); } } entityOrder(query, order); return query.queryCacheResult(cacheKey); }
@Override protected Resultable querySelectionsResult( QueryFactory queryFactory, int rows, int page, String[] selections, Order order) { String hql = "From MsgSend As m Where m.userName=:userName And m.id In (:id) Order By m.sendTime Desc, m.id Desc"; String countHql = "Select count(m.id) From MsgSend As m Where m.userName=:userName And m.id In (:id) "; HqlQueryable query = queryFactory.createHqlQuery(hql, countHql); query.setParameter("id", getIds(Long.class)); query.setParameter("userName", EwcmsContextUtil.getUserName()); setDateFormat(DATE_FORMAT); return query.setRow(rows).setPage(page).queryResult(); }
@Override protected Resultable queryResult( QueryFactory queryFactory, String cacheKey, int rows, int page, Order order) { String hql = "From MsgSend As m Where m.userName=:userName "; String countHql = "Select count(m.id) From MsgSend As m Where m.userName=:userName "; Long id = getParameterValue(Long.class, "id", "查询编号错误,应该是整型"); if (isNotNull(id)) { hql += " And m.id=:id "; countHql += " And m.id=:id"; } String title = getParameterValue(String.class, "title", ""); if (isStringNotEmpty(title)) { hql += " And m.title Like :title"; countHql += " And m.title Like :title"; } String sendTimeStart = getParameterValue(String.class, "sendTimeStart", ""); if (isStringNotEmpty(sendTimeStart)) { hql += " And m.sendTime>=:sendTimeStart"; countHql += " And m.sendTime>=:sendTimeStart"; } String sendTimeEnd = getParameterValue(String.class, "sendTimeEnd", ""); if (isStringNotEmpty(sendTimeEnd)) { hql += " And m.sendTime<=:sendTimeEnd"; countHql += " And m.sendTime<=:sendTimeEnd"; } String type = getParameterValue(String.class, "type", ""); if (isStringNotEmpty(type) && !type.equals("-1")) { hql += " And m.type=:type"; countHql += " And m.type=:type"; } hql += " Order By m.sendTime Desc, m.id Desc"; HqlQueryable query = queryFactory.createHqlQuery(hql, countHql); if (isNotNull(id)) { query.setParameter("id", id); } if (isStringNotEmpty(title)) { query.setParameter("title", "%" + title + "%"); } if (isStringNotEmpty(sendTimeStart)) { try { query.setParameter("sendTimeStart", DATE_FORMAT.parse(sendTimeStart)); } catch (ParseException e) { e.printStackTrace(); } } if (isStringNotEmpty(sendTimeEnd)) { try { query.setParameter("sendTimeEnd", DATE_FORMAT.parse(sendTimeEnd)); } catch (ParseException e) { e.printStackTrace(); } } if (isStringNotEmpty(type) && !type.equals("-1")) { query.setParameter("type", Type.valueOf(type)); } query.setParameter("userName", EwcmsContextUtil.getUserName()); setDateFormat(DATE_FORMAT); return query.setRow(rows).setPage(page).queryCacheResult(cacheKey); }