diff --git a/platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java b/platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java index cb0d4c1..b54aa83 100644 --- a/platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java +++ b/platform-dal/src/main/java/com/lyms/platform/query/BabyModelQuery.java @@ -1,19 +1,18 @@ package com.lyms.platform.query; -import java.util.Date; - -import org.bson.types.ObjectId; -import org.springframework.data.mongodb.core.query.Criteria; - import com.lyms.platform.common.base.IConvertToNativeQuery; import com.lyms.platform.common.dao.BaseQuery; import com.lyms.platform.common.dao.operator.MongoCondition; import com.lyms.platform.common.dao.operator.MongoOper; import com.lyms.platform.common.dao.operator.MongoQuery; +import org.bson.types.ObjectId; +import org.springframework.data.mongodb.core.query.Criteria; + +import java.util.Date; /** * 新生儿查询模型 - * + * * @author Administrator */ public class BabyModelQuery extends BaseQuery implements IConvertToNativeQuery { @@ -79,7 +78,7 @@ public class BabyModelQuery extends BaseQuery implements IConvertToNativeQuery { */ private int visitstatus = -1; - private int yn= -1; + private int yn = -1; public int getYn() { return yn; @@ -156,24 +155,30 @@ public class BabyModelQuery extends BaseQuery implements IConvertToNativeQuery { if (null != id) { condition = condition.and("id", new ObjectId(id), MongoOper.IS); } - if(-1!=yn){ + if (-1 != yn) { condition = condition.and("yn", yn, MongoOper.IS); } - if(null!=areaId){ + if (null != areaId) { condition = condition.and("areaId", areaId, MongoOper.IS); } - /* - * if(null!=keyword){ if(null!=keyword){ MongoCondition con1= MongoCondition.newInstance("phone", keyword, MongoOper.LIKE); MongoCondition con - * = MongoCondition.newInstance("name", keyword, MongoOper.LIKE); condition = condition.orCondition(new MongoCondition[]{con1,con}); } } - */ + + if (null != keyword) { + if (null != keyword) { + MongoCondition con1 = MongoCondition.newInstance("mphone", keyword, MongoOper.LIKE); + MongoCondition con + = MongoCondition.newInstance("mname", keyword, MongoOper.LIKE); + condition = condition.orCondition(new MongoCondition[]{con1, con}); + } + } + if (null != parentId) { condition = condition.and("parentid", parentId, MongoOper.IS); } - if(null!=mphone){ + if (null != mphone) { condition = condition.and("mphone", mphone, MongoOper.IS); } - if(null!=mname){ + if (null != mname) { condition = condition.and("mname", mname, MongoOper.IS); } Criteria c = null; diff --git a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java index 63d223f..be13983 100644 --- a/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java +++ b/platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/BabyManagerFacade.java @@ -90,6 +90,7 @@ public class BabyManagerFacade { babyQuery.setBirthEnd(date); babyQuery.setBirthStart(DateUtil.parseYMD(babyManagerRequest.getdStart())); babyQuery.setVisitstatus(babyManagerRequest.getVisitstatus()); + babyQuery.setKeyword(babyManagerRequest.getKeyword()); babyQuery.setMphone(babyManagerRequest.getPhone()); babyQuery.setPage(babyManagerRequest.getPage()); babyQuery.setMname(babyManagerRequest.getName());