Пример #1
0
  @Transactional
  public boolean delete(UserInfo userInfo, EventForm form) {
    logger.infoCode("I0001");
    try {

      if (userInfo.isMgmt2() || userInfo.isMgmt3() || userInfo.isMgmt4()) {
        logger.infoCode("I0002");
        return false;
      }

      EvEventTbl entity = findOne(userInfo, form);

      evEventPublicTblRepository.delete(entity.getEvEventPublicTbls());

      int c1 = evEventTblRepository.delete(form.getEventKey(), form.getUpdDate());

      if (c1 > 0) {
        evEventPublicTblRepository.flush();
        evEventTblRepository.flush();
        logger.infoCode("I0002");
        return true;
      }
    } catch (Exception e) {
      logger.errorCode("E1009", e); // E1009=削除に失敗しました。{0}
    }
    return false;
  }
Пример #2
0
  public EvEventTbl findOne(UserInfo userInfo, EventForm form) {
    logger.infoCode("I0001"); // I0001=メソッド開始:{0}

    // 定数区分
    Specification<EvEventTbl> whereEventKey =
        StringUtil.isNull(form.getEventKey())
            ? null
            : new Specification<EvEventTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<EvEventTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("eventKey"), form.getEventKey());
              }
            };
    Specification<EvEventTbl> whereUpdDate =
        DateUtil.isNull(form.getUpdDate())
            ? null
            : new Specification<EvEventTbl>() {
              @Override
              public Predicate toPredicate(
                  Root<EvEventTbl> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
                return cb.equal(root.get("updDate"), form.getUpdDate());
              }
            };

    logger.infoCode("I0002"); // I0002=メソッド終了:{0}
    return evEventTblRepository.findOne(Specifications.where(whereEventKey).and(whereUpdDate));
  }