|
|
@@ -0,0 +1,74 @@
|
|
|
+package com.zhongshu.payment.server.core.dao.unionFrictionlessPay.impl;
|
|
|
+
|
|
|
+import com.github.microservice.components.data.mongo.mongo.helper.DBHelper;
|
|
|
+import com.zhongshu.card.client.dao.BaseImpl;
|
|
|
+import com.zhongshu.payment.client.payModel.unionFrictionlessPay.model.UnionUserOpenInfoSearch;
|
|
|
+import com.zhongshu.payment.server.core.dao.unionFrictionlessPay.extend.UnionUserOpenInfoDaoExtend;
|
|
|
+import com.zhongshu.payment.server.core.domain.unionFrictionlessPay.UnionUserOpenInfo;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
+import org.springframework.data.mongodb.core.query.Criteria;
|
|
|
+import org.springframework.data.mongodb.core.query.Query;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.regex.Pattern;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author TRX
|
|
|
+ * @CreateDate: 2023/4/12
|
|
|
+ * @Version: 1.0
|
|
|
+ */
|
|
|
+public class UnionUserOpenInfoDaoImpl extends BaseImpl implements UnionUserOpenInfoDaoExtend {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DBHelper dbHelper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<UnionUserOpenInfo> page(Pageable pageable, UnionUserOpenInfoSearch param) {
|
|
|
+ Criteria criteria = new Criteria();
|
|
|
+
|
|
|
+ if (param.getUnionUserOpenType() != null) {
|
|
|
+ criteria.and("unionUserOpenType").is(param.getUnionUserOpenType());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (ObjectUtils.isNotEmpty(param.getShopOid())) {
|
|
|
+ criteria.and("shopOid").is(param.getShopOid());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 模糊搜索
|
|
|
+ List<Criteria> criterias = new ArrayList<>();
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(param.getUserId())) {
|
|
|
+ Pattern pattern = Pattern.compile("^.*" + param.getUserId() + ".*$");
|
|
|
+ criterias.add(Criteria.where("userId").is(pattern));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!CollectionUtils.isEmpty(criterias)) {
|
|
|
+ criteria.andOperator(criterias.toArray(new Criteria[]{}));
|
|
|
+ }
|
|
|
+
|
|
|
+// if (StringUtils.isNotEmpty(param.getKeyWord())) {
|
|
|
+// Pattern pattern = Pattern.compile("^.*" + param.getKeyWord() + ".*$");
|
|
|
+// criteria.orOperator(
|
|
|
+// Criteria.where("name").regex(pattern),
|
|
|
+// Criteria.where("code").regex(pattern),
|
|
|
+// Criteria.where("userId").regex(pattern),
|
|
|
+// Criteria.where("userName").regex(pattern),
|
|
|
+// Criteria.where("phone").regex(pattern)
|
|
|
+// );
|
|
|
+// }
|
|
|
+
|
|
|
+ criteria.and("isDelete").is(Boolean.FALSE);
|
|
|
+ Sort sort = buildSort(param);
|
|
|
+ Query query = Query.query(criteria);
|
|
|
+ query.with(sort);
|
|
|
+ return dbHelper.pages(query, pageable, UnionUserOpenInfo.class);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|