package com.cool.store.dao;

import com.cool.store.entity.TempUserDetailDO;
import com.cool.store.mapper.TempUserDetailMapper;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author byd
 * @date 2024-04-29 16:06
 */
@Repository
public class TempUserDetailDAO {

    @Resource
    private TempUserDetailMapper tempUserDetailMapper;

    public List<TempUserDetailDO> userList(Long shopId) {
        return tempUserDetailMapper.select(TempUserDetailDO.builder().deleted(false).shopId(shopId).build());
    }

    public TempUserDetailDO selectByIdCard(String idCard) {
        return tempUserDetailMapper.selectOne(TempUserDetailDO.builder().deleted(false).idCard(idCard).build());
    }

    public int insertSelective(TempUserDetailDO detailDO) {
        return tempUserDetailMapper.insertSelective(detailDO);
    }

    public Integer updateByPrimaryKeySelective(TempUserDetailDO detailDO) {
        return tempUserDetailMapper.updateByPrimaryKeySelective(detailDO);
    }

    public TempUserDetailDO selectById(Long id) {
        return tempUserDetailMapper.selectOne(TempUserDetailDO.builder().id(id).build());
    }
}
