|
@@ -1,5 +1,6 @@
|
|
package com.fjhx.account.service.transaction.impl;
|
|
package com.fjhx.account.service.transaction.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.fjhx.account.entity.account.po.AccountManagement;
|
|
import com.fjhx.account.entity.account.po.AccountManagement;
|
|
@@ -12,7 +13,6 @@ import com.fjhx.account.service.account.AccountManagementService;
|
|
import com.fjhx.account.service.transaction.TransactionDepartmentService;
|
|
import com.fjhx.account.service.transaction.TransactionDepartmentService;
|
|
import com.fjhx.account.service.transaction.TransactionService;
|
|
import com.fjhx.account.service.transaction.TransactionService;
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
-import com.ruoyi.common.utils.wrapper.SqlField;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -43,12 +43,15 @@ public class TransactionServiceImpl extends ServiceImpl<TransactionMapper, Trans
|
|
wrapper.eq(Transaction::getDepartmentId, dto.getDepartmentId());
|
|
wrapper.eq(Transaction::getDepartmentId, dto.getDepartmentId());
|
|
wrapper.eq(Transaction::getType, dto.getType());
|
|
wrapper.eq(Transaction::getType, dto.getType());
|
|
//关键字搜索
|
|
//关键字搜索
|
|
- List<Long> accountIds = accountManagementService.listObject(AccountManagement::getId,
|
|
|
|
- q -> q.like(AccountManagement::getName, dto.getKeyword()));
|
|
|
|
- wrapper.keyword(dto.getKeyword(),
|
|
|
|
- new SqlField(Transaction::getAmount),
|
|
|
|
- new SqlField(Transaction::getRemark)
|
|
|
|
- ).or().in(Transaction::getAccountId, accountIds);
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getKeyword())) {
|
|
|
|
+ List<Long> accountIds = accountManagementService.listObject(AccountManagement::getId,
|
|
|
|
+ q -> q.like(AccountManagement::getName, dto.getKeyword()));
|
|
|
|
+ wrapper.and(q -> q
|
|
|
|
+ .like(Transaction::getAmount, dto.getKeyword())
|
|
|
|
+ .or().like(Transaction::getRemark, dto.getKeyword())
|
|
|
|
+ .or().in(Transaction::getAccountId, accountIds)
|
|
|
|
+ );
|
|
|
|
+ }
|
|
//排序
|
|
//排序
|
|
wrapper.orderByDesc("t", Transaction::getId);
|
|
wrapper.orderByDesc("t", Transaction::getId);
|
|
Page<TransactionVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
Page<TransactionVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|