package com.njcn.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.user.mapper.AppInfoSetMapper;
import com.njcn.user.pojo.param.AppInfoSetParam;
import com.njcn.user.pojo.po.app.AppInfoSet;
import com.njcn.user.service.IAppInfoSetService;
import com.njcn.web.utils.RequestUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xuyang
 * @since 2023-08-21
 */
@Service
public class AppInfoSetServiceImpl extends ServiceImpl<AppInfoSetMapper, AppInfoSet> implements IAppInfoSetService {

    @Override
    public void updateAppInfo(AppInfoSetParam param) {
        AppInfoSet appInfoSet = new AppInfoSet();
        BeanUtils.copyProperties(param,appInfoSet);
        appInfoSet.setUserId(RequestUtil.getUserIndex());
        this.updateById(appInfoSet);
    }

    @Override
    public List<AppInfoSet> getListById(List<String> list) {
        return this.lambdaQuery().in(AppInfoSet::getUserId,list).list();
    }
}
