InvAccountServiceImpl.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. package com.ydtech.modules.inv.service.impl;
  2. import com.baomidou.mybatisplus.core.metadata.IPage;
  3. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  4. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  5. import com.ydtech.core.page.HttpResult;
  6. import com.ydtech.core.page.PageRequest;
  7. import com.ydtech.modules.inv.dao.InvAccountMapper;
  8. import com.ydtech.modules.inv.model.InvAccount;
  9. import com.ydtech.modules.inv.model.vo.InvAccountQueryVo;
  10. import com.ydtech.modules.inv.service.InvAccountService;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Service;
  13. import java.util.List;
  14. /**
  15. * @author Administrator
  16. * @description 针对表【ins_account(账户信息表)】的数据库操作Service实现
  17. * @createDate 2024-01-04 18:29:20
  18. */
  19. @Service
  20. public class InvAccountServiceImpl extends ServiceImpl<InvAccountMapper, InvAccount>
  21. implements InvAccountService {
  22. @Autowired
  23. private InvAccountMapper insAccountMapper;
  24. /**
  25. * 分页查询
  26. *
  27. * @param account
  28. * @return
  29. */
  30. @Override
  31. public IPage<InvAccount> selectAccountsListPage(InvAccountQueryVo invAccountQueryVo) {
  32. PageRequest pageRequest = new PageRequest();
  33. pageRequest.setPageNum(invAccountQueryVo.getPageNo());
  34. pageRequest.setPageSize(invAccountQueryVo.getPageSize());
  35. Page page = PageRequest.buildPageRequest(pageRequest);
  36. IPage<InvAccount> invAccountIPage = insAccountMapper.selectAccountsListPage(page, invAccountQueryVo);
  37. List<InvAccount> records = invAccountIPage.getRecords();
  38. records.forEach(invAccount -> {
  39. if (invAccount.getInvAccountCardList().size() < 2) {
  40. if (invAccount.getInvAccountCardList().get(0).getBankCardNum() == null) {
  41. invAccount.setInvAccountCardList(null);
  42. }
  43. }
  44. });
  45. return invAccountIPage;
  46. }
  47. @Override
  48. public List<InvAccount> selectAccounts(InvAccount account) {
  49. return insAccountMapper.selectAccountsList(account);
  50. }
  51. /**
  52. * 根据户名分类
  53. *
  54. * @return
  55. */
  56. @Override
  57. public HttpResult selectByAccountName() {
  58. InvAccount invAccount = new InvAccount();
  59. List<InvAccount> insAccounts = insAccountMapper.selectAccountsList(invAccount);
  60. if (!insAccounts.isEmpty()) {
  61. insAccounts.forEach(invAccountN -> {
  62. if (invAccountN.getInvAccountCardList().size() < 2) {
  63. if (invAccountN.getInvAccountCardList().get(0).getBankCardNum() == null) {
  64. invAccountN.setInvAccountCardList(null);
  65. }
  66. }
  67. });
  68. return HttpResult.ok("", insAccounts);
  69. }
  70. return HttpResult.error("查询错误");
  71. }
  72. }