liujie
2026-02-12 97df836aad0f3fa74bb07fac184015d77fde2b2c
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
package com.xiaopeng.operation.service.impl;
 
 
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaopeng.operation.mapper.XpAgreementMapper;
import com.xiaopeng.api.model.operation.XpAgreement;
import com.xiaopeng.operation.service.XpAgreementService;
import com.xiaopeng.operation.vo.XpAgreementVo;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
 
/**
 * <p>
 * 协议设置 服务实现类
 * </p>
 *
 * @author liu
 * @since 2026-02-03
 */
@Service
public class XpAgreementServiceImpl extends ServiceImpl<XpAgreementMapper, XpAgreement> implements XpAgreementService {
 
    @Override
    public XpAgreementVo getContentByType(Integer type) {
        XpAgreement xpAgreement = this.getOne(new LambdaQueryWrapper<XpAgreement>().eq(XpAgreement::getContentType,type));
        if (xpAgreement != null) {
            XpAgreementVo xpAgreementVo = new XpAgreementVo();
            xpAgreementVo.setId(xpAgreement.getId());
            xpAgreementVo.setContent(xpAgreement.getContent());
            xpAgreementVo.setType(xpAgreement.getContentType());
            xpAgreementVo.setVersion(xpAgreement.getVersion());
            return xpAgreementVo;
        }
        return null;
    }
 
    @Override
    public List<XpAgreementVo> getContentByTypeAll() {
        List<XpAgreement> list = this.list(new LambdaQueryWrapper<XpAgreement>().in(XpAgreement::getContentType, Arrays.asList(1,2,3,4)));
        List<XpAgreementVo> xpAgreementVos = new ArrayList<>();
        for (XpAgreement xpAgreement : list) {
            XpAgreementVo xpAgreementVo = new XpAgreementVo();
            xpAgreementVo.setId(xpAgreement.getId());
            xpAgreementVo.setContent(xpAgreement.getContent());
            xpAgreementVo.setType(xpAgreement.getContentType());
            xpAgreementVo.setVersion(xpAgreement.getVersion());
            xpAgreementVos.add(xpAgreementVo);
        }
        return xpAgreementVos;
    }
}