YonghuService.java 583 B

123456789101112131415161718192021
  1. package org.example.service;
  2. import org.example.entity.Yonghu;
  3. import org.example.mapper.YonghuMapper;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Service;
  6. @Service
  7. public class YonghuService {
  8. @Autowired
  9. private YonghuMapper yonghuMapper;
  10. public boolean authenticate(String username, String password) {
  11. Yonghu yonghu = yonghuMapper.findByUsername(username);
  12. if (yonghu != null && yonghu.getPassword().equals(password)) {
  13. return true;
  14. }
  15. return false;
  16. }
  17. }