package cn.iocoder.yudao.module.member.controller.app.store.vo;

import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class StoreUserVo {
    private Integer userId;
    private String userName;
    private String cardNumber;
    private String faceId;
    private String openId;



    public static List<StoreUserVo> convert(List<MemberUserDO> list){


        List<StoreUserVo> voList = new ArrayList<>();

        for (MemberUserDO memberUserDO : list) {
            if(StrUtil.isBlank(memberUserDO.getCardId())){
                continue;
            }
            StoreUserVo vo = new StoreUserVo();
            vo.setUserId(memberUserDO.getId().intValue());
            vo.setUserName(memberUserDO.getNickname());
            vo.setCardNumber(memberUserDO.getCardId());
            vo.setFaceId(memberUserDO.getFaceId().toString());
            vo.setOpenId(memberUserDO.getFaceId().toString());
            voList.add(vo);
        }
        return voList;
    }
}
