rk
3 天以前 9b276fecad68c5d5483bfb29a2eaf203f4bb371b
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
package com.doumee.service.business.impl;
 
import com.doumee.core.utils.Constants;
import com.doumee.core.utils.Utils;
import com.doumee.dao.business.DdNoticeConfigMapper;
import com.doumee.dao.business.model.DdNoticeConfig;
import com.doumee.dao.business.model.SmsConfig;
import com.doumee.service.business.DdNoticeConfigService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.doumee.service.business.third.model.PageData;
import com.doumee.service.business.third.model.PageWrap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
 
import java.util.List;
import java.util.Objects;
 
/**
 * 钉钉公众号通知配置Service实现
 * @author 江蹄蹄
 * @date 2025/10/14 15:11
 */
@Service
public class DdNoticeConfigServiceImpl implements DdNoticeConfigService {
 
    @Autowired
    private DdNoticeConfigMapper ddNoticeConfigMapper;
 
    @Override
    public Integer create(DdNoticeConfig ddNoticeConfig) {
        ddNoticeConfigMapper.insert(ddNoticeConfig);
        return ddNoticeConfig.getId();
    }
 
    @Override
    public void deleteById(Integer id) {
        ddNoticeConfigMapper.deleteById(id);
    }
 
    @Override
    public void delete(DdNoticeConfig ddNoticeConfig) {
        UpdateWrapper<DdNoticeConfig> deleteWrapper = new UpdateWrapper<>(ddNoticeConfig);
        ddNoticeConfigMapper.delete(deleteWrapper);
    }
 
    @Override
    public void deleteByIdInBatch(List<Integer> ids) {
        if (CollectionUtils.isEmpty(ids)) {
            return;
        }
        ddNoticeConfigMapper.deleteBatchIds(ids);
    }
 
    @Override
    public void updateById(DdNoticeConfig ddNoticeConfig) {
        ddNoticeConfigMapper.updateById(ddNoticeConfig);
    }
 
    @Override
    public void updateByIdInBatch(List<DdNoticeConfig> ddNoticeConfigs) {
        if (CollectionUtils.isEmpty(ddNoticeConfigs)) {
            return;
        }
        for (DdNoticeConfig ddNoticeConfig: ddNoticeConfigs) {
            this.updateById(ddNoticeConfig);
        }
    }
 
    @Override
    public DdNoticeConfig findById(Integer id) {
        return ddNoticeConfigMapper.selectById(id);
    }
 
    @Override
    public DdNoticeConfig findOne(DdNoticeConfig ddNoticeConfig) {
        QueryWrapper<DdNoticeConfig> wrapper = new QueryWrapper<>(ddNoticeConfig);
        return ddNoticeConfigMapper.selectOne(wrapper);
    }
 
    @Override
    public List<DdNoticeConfig> findList(DdNoticeConfig ddNoticeConfig) {
        QueryWrapper<DdNoticeConfig> wrapper = new QueryWrapper<>(ddNoticeConfig);
        return ddNoticeConfigMapper.selectList(wrapper);
    }
  
    @Override
    public PageData<DdNoticeConfig> findPage(PageWrap<DdNoticeConfig> pageWrap) {
        IPage<DdNoticeConfig> page = new Page<>(pageWrap.getPage(), pageWrap.getCapacity());
        QueryWrapper<DdNoticeConfig> queryWrapper = new QueryWrapper<>();
        Utils.MP.blankToNull(pageWrap.getModel());
        queryWrapper.lambda().eq(DdNoticeConfig::getIsdeleted, Constants.ZERO);
        return PageData.from(ddNoticeConfigMapper.selectPage(page, queryWrapper));
    }
 
    @Override
    public long count(DdNoticeConfig ddNoticeConfig) {
        QueryWrapper<DdNoticeConfig> wrapper = new QueryWrapper<>(ddNoticeConfig);
        return ddNoticeConfigMapper.selectCount(wrapper);
    }
 
    @Override
    public void updateStatusByIdInBatch(List<Integer> ids,Integer status) {
        if (CollectionUtils.isEmpty(ids) || Objects.isNull(status)) {
            return;
        }
        ddNoticeConfigMapper.update(new UpdateWrapper<DdNoticeConfig>()
                .set("status",status)
                .in("id",ids)
        );
    }
 
 
}