2026-07-09 d41fe2e95f3f64c6e3a7229acd9e74e673513a0a
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
package cn.iocoder.yudao.module.hrm.service.salary;
 
import cn.iocoder.yudao.module.hrm.dal.dataobject.salary.HrmSocialSecuritySchemeDO;
import cn.iocoder.yudao.module.hrm.dal.mysql.salary.HrmSocialSecuritySchemeMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
 
import java.util.List;
 
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.SOCIAL_SECURITY_SCHEME_NOT_EXISTS;
 
/**
 * 社保公积金方案 Service 实现类
 *
 * @author 芋道源码
 */
@Service
@Validated
public class HrmSocialSecuritySchemeServiceImpl implements HrmSocialSecuritySchemeService {
 
    @Resource
    private HrmSocialSecuritySchemeMapper schemeMapper;
 
    @Override
    public Long createScheme(HrmSocialSecuritySchemeDO scheme) {
        schemeMapper.insert(scheme);
        return scheme.getId();
    }
 
    @Override
    public void updateScheme(HrmSocialSecuritySchemeDO scheme) {
        validateSchemeExists(scheme.getId());
        schemeMapper.updateById(scheme);
    }
 
    @Override
    public void deleteScheme(Long id) {
        validateSchemeExists(id);
        schemeMapper.deleteById(id);
    }
 
    @Override
    public HrmSocialSecuritySchemeDO getScheme(Long id) {
        return schemeMapper.selectById(id);
    }
 
    @Override
    public List<HrmSocialSecuritySchemeDO> getSchemeList(Integer status) {
        return schemeMapper.selectListByStatus(status);
    }
 
    private void validateSchemeExists(Long id) {
        if (schemeMapper.selectById(id) == null) {
            throw exception(SOCIAL_SECURITY_SCHEME_NOT_EXISTS);
        }
    }
 
}