fengx месяцев назад: 8
Родитель
Сommit
aed6dbfda7

+ 7 - 3
src/main/java/com/sunxung/factoring/service/credit/impl/CreditServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.extra.spring.SpringUtil;
 import cn.hutool.json.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.Page;
@@ -58,9 +59,12 @@ public class CreditServiceImpl extends ServiceImpl<CreditInfoMapper, CreditInfo>
     @Override
     public GridPage findByName(String name, Integer type, Integer page, Integer rows) {
         Page objectPage = PageHelper.startPage(page, rows);
-        List<CreditInfo> list ;
-        list = lambdaQuery().eq(CreditInfo::getType,type).like(CreditInfo::getName, name).or().like(CreditInfo::getCardNo, name)
-                .orderByDesc(CreditInfo::getGmtCreate).list();
+
+        LambdaQueryWrapper<CreditInfo> lambdaQueryWrapper = new LambdaQueryWrapper();
+        lambdaQueryWrapper.eq(CreditInfo::getType,type);
+        lambdaQueryWrapper.and(temp->temp.like(CreditInfo::getName,name).or().like(CreditInfo::getCardNo,name));
+        lambdaQueryWrapper.orderByDesc(CreditInfo::getGmtCreate);
+        List<CreditInfo> list = list(lambdaQueryWrapper);
         return new GridPage(rows,page,objectPage.getTotal(),list);
     }