PtlAgreementUndwrtRulesServiceImpl.java 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package com.ydtech.modules.protocol.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  4. import com.ydtech.modules.protocol.dao.PtlAgreementUndwrtRulesMapper;
  5. import com.ydtech.modules.protocol.entity.po.PtlAgreementUndwrtRules;
  6. import com.ydtech.modules.protocol.service.PtlAgreementAttributionService;
  7. import com.ydtech.modules.protocol.service.PtlAgreementUndwrtRulesService;
  8. import com.ydtech.modules.protocol.utils.AssertionUtils;
  9. import org.springframework.stereotype.Service;
  10. import org.springframework.transaction.annotation.Transactional;
  11. import java.util.List;
  12. /**
  13. * @author CXP
  14. * @description 针对表【ptl_agreement_undwrt_rules(协议产品费用)】的数据库操作Service实现
  15. * @createDate 2023年12月20日22:25:57
  16. */
  17. @Service
  18. public class PtlAgreementUndwrtRulesServiceImpl extends ServiceImpl<PtlAgreementUndwrtRulesMapper, PtlAgreementUndwrtRules>
  19. implements PtlAgreementUndwrtRulesService {
  20. private final PtlAgreementAttributionService ptlAgreementAttributionService;
  21. public PtlAgreementUndwrtRulesServiceImpl(PtlAgreementAttributionService ptlAgreementAttributionService) {
  22. this.ptlAgreementAttributionService = ptlAgreementAttributionService;
  23. }
  24. @Override
  25. public void deleteByAgreementId(String agreementId) {
  26. baseMapper.delete(getByAgreementIdWrapper(agreementId));
  27. }
  28. @Override
  29. public List<PtlAgreementUndwrtRules> getByAgreementId(String agreementId) {
  30. List<PtlAgreementUndwrtRules> ptlAgreementUndwrtRulesList = baseMapper.selectList(getByAgreementIdWrapper(agreementId));
  31. return ptlAgreementUndwrtRulesList;
  32. }
  33. @Override
  34. @Transactional
  35. public void saveBatchProductCosts(String agreementId, List<PtlAgreementUndwrtRules> ptlAgreementUndwrtRulesList) {
  36. if (ptlAgreementUndwrtRulesList != null && !ptlAgreementUndwrtRulesList.isEmpty()) {
  37. boolean b = saveBatch(ptlAgreementUndwrtRulesList);
  38. AssertionUtils.isSucceed(b, "批量添加承保规则失败");
  39. }
  40. }
  41. /**
  42. * 通过协议ID 获取需要进行匹配的核保规则
  43. * @param agreementId
  44. * @return
  45. */
  46. @Override
  47. public List<PtlAgreementUndwrtRules> selectVliadRules(String agreementId){
  48. LambdaQueryWrapper<PtlAgreementUndwrtRules> wrapper = new LambdaQueryWrapper<>();
  49. wrapper.eq(PtlAgreementUndwrtRules::getAgreementId, agreementId);
  50. wrapper.in(PtlAgreementUndwrtRules::getValidInd,1);
  51. List<PtlAgreementUndwrtRules> ptlAgreementProductCosts = baseMapper.selectList(wrapper);
  52. return ptlAgreementProductCosts;
  53. }
  54. }