puzhibing
2026-03-11 751d75b51a19c521364af730f5d6ea95fc25c871
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
package com.xiaopeng.operation.service.impl;
 
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaopeng.api.model.maintenance.XpAgreementAppUser;
import com.xiaopeng.operation.dto.XpAgreementAppUserDto;
import com.xiaopeng.operation.mapper.XpAgreementAppUserMapper;
import com.xiaopeng.operation.service.XpAgreementAppUserService;
import org.springframework.stereotype.Service;
 
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
 
/**
 * <p>
 * 用户勾选协议 服务实现类
 * </p>
 *
 * @author liu
 * @since 2026-02-03
 */
@Service
public class XpAgreementAppUserServiceImpl extends ServiceImpl<XpAgreementAppUserMapper, XpAgreementAppUser> implements XpAgreementAppUserService {
 
    @Override
    public Boolean addXpAgreementAppUser(XpAgreementAppUserDto xpAgreementAppUserDto, Long appUserId) {
        XpAgreementAppUser xpAgreementAppUser = new XpAgreementAppUser();
        xpAgreementAppUser.setAppUserId(appUserId);
        List<Long> type = xpAgreementAppUserDto.getType();
        xpAgreementAppUser.setAgreementIds(type.stream().map(String::valueOf).collect(Collectors.joining(",")));
        xpAgreementAppUser.setCreateBy(appUserId.toString());
        xpAgreementAppUser.setUpdateBy(appUserId.toString());
        xpAgreementAppUser.setCreateTime(LocalDateTime.now());
        xpAgreementAppUser.setUpdateTime(LocalDateTime.now());
        xpAgreementAppUser.setDeleted(false);
        return save(xpAgreementAppUser);
    }
}