admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/dao/user/vip/UserLevelUpgradedNotifyDao.java
@@ -1,54 +1,54 @@
package com.yeshi.fanli.dao.user.vip;
import java.util.ArrayList;
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import com.yeshi.fanli.dao.MongodbBaseDao;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify;
@Repository
public class UserLevelUpgradedNotifyDao extends MongodbBaseDao<UserLevelUpgradedNotify> {
   public List<UserLevelUpgradedNotify> listToLevelsByUid(Long uid, List<UserLevelEnum> levelList) {
      Query query = new Query();
      Criteria levels = new Criteria();
      Criteria[] orlevels = new Criteria[levelList.size()];
      for (int i = 0; i < levelList.size(); i++) {
         orlevels[i] = Criteria.where("toLevel").is(levelList.get(i).name());
      }
      levels.orOperator(orlevels);
      query.addCriteria(Criteria.where("uid").is(uid).andOperator(levels));
      return findList(query);
   }
   /**
    *
    * 获取没有通知的列表
    * @Title: listNotNotifiedByUid
    * @Description:
    * @param uid
    * @return
    * List<UserLevelUpgradedNotify> 返回类型
    * @throws
    */
   public List<UserLevelUpgradedNotify> listNotNotifiedByUid(Long uid) {
      Query query = new Query();
      query.addCriteria(Criteria.where("uid").is(uid).andOperator(Criteria.where("valid").is(true),
            Criteria.where("notified").is(false)));
      List<Order> orders = new ArrayList<>();
      orders.add(new Order(Direction.DESC, "createTime"));
      query.with(new Sort(orders));
      return findList(query);
   }
}
package com.yeshi.fanli.dao.user.vip;
import java.util.ArrayList;
import java.util.List;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
import com.yeshi.common.MongodbBaseDao;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify;
@Repository
public class UserLevelUpgradedNotifyDao extends MongodbBaseDao<UserLevelUpgradedNotify> {
   public List<UserLevelUpgradedNotify> listToLevelsByUid(Long uid, List<UserLevelEnum> levelList) {
      Query query = new Query();
      Criteria levels = new Criteria();
      Criteria[] orlevels = new Criteria[levelList.size()];
      for (int i = 0; i < levelList.size(); i++) {
         orlevels[i] = Criteria.where("toLevel").is(levelList.get(i).name());
      }
      levels.orOperator(orlevels);
      query.addCriteria(Criteria.where("uid").is(uid).andOperator(levels));
      return findList(query);
   }
   /**
    *
    * 获取没有通知的列表
    * @Title: listNotNotifiedByUid
    * @Description:
    * @param uid
    * @return
    * List<UserLevelUpgradedNotify> 返回类型
    * @throws
    */
   public List<UserLevelUpgradedNotify> listNotNotifiedByUid(Long uid) {
      Query query = new Query();
      query.addCriteria(Criteria.where("uid").is(uid).andOperator(Criteria.where("valid").is(true),
            Criteria.where("notified").is(false)));
      List<Order> orders = new ArrayList<>();
      orders.add(new Order(Direction.DESC, "createTime"));
      query.with(new Sort(orders));
      return findList(query);
   }
}