From 4f015b8c624484e0c3b2d88b944163ce43a48d1f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 27 十一月 2021 17:15:28 +0800
Subject: [PATCH] 功能完善

---
 app/src/main/java/com/yeshi/location/app/dao/location/LocationUsersDao.java |   82 ++++++++++++++++++++++++----------------
 1 files changed, 49 insertions(+), 33 deletions(-)

diff --git a/app/src/main/java/com/yeshi/location/app/dao/location/LocationUsersDao.java b/app/src/main/java/com/yeshi/location/app/dao/location/LocationUsersDao.java
index 89c090d..edd250c 100644
--- a/app/src/main/java/com/yeshi/location/app/dao/location/LocationUsersDao.java
+++ b/app/src/main/java/com/yeshi/location/app/dao/location/LocationUsersDao.java
@@ -14,92 +14,108 @@
 
 
 @Repository
-public class LocationUsersDao extends MongodbBaseDao<LocationUsers>{
+public class LocationUsersDao extends MongodbBaseDao<LocationUsers> {
 
-  public void updateSelective(LocationUsers bean) {
+    public void updateSelective(LocationUsers bean) {
         Query query = new Query();
-        Update update=new Update();
+        Update update = new Update();
         query.addCriteria(Criteria.where("id").is(bean.getId()));
-        if(bean.getUid() != null) {
+        if (bean.getUid() != null) {
             update.set("uid", bean.getUid());
         }
-        if(bean.getTargetUid() != null) {
+        if (bean.getTargetUid() != null) {
             update.set("targetUid", bean.getTargetUid());
         }
-        if(bean.getTargetName() != null) {
+        if (bean.getTargetName() != null) {
             update.set("targetName", bean.getTargetName());
         }
-        if(bean.getStatus() != null) {
+
+        if (bean.getTargetPhone() != null) {
+            update.set("targetPhone", bean.getTargetPhone());
+        }
+
+        if (bean.getStatus() != null) {
             update.set("status", bean.getStatus());
         }
-        if(bean.getSentCount() != null) {
+
+        if (bean.getUserType() != null) {
+            update.set("userType", bean.getUserType());
+        }
+
+        if (bean.getSentCount() != null) {
             update.set("sentCount", bean.getSentCount());
         }
-        if(bean.getStatusDesc() != null) {
+        if (bean.getStatusDesc() != null) {
             update.set("statusDesc", bean.getStatusDesc());
         }
-        if(bean.getAccessTime() != null) {
+        if (bean.getAccessTime() != null) {
             update.set("accessTime", bean.getAccessTime());
         }
-        if(bean.getCreateTime() != null) {
+
+
+        if (bean.getCreateTime() != null) {
             update.set("createTime", bean.getCreateTime());
         }
         update.set("updateTime", new Date());
         update(query, update);
-  }
+    }
 
 
-  public List<LocationUsers> list(DaoQuery daoQuery){
+    public List<LocationUsers> list(DaoQuery daoQuery) {
         Query query = getQuery(daoQuery);
-        if (daoQuery.sortList!=null && daoQuery.sortList.size()>0){
+        if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) {
             query.with(Sort.by(daoQuery.sortList));
         }
         query.skip(daoQuery.start);
         query.limit(daoQuery.count);
         return findList(query);
-  }
+    }
 
-  public long count(DaoQuery daoQuery){
-        Query query=getQuery(daoQuery);
+    public long count(DaoQuery daoQuery) {
+        Query query = getQuery(daoQuery);
         return count(query);
-  }
+    }
 
-  private Query getQuery(DaoQuery daoQuery){
-        List<Criteria> andList=new ArrayList<>();
-        if(daoQuery.uid!=null){
+    private Query getQuery(DaoQuery daoQuery) {
+        List<Criteria> andList = new ArrayList<>();
+        if (daoQuery.uid != null) {
             andList.add(Criteria.where("uid").is(daoQuery.uid));
         }
-        if(daoQuery.targetUid!=null){
+        if (daoQuery.targetUid != null) {
             andList.add(Criteria.where("targetUid").is(daoQuery.targetUid));
         }
-        if(daoQuery.status!=null){
+        if (daoQuery.status != null) {
             andList.add(Criteria.where("status").is(daoQuery.status));
         }
-        if(daoQuery.maxAccessTime!=null){
+        if (daoQuery.userType != null) {
+            andList.add(Criteria.where("userType").is(daoQuery.userType));
+        }
+        if (daoQuery.maxAccessTime != null) {
             andList.add(Criteria.where("accessTime").lt(daoQuery.maxAccessTime));
         }
-        if(daoQuery.minAccessTime!=null){
+        if (daoQuery.minAccessTime != null) {
             andList.add(Criteria.where("accessTime").gte(daoQuery.minAccessTime));
         }
-        if(daoQuery.maxCreateTime!=null){
+        if (daoQuery.maxCreateTime != null) {
             andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime));
         }
-        if(daoQuery.minCreateTime!=null){
+        if (daoQuery.minCreateTime != null) {
             andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime));
         }
-        Query query=new Query();
-        Criteria[]  ands=new Criteria[andList.size()];
+        Query query = new Query();
+        Criteria[] ands = new Criteria[andList.size()];
         andList.toArray(ands);
-        if(ands.length>0){
+        if (ands.length > 0) {
             query.addCriteria(new Criteria().andOperator(ands));
         }
         return query;
-  }
+    }
 
-  public static class DaoQuery{
+    public static class DaoQuery {
         public Long uid;
         public Long targetUid;
         public LocationUsers.LocationInviteStatus status;
+        public LocationUsers.LocationUserType userType;
         public Date maxAccessTime;
         public Date minAccessTime;
         public Date maxCreateTime;
@@ -107,5 +123,5 @@
         public int start;
         public int count;
         public List<Sort.Order> sortList;
-  }
+    }
 }

--
Gitblit v1.8.0