Commit ab7cc6a022fdb292af37442c4a8118476eb592eb

Authored by liquanyu
1 parent fb41bc480d

产筛修改

Showing 1 changed file with 59 additions and 22 deletions

platform-dal/src/main/java/com/lyms/platform/query/SieveQuery.java View file @ ab7cc6a
... ... @@ -187,39 +187,76 @@
187 187 condition = condition.and("yn", yn, MongoOper.IS);
188 188 }
189 189  
190   - Criteria c = null;
191   - boolean isAddStart = Boolean.FALSE;
192   - if (null != dueWeekStart) {
193   - c = Criteria.where("dueWeek").gte(dueWeekStart);
194   - isAddStart = Boolean.TRUE;
  190 + Criteria c1 = null;
  191 + if (null != lastMensesStart) {
  192 + if (null != c1) {
  193 + c1 = c1.and("lastMenses").gte(lastMensesStart);
  194 + } else {
  195 + c1 = Criteria.where("lastMenses").gte(lastMensesStart);
  196 + }
195 197 }
196   - if (null != dueWeekEnd) {
197   - if (c!=null) {
198   - c = c.lte(dueWeekEnd);
  198 + if (null != lastMensesEnd) {
  199 + if (c1 != null) {
  200 + c1 = c1.lte(lastMensesEnd);
199 201 } else {
200   - c = Criteria.where("dueWeek").lte(dueWeekEnd);
  202 + c1 = Criteria.where("lastMenses").lte(lastMensesEnd);
201 203 }
202 204 }
203 205  
204   -
205   - if (null != lastMensesStart) {
206   - if(c!=null){
207   - c = c.where("lastMenses").gte(lastMensesStart);
208   - }else {
209   - c = Criteria.where("lastMenses").gte(lastMensesStart);
  206 + if (null != dueWeekStart) {
  207 + if (null != c1) {
  208 + c1 = c1.and("dueWeek").gte(dueWeekStart);
  209 + } else {
  210 + c1 = Criteria.where("dueWeek").gte(dueWeekStart);
210 211 }
211   - isAddStart = Boolean.TRUE;
212 212 }
213   - if (null != lastMensesEnd) {
214   - if (c!=null) {
215   - c = c.lte(lastMensesEnd);
  213 + if (null != dueWeekEnd) {
  214 + if (null != c1) {
  215 + c1 = c1.lte(dueWeekEnd);
216 216 } else {
217   - c = Criteria.where("lastMenses").lte(lastMensesEnd);
  217 + c1 = Criteria.where("dueWeek").lte(dueWeekEnd);
218 218 }
219 219 }
220   - if (null!=c) {
221   - condition=condition.andCondition(new MongoCondition(c));
  220 +
  221 +
  222 + if (null != c1) {
  223 + condition = condition.andCondition(new MongoCondition(c1));
222 224 }
  225 +
  226 +
  227 +// Criteria c = null;
  228 +// boolean isAddStart = Boolean.FALSE;
  229 +// if (null != dueWeekStart) {
  230 +// c = Criteria.where("dueWeek").gte(dueWeekStart);
  231 +// isAddStart = Boolean.TRUE;
  232 +// }
  233 +// if (null != dueWeekEnd) {
  234 +// if (c!=null) {
  235 +// c = c.lte(dueWeekEnd);
  236 +// } else {
  237 +// c = Criteria.where("dueWeek").lte(dueWeekEnd);
  238 +// }
  239 +// }
  240 +//
  241 +//
  242 +// if (null != lastMensesStart) {
  243 +// if(c!=null){
  244 +// c = c.where("lastMenses").gte(lastMensesStart);
  245 +// }else {
  246 +// c = Criteria.where("lastMenses").gte(lastMensesStart);
  247 +// }
  248 +// isAddStart = Boolean.TRUE;
  249 +// }
  250 +// if (null != lastMensesEnd) {
  251 +// if (c!=null) {
  252 +// c = c.lte(lastMensesEnd);
  253 +// } else {
  254 +// c = Criteria.where("lastMenses").lte(lastMensesEnd);
  255 +// }
  256 +// }
  257 +// if (null!=c) {
  258 +// condition=condition.andCondition(new MongoCondition(c));
  259 +// }
223 260 return condition.toMongoQuery();
224 261 }
225 262