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;
/**
*
* 用户勾选协议 服务实现类
*
*
* @author liu
* @since 2026-02-03
*/
@Service
public class XpAgreementAppUserServiceImpl extends ServiceImpl implements XpAgreementAppUserService {
@Override
public Boolean addXpAgreementAppUser(XpAgreementAppUserDto xpAgreementAppUserDto, Long appUserId) {
XpAgreementAppUser xpAgreementAppUser = new XpAgreementAppUser();
xpAgreementAppUser.setAppUserId(appUserId);
List 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);
}
}