Commit ee5ba3660221bf485fa5c99d87c15b200f48d93d
1 parent
a525e59cad
Exists in
master
and in
6 other branches
update
Showing 3 changed files with 13 additions and 8 deletions
platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java
View file @
ee5ba36
... | ... | @@ -2338,14 +2338,14 @@ |
2338 | 2338 | } |
2339 | 2339 | if (null != oralCheckTimeStart && oralCheckTimeEnd != null) { |
2340 | 2340 | if (null != c) { |
2341 | - c = c.where("oralCheckTime").gte(oralCheckTimeStart).lte(oralCheckTimeEnd); | |
2341 | + c = c.and("oralCheckTime").gte(oralCheckTimeStart).lte(oralCheckTimeEnd); | |
2342 | 2342 | } else { |
2343 | 2343 | c = Criteria.where("oralCheckTime").gte(oralCheckTimeStart).lte(oralCheckTimeEnd); |
2344 | 2344 | } |
2345 | 2345 | } |
2346 | 2346 | if (null != nextOralCheckTimeStrat && nextOralCheckTimeEnd != null) { |
2347 | 2347 | if (null != c) { |
2348 | - c = c.where("nextOralCheckTime").gte(nextOralCheckTimeStrat).lte(nextOralCheckTimeEnd); | |
2348 | + c = c.and("nextOralCheckTime").gte(nextOralCheckTimeStrat).lte(nextOralCheckTimeEnd); | |
2349 | 2349 | } else { |
2350 | 2350 | c = Criteria.where("nextOralCheckTime").gte(nextOralCheckTimeStrat).lte(nextOralCheckTimeEnd); |
2351 | 2351 | } |
platform-dal/src/main/java/com/lyms/platform/query/BabyOralCheckQuery.java
View file @
ee5ba36
... | ... | @@ -6,6 +6,7 @@ |
6 | 6 | import com.lyms.platform.common.dao.operator.MongoOper; |
7 | 7 | import com.lyms.platform.common.dao.operator.MongoQuery; |
8 | 8 | import com.lyms.platform.common.utils.StringUtils; |
9 | +import jdk.nashorn.internal.objects.annotations.Where; | |
9 | 10 | import org.apache.commons.collections.CollectionUtils; |
10 | 11 | import org.springframework.data.mongodb.core.query.Criteria; |
11 | 12 | |
12 | 13 | |
13 | 14 | |
14 | 15 | |
15 | 16 | |
... | ... | @@ -243,35 +244,39 @@ |
243 | 244 | |
244 | 245 | if (null != createdStart && createdEnd != null) { |
245 | 246 | if (null != c) { |
246 | - c = c.where("created").gte(createdStart).lte(createdEnd); | |
247 | + c = c.and("created").gte(createdStart).lte(createdEnd); | |
247 | 248 | } else { |
248 | 249 | c = Criteria.where("created").gte(createdStart).lte(createdEnd); |
249 | 250 | } |
250 | 251 | } |
251 | 252 | if(null!=birthStart){ |
252 | 253 | if(null != c){ |
253 | - c = c.where("birth").gte(birthStart); | |
254 | + c = c.and("birth").gte(birthStart); | |
254 | 255 | }else{ |
255 | 256 | c = Criteria.where("birth").gte(birthStart); |
256 | 257 | } |
257 | 258 | } |
258 | 259 | if(null!=birthEnd){ |
259 | 260 | if(null != c){ |
260 | - c = c.where("birth").lte(birthEnd); | |
261 | + if (c.getCriteriaObject().containsField("birth")){ | |
262 | + c = c.lte(birthEnd); | |
263 | + }else { | |
264 | + c = c.and("birth").lte(birthEnd); | |
265 | + } | |
261 | 266 | }else{ |
262 | 267 | c = Criteria.where("birth").lte(birthEnd); |
263 | 268 | } |
264 | 269 | } |
265 | 270 | if (null != oralCheckTimeStart && oralCheckTimeEnd != null) { |
266 | 271 | if (null != c) { |
267 | - c = c.where("oralCheckTime").gte(oralCheckTimeStart).lte(oralCheckTimeEnd); | |
272 | + c = c.and("oralCheckTime").gte(oralCheckTimeStart).lte(oralCheckTimeEnd); | |
268 | 273 | } else { |
269 | 274 | c = Criteria.where("oralCheckTime").gte(oralCheckTimeStart).lte(oralCheckTimeEnd); |
270 | 275 | } |
271 | 276 | } |
272 | 277 | if (null != nextOralCheckTimeStrat && nextOralCheckTimeEnd != null) { |
273 | 278 | if (null != c) { |
274 | - c = c.where("nextOralCheckTime").gte(nextOralCheckTimeStrat).lte(nextOralCheckTimeEnd); | |
279 | + c = c.and("nextOralCheckTime").gte(nextOralCheckTimeStrat).lte(nextOralCheckTimeEnd); | |
275 | 280 | } else { |
276 | 281 | c = Criteria.where("nextOralCheckTime").gte(nextOralCheckTimeStrat).lte(nextOralCheckTimeEnd); |
277 | 282 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyOralCheckFacade.java
View file @
ee5ba36
... | ... | @@ -223,8 +223,8 @@ |
223 | 223 | request.setBirthStart(DateUtil.getBirthStart(request.getQueryMonthAgeEnd())); |
224 | 224 | request.setBirthEnd(DateUtil.getBirthEnd(request.getQueryMonthAgeStart())); |
225 | 225 | } |
226 | - System.out.println(request.convertToQuery().convertToMongoQuery().toString()); | |
227 | 226 | List<BabyOralCheck> babyOralChecks=babyOralCheckService.queryList(request,Sort.Direction.DESC,"created"); |
227 | + System.out.println(request.convertToQuery().convertToMongoQuery().toString()); | |
228 | 228 | List<Map> result=new ArrayList<>(); |
229 | 229 | for (BabyOralCheck babyOralCheck : babyOralChecks) { |
230 | 230 | Map<String,Object> map=ReflectionUtils.beanToMap(babyOralCheck);//对象转map |