xuhy
2025-12-31 f497103c6fd364b960daa7df7ef249b0498b174e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.ruoyi.system.service.impl;
 
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.mapper.TInsuranceMapper;
import com.ruoyi.system.model.THelpNeeds;
import com.ruoyi.system.model.TInsurance;
import com.ruoyi.system.model.TInsurance;
import com.ruoyi.system.query.TInsuranceQuery;
import com.ruoyi.system.service.TInsuranceService;
import com.ruoyi.system.vo.TInsuranceVO;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
/**
 * <p>
 * 保险费用 服务实现类
 * </p>
 *
 * @author xiaochen
 * @since 2025-12-29
 */
@Service
public class TInsuranceServiceImpl extends ServiceImpl<TInsuranceMapper, TInsurance> implements TInsuranceService {
 
    @Override
    public boolean isExit(TInsurance dto) {
        if(StringUtils.isNotEmpty(dto.getId())){
            // 修改
            return this.count(Wrappers.lambdaQuery(TInsurance.class).ne(TInsurance::getId, dto.getId()).eq(TInsurance::getInsuranceTitle, dto.getInsuranceTitle())) > 0;
        }else {
            // 新增
            return this.count(Wrappers.lambdaQuery(TInsurance.class).eq(TInsurance::getInsuranceTitle, dto.getInsuranceTitle())) > 0;
        }
    }
 
    @Override
    public PageInfo<TInsuranceVO> pageList(TInsuranceQuery query) {
        PageInfo<TInsuranceVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<TInsuranceVO> list = this.baseMapper.pageList(query,pageInfo);
        pageInfo.setRecords( list);
        return pageInfo;
    }
 
    @Override
    public boolean isOpen(TInsurance dto) {
        if(StringUtils.isNotEmpty(dto.getId())){
            // 修改
            return this.count(Wrappers.lambdaQuery(TInsurance.class)
                    .ne(TInsurance::getId, dto.getId())
                    .eq(TInsurance::getStatus, 1)
                    .eq(TInsurance::getInsuranceType, dto.getInsuranceType())) > 0;
        }else {
            // 新增
            return this.count(Wrappers.lambdaQuery(TInsurance.class)
                    .eq(TInsurance::getStatus, 1)
                    .eq(TInsurance::getInsuranceType, dto.getInsuranceType())) > 0;
        }
    }
}