package com.ywt.mg.services;

import com.ywt.mg.core.SqlHelper;
import com.ywt.mg.core.utils.Checker;
import com.ywt.mg.domain.entities.User;
import com.ywt.mg.domain.entities.UserRepository;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    private static Logger logger = LoggerFactory.getLogger(UserService.class);

    @Autowired
    private SqlHelper sqlHelper;

    @Autowired
    private UserRepository userRepository;

    @Autowired
    private IdGenerator idGenerator;

    @Autowired
    private JdbcTemplate jdbcTemplate;

//    @Autowired
//    private DoctorService doctorService;


    public int getUserIdByMobile(String mobile) {
        User user = userRepository.findUserByMobile(mobile);
        if (!Checker.isNone(user)) {
            return user.getId();
        }
        return 0;
    }
}
