public List<TActivityAwardteamAwardlistOrganEntity> queryAwardListOrgan(String AwardListId) {
   IPersistenceService dao = SwordPersistenceUtils.getPersistenceService();
   String sql =
       "select * from t_activity_awardteam_awardlist_organ t where t.activity_awardlist_id=? and t.invalid='N'";
   List<String> sqlParam = new ArrayList<String>();
   sqlParam.add(AwardListId);
   List<TActivityAwardteamAwardlistOrganEntity> actAwardListOrgan =
       dao.findAllBySql(TActivityAwardteamAwardlistOrganEntity.class, sql, sqlParam);
   return actAwardListOrgan;
 }
 public boolean deleteAwardListOrgan(String AwardListId) {
   IPersistenceService dao = SwordPersistenceUtils.getPersistenceService();
   List<TActivityAwardteamAwardlistOrganEntity> actAwardListOrgans =
       queryAwardListOrgan(AwardListId);
   for (TActivityAwardteamAwardlistOrganEntity actAwardListOrgan : actAwardListOrgans) {
     try {
       dao.delete(actAwardListOrgan);
     } catch (SwordBaseCheckedException e) {
       e.printStackTrace();
       return false;
     }
   }
   return true;
 }
  public boolean saveAwardListOrgan(
      List<TActivityAwardteamAwardlistOrganEntity> actAwardListOrgans, String AwardListId) {
    IPersistenceService dao = SwordPersistenceUtils.getPersistenceService();
    for (TActivityAwardteamAwardlistOrganEntity actAwardListOpus : actAwardListOrgans) {

      actAwardListOpus.setActivityAwardlistId(AwardListId);
      try {
        if (SwordStringUtils.isEmpty(actAwardListOpus.getActivityAwardlistOrganId())) {
          actAwardListOpus.setActivityAwardlistOrganId(UUIDUtil.generateUUID());
        }
        dao.saveOrUpdate(actAwardListOpus);
      } catch (SwordBaseCheckedException e) {
        e.printStackTrace();
        return false;
      }
    }
    return true;
  }
예제 #4
0
  public List<TYearThOpusEntity> query(String yearThId) {
    IPersistenceService dao = SwordPersistenceUtils.getPersistenceService();
    String sql = "select * from t_year_th_opus t where t.year_th_id=? and t.invalid='N'";
    List<String> param = new ArrayList<String>();
    param.add(yearThId);
    List<TYearThOpusEntity> opus = dao.findAllBySql(TYearThOpusEntity.class, sql, param);

    for (TYearThOpusEntity entity : opus) {
      String id = entity.getYearThOpusId();
      String sql1 = "select * from t_year_th_opus_grouping t where t.year_th_opus_id=?";
      List<String> param1 = new ArrayList<String>();
      param1.add(id);
      List<TYearThOpusGroupingEntity> groups =
          dao.findAllBySql(TYearThOpusGroupingEntity.class, sql1, param1);
      entity.setOpusTypes(groups);
      entity.setOpusName("opusName");
    }

    return opus;
  }
예제 #5
0
  public void save(List<TYearThOpusEntity> opusList, String sessionId)
      throws SwordBaseCheckedException {
    IPersistenceService dao = SwordPersistenceUtils.getPersistenceService();
    // 查询已存在作品信息
    String yearThOpusIds = "";
    String sql = "select * from t_year_th_opus t where t.year_th_id=? and t.invalid='N'";
    List<String> param = new ArrayList<String>();
    param.add(sessionId);
    List<TYearThOpusEntity> opusOldList = dao.findAllBySql(TYearThOpusEntity.class, sql, param);

    // 保存作品信息
    for (TYearThOpusEntity opus : opusList) {
      opus.setYearThId(sessionId);
      if (StringHelper.isEmpty(opus.getYearThOpusId())) {
        opus.setYearThOpusId(UUIDUtil.generateUUID());
      } else {
        yearThOpusIds += (opus.getYearThOpusId() + " ");
      }
      dao.saveOrUpdate(opus);

      // 查询已存在的作品分类
      String yearThOpusId = opus.getYearThOpusId();
      String groupIds = "";
      String sql1 = "select * from t_year_th_opus_grouping t where t.year_th_opus_id=?";
      List<String> param1 = new ArrayList<String>();
      param1.add(yearThOpusId);
      List<TYearThOpusGroupingEntity> groupList =
          dao.findAllBySql(TYearThOpusGroupingEntity.class, sql1, param1);

      // 保存分类
      List<TYearThOpusGroupingEntity> groups = opus.getOpusTypes();
      for (TYearThOpusGroupingEntity group : groups) {
        group.setYearThOpusId(yearThOpusId);
        if (StringHelper.isEmpty(group.getGroupingId())) {
          group.setGroupingId(UUIDUtil.generateUUID());
        } else {
          groupIds += (group.getGroupingId() + " ");
        }
        dao.saveOrUpdate(group);
      }
      // 删除分类
      for (TYearThOpusGroupingEntity entity : groupList) {
        if (groupIds.indexOf(entity.getGroupingId()) < 0) {
          dao.delete(entity);
        }
      }
    }

    // 删除作品信息
    for (TYearThOpusEntity opusEntity : opusOldList) {
      if (yearThOpusIds.indexOf(opusEntity.getYearThOpusId()) < 0) {
        String sql2 = "select * from t_year_th_opus_grouping t where t.year_th_opus_id=?";
        List<String> param2 = new ArrayList<String>();
        param2.add(opusEntity.getYearThOpusId());
        List<TYearThOpusGroupingEntity> delGroups =
            dao.findAllBySql(TYearThOpusGroupingEntity.class, sql2, param2);
        dao.delete(opusEntity);
        dao.deleteBatch(delGroups);
      }
    }
  }