Esempio n. 1
0
 @Override
 protected Long saveOperator(ZoningCode vo, boolean isUpdate) {
   if (isUpdate) {
     return particularFac.updZoningCode(vo);
   } else {
     try {
       return particularFac.addZoningCode(vo);
     } catch (BaseException e) {
       addActionMessage(e.getPageMessage());
       return null;
     }
   }
 }
  @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);
  }
Esempio n. 4
0
 public void findZoningCodeAll() {
   List<ZoningCode> zoningCodes = particularFac.findZoningCodeAll();
   if (zoningCodes != null) {
     List<ComboBoxString> comboBoxStrings = new ArrayList<ComboBoxString>();
     ComboBoxString comboBox = null;
     for (ZoningCode zoningCode : zoningCodes) {
       comboBox = new ComboBoxString();
       comboBox.setId(zoningCode.getCode());
       comboBox.setText(zoningCode.getName());
       if (getProjectBasicId() != null) {
         Boolean isEntity =
             particularFac.findZoningCodeSelected(getProjectBasicId(), zoningCode.getCode());
         if (isEntity) comboBox.setSelected(true);
       }
       comboBoxStrings.add(comboBox);
     }
     Struts2Util.renderJson(JSONUtil.toJSON(comboBoxStrings.toArray(new ComboBoxString[0])));
   }
 }
Esempio n. 5
0
 @Override
 protected void deleteOperator(Long pk) {
   particularFac.delZoningCode(pk);
 }
Esempio n. 6
0
 @Override
 protected ZoningCode getOperator(Long pk) {
   return particularFac.findZoningCodeById(pk);
 }