CostAccountShareParamRepository.java 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. package com.kcim.dao.repository;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  4. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  5. import com.kcim.common.constants.NumberConstant;
  6. import com.kcim.common.util.UserContext;
  7. import com.kcim.dao.mapper.CostAccountShareParamMapper;
  8. import com.kcim.dao.model.CostAccountShareParam;
  9. import org.springframework.stereotype.Repository;
  10. import org.springframework.util.CollectionUtils;
  11. import org.springframework.util.ObjectUtils;
  12. import java.util.Date;
  13. import java.util.List;
  14. /**
  15. * @program: CostAccount
  16. * @description:
  17. * @author: Wang.YS
  18. * @create: 2024-04-03 14:49
  19. **/
  20. @Repository
  21. public class CostAccountShareParamRepository extends ServiceImpl<CostAccountShareParamMapper, CostAccountShareParam> {
  22. /**
  23. * 获取指定分摊设置对应的分摊参数
  24. * @param accountShareId
  25. * @return
  26. */
  27. public List<CostAccountShareParam> getCostAccountShareParam(Long accountShareId) {
  28. LambdaQueryWrapper<CostAccountShareParam> queryWrapper = new LambdaQueryWrapper<>();
  29. queryWrapper.eq(CostAccountShareParam::getHospId, UserContext.getHospId());
  30. queryWrapper.eq(CostAccountShareParam::getDelFlag, NumberConstant.ZERO);
  31. if(!ObjectUtils.isEmpty(accountShareId)) {
  32. queryWrapper.eq(CostAccountShareParam::getAccountShareId, accountShareId);
  33. }
  34. return this.list(queryWrapper);
  35. }
  36. /**
  37. * 作废指定分摊设置对应的分摊参数
  38. * @param accountShareId
  39. * @return
  40. */
  41. public boolean delCostAccountShareDetail(Long accountShareId) {
  42. LambdaUpdateWrapper<CostAccountShareParam> updateWrapper = new LambdaUpdateWrapper<>();
  43. updateWrapper.set(CostAccountShareParam::getDelFlag,NumberConstant.ONE);
  44. updateWrapper.set(CostAccountShareParam::getDeleteUser,UserContext.getCurrentUser().getId());
  45. updateWrapper.set(CostAccountShareParam::getDeleteTime,new Date());
  46. updateWrapper.eq(CostAccountShareParam::getHospId, UserContext.getHospId());
  47. updateWrapper.eq(CostAccountShareParam::getDelFlag, NumberConstant.ZERO);
  48. if(!ObjectUtils.isEmpty(accountShareId)) {
  49. updateWrapper.eq(CostAccountShareParam::getAccountShareId, accountShareId);
  50. }
  51. return this.update(updateWrapper);
  52. }
  53. /**
  54. * 批量删除指定分摊设置对应的分摊参数
  55. * @param accountShareIdList
  56. * @return
  57. */
  58. public boolean delCostAccountShareDetailList(List<Long> accountShareIdList) {
  59. LambdaUpdateWrapper<CostAccountShareParam> updateWrapper = new LambdaUpdateWrapper<>();
  60. updateWrapper.set(CostAccountShareParam::getDelFlag,NumberConstant.ONE);
  61. updateWrapper.set(CostAccountShareParam::getDeleteUser,UserContext.getCurrentUser().getId());
  62. updateWrapper.set(CostAccountShareParam::getDeleteTime,new Date());
  63. updateWrapper.eq(CostAccountShareParam::getHospId, UserContext.getHospId());
  64. updateWrapper.eq(CostAccountShareParam::getDelFlag, NumberConstant.ZERO);
  65. if(!CollectionUtils.isEmpty(accountShareIdList)) {
  66. updateWrapper.in(CostAccountShareParam::getAccountShareId, accountShareIdList);
  67. }
  68. return this.update(updateWrapper);
  69. }
  70. }