Commit 32772cafd7bcde121a863eed72f5bb15668d358d
1 parent
66bc9cf1e9
Exists in
master
and in
6 other branches
update
Showing 2 changed files with 13 additions and 6 deletions
platform-dal/src/main/java/com/lyms/platform/query/MicroelementQuery.java
View file @
32772ca
... | ... | @@ -75,11 +75,18 @@ |
75 | 75 | Criteria c = null; |
76 | 76 | |
77 | 77 | |
78 | - if (null != lastMensesStart && lastMensesEnd != null) { | |
78 | + if (null != lastMensesStart) { | |
79 | 79 | if (null != c) { |
80 | - c = c.and("lastMenses").gte(lastMensesStart).lte(lastMensesEnd); | |
80 | + c = c.and("lastMenses").gte(lastMensesStart); | |
81 | 81 | } else { |
82 | - c = Criteria.where("lastMenses").gte(lastMensesStart).lte(lastMensesEnd); | |
82 | + c = Criteria.where("lastMenses").gte(lastMensesStart); | |
83 | + } | |
84 | + } | |
85 | + if (null != lastMensesEnd) { | |
86 | + if (c != null) { | |
87 | + c = c.lte(lastMensesEnd); | |
88 | + } else { | |
89 | + c = Criteria.where("lastMenses").lte(lastMensesEnd); | |
83 | 90 | } |
84 | 91 | } |
85 | 92 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MicroelementFacade.java
View file @
32772ca
... | ... | @@ -109,10 +109,10 @@ |
109 | 109 | |
110 | 110 | //孕周 |
111 | 111 | if (start != null && end != null) { |
112 | - Date start1 = DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(end * 7) - 6); | |
113 | - Date end1 = DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(start * 7)); | |
112 | + Date endDate = DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(start * 7)); | |
113 | + Date start1 = DateUtil.addDay(DateUtil.parseYMD(DateUtil.getyyyy_MM_dd(new Date())), -(end * 7) - 6); | |
114 | 114 | query.setLastMensesStart(start1); |
115 | - query.setLastMensesEnd(end1); | |
115 | + query.setLastMensesEnd(endDate); | |
116 | 116 | } |
117 | 117 | |
118 | 118 | System.out.println(query.convertToQuery().convertToMongoQuery().toString()); |