Commit f8f949c3ff99110bc6561be60377a85c2ca7b582
1 parent
c4f0da1b4b
Exists in
dev
#fix:优化
Showing 2 changed files with 110 additions and 0 deletions
platform-dal/src/main/java/com/lyms/platform/query/BloodPressureQuery.java
View file @
f8f949c
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.utils.StringUtils; | |
| 9 | + | |
| 10 | +public class BloodPressureQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 11 | + private String id; | |
| 12 | + private String parentId; | |
| 13 | + private Integer yn; | |
| 14 | + | |
| 15 | + public Integer getYn() { | |
| 16 | + return yn; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void setYn(Integer yn) { | |
| 20 | + this.yn = yn; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public String getId() { | |
| 24 | + return id; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setId(String id) { | |
| 28 | + this.id = id; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public String getParentId() { | |
| 32 | + return parentId; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setParentId(String parentId) { | |
| 36 | + this.parentId = parentId; | |
| 37 | + } | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public MongoQuery convertToQuery() { | |
| 41 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 42 | + | |
| 43 | + if(StringUtils.isNotEmpty(id)){ | |
| 44 | + condition = condition.and("id", id, MongoOper.IS); | |
| 45 | + } | |
| 46 | + | |
| 47 | + if(StringUtils.isNotEmpty(parentId)){ | |
| 48 | + condition = condition.and("parentId", parentId, MongoOper.IS); | |
| 49 | + } | |
| 50 | + if (yn!=null){ | |
| 51 | + condition = condition.and("yn", yn, MongoOper.IS); | |
| 52 | + } | |
| 53 | + return condition.toMongoQuery(); | |
| 54 | + } | |
| 55 | +} |
platform-dal/src/main/java/com/lyms/platform/query/PatientWeightQuery.java
View file @
f8f949c
| 1 | +package com.lyms.platform.query; | |
| 2 | + | |
| 3 | +import com.lyms.platform.common.base.IConvertToNativeQuery; | |
| 4 | +import com.lyms.platform.common.dao.BaseQuery; | |
| 5 | +import com.lyms.platform.common.dao.operator.MongoCondition; | |
| 6 | +import com.lyms.platform.common.dao.operator.MongoOper; | |
| 7 | +import com.lyms.platform.common.dao.operator.MongoQuery; | |
| 8 | +import com.lyms.platform.common.utils.StringUtils; | |
| 9 | + | |
| 10 | +public class PatientWeightQuery extends BaseQuery implements IConvertToNativeQuery { | |
| 11 | + private String id; | |
| 12 | + private String parentId; | |
| 13 | + private Integer yn; | |
| 14 | + | |
| 15 | + public Integer getYn() { | |
| 16 | + return yn; | |
| 17 | + } | |
| 18 | + | |
| 19 | + public void setYn(Integer yn) { | |
| 20 | + this.yn = yn; | |
| 21 | + } | |
| 22 | + | |
| 23 | + public String getId() { | |
| 24 | + return id; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public void setId(String id) { | |
| 28 | + this.id = id; | |
| 29 | + } | |
| 30 | + | |
| 31 | + public String getParentId() { | |
| 32 | + return parentId; | |
| 33 | + } | |
| 34 | + | |
| 35 | + public void setParentId(String parentId) { | |
| 36 | + this.parentId = parentId; | |
| 37 | + } | |
| 38 | + | |
| 39 | + @Override | |
| 40 | + public MongoQuery convertToQuery() { | |
| 41 | + MongoCondition condition = MongoCondition.newInstance(); | |
| 42 | + | |
| 43 | + if(StringUtils.isNotEmpty(id)){ | |
| 44 | + condition = condition.and("id", id, MongoOper.IS); | |
| 45 | + } | |
| 46 | + | |
| 47 | + if(StringUtils.isNotEmpty(parentId)){ | |
| 48 | + condition = condition.and("parentId", parentId, MongoOper.IS); | |
| 49 | + } | |
| 50 | + if (yn!=null){ | |
| 51 | + condition = condition.and("yn", yn, MongoOper.IS); | |
| 52 | + } | |
| 53 | + return condition.toMongoQuery(); | |
| 54 | + } | |
| 55 | +} |