AccountingRepository.java 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. package com.kcim.dao.repository;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4. import com.kcim.common.constants.NumberConstant;
  5. import com.kcim.common.util.UserContext;
  6. import com.kcim.dao.mapper.AccountingMapper;
  7. import com.kcim.dao.model.Accounting;
  8. import org.springframework.stereotype.Repository;
  9. import org.springframework.util.StringUtils;
  10. import java.util.List;
  11. /**
  12. * @program: CostAccount
  13. * @description:
  14. * @author: Wang.YS
  15. * @create: 2023-11-14 14:28
  16. **/
  17. @Repository
  18. public class AccountingRepository extends ServiceImpl<AccountingMapper, Accounting> {
  19. /**
  20. * 获取会计科目收入字典
  21. */
  22. public List<Accounting> getAccountIncome(String name){
  23. LambdaQueryWrapper<Accounting> queryWrapper = new LambdaQueryWrapper<>();
  24. queryWrapper.eq(Accounting::getHospId, UserContext.getHospId());
  25. queryWrapper.eq(Accounting::getAccountingType, NumberConstant.ONE);
  26. if(!StringUtils.isEmpty(name)){
  27. queryWrapper.like(Accounting::getAccountingName, name);
  28. }
  29. return this.list(queryWrapper);
  30. }
  31. public List<Accounting> getAllIncome() {
  32. LambdaQueryWrapper<Accounting> queryWrapper = new LambdaQueryWrapper<>();
  33. queryWrapper.eq(Accounting::getHospId, UserContext.getHospId());
  34. queryWrapper.eq(Accounting::getAccountingType, NumberConstant.ONE);
  35. return this.list(queryWrapper);
  36. }
  37. public List<Accounting> getAllCostAccounting() {
  38. LambdaQueryWrapper<Accounting> queryWrapper = new LambdaQueryWrapper<>();
  39. queryWrapper.eq(Accounting::getHospId, UserContext.getHospId());
  40. queryWrapper.eq(Accounting::getAccountingType, NumberConstant.TWO);
  41. return this.list(queryWrapper);
  42. }
  43. public List<Accounting> getList(Integer accountType) {
  44. LambdaQueryWrapper<Accounting> queryWrapper = new LambdaQueryWrapper<>();
  45. queryWrapper.eq(Accounting::getHospId, UserContext.getHospId());
  46. queryWrapper.eq(Accounting::getAccountingType, accountType);
  47. queryWrapper.orderByDesc(Accounting::getCreateTime);
  48. return this.list(queryWrapper);
  49. }
  50. public List<Accounting> getBaseCostList(String filter) {
  51. LambdaQueryWrapper<Accounting> queryWrapper = new LambdaQueryWrapper<>();
  52. queryWrapper.eq(Accounting::getHospId, UserContext.getHospId());
  53. queryWrapper.eq(Accounting::getAccountingType, NumberConstant.TWO);
  54. queryWrapper.eq(Accounting::getIsBaseCost,NumberConstant.ONE);
  55. if(!StringUtils.isEmpty(filter)){
  56. queryWrapper.like(Accounting::getAccountingName,filter);
  57. }
  58. queryWrapper.orderByDesc(Accounting::getCreateTime);
  59. return this.list(queryWrapper);
  60. }
  61. public List<Accounting> getList(Integer accountType, String filter) {
  62. LambdaQueryWrapper<Accounting> queryWrapper = new LambdaQueryWrapper<>();
  63. queryWrapper.eq(Accounting::getHospId, UserContext.getHospId());
  64. queryWrapper.eq(Accounting::getAccountingType, accountType);
  65. queryWrapper.and(q->q.like(Accounting::getAccountingCode,filter).or().like(Accounting::getAccountingName,filter));
  66. queryWrapper.orderByDesc(Accounting::getCreateTime);
  67. return this.list(queryWrapper);
  68. }
  69. }