package cn.iocoder.yudao.module.system.api.elder;

import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.module.system.api.bpm.vo.ElderlyInfoReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.ElderlyInfoDO;
import cn.iocoder.yudao.module.system.dal.mysql.biz.ElderlyInfoMapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class ElderlyApiImpl implements ElderlyApi{

    @Resource
    private ElderlyInfoMapper elderlyInfoMapper;

    @Override
    public void createElderOpenCardLog(String idNumber) {
        ElderlyInfoDO elderlyInfoDO = elderlyInfoMapper.selectOne(new LambdaQueryWrapper<ElderlyInfoDO>()
                .eq(ElderlyInfoDO::getIdCard, idNumber));

        if (elderlyInfoDO != null){
            //添加日志
        }
    }

    @Override
    public ElderlyInfoReqVO getElderlyInfoByIdCard(String idCard) {
        ElderlyInfoDO elderlyInfoDO = elderlyInfoMapper.selectOne(new LambdaQueryWrapper<ElderlyInfoDO>()
                .eq(ElderlyInfoDO::getIdCard, idCard));
        return BeanUtils.toBean(elderlyInfoDO, ElderlyInfoReqVO.class);
    }
}
