package com.td.boss.game.complayerdog.service;

import com.td.boss.common.service.*;
import com.td.boss.game.complayerdog.pojo.ComPlayerDog;
import com.td.boss.game.complayerdog.vo.ComPlayerDogVo;
import com.td.boss.game.complayerdog.repository.ComPlayerDogRepository;
import com.td.boss.util.CopyUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;

@Service
@Transactional
public class ComPlayerDogServiceImpl extends CommonServiceImpl<ComPlayerDogVo, ComPlayerDog, String> implements ComPlayerDogService{

    @PersistenceContext
    private EntityManager em;
    @Autowired
    private ComPlayerDogRepository comPlayerDogRepository;


    @Override
    public ComPlayerDog findByUserIdAndType(String userId, Integer otherType) {
        ComPlayerDog comPlayerDog = comPlayerDogRepository.findByUserIdAndOtherType(userId, otherType).orElse(null);
        return comPlayerDog;
    }

    @Override
    public List<ComPlayerDog> findAllByUserId(String userId) {
        return comPlayerDogRepository.findAllByUserId(userId);
    }
}
