Changeset 7d43957 for src/main/java/com/example/autopartz/service
- Timestamp:
- 01/05/23 01:31:58 (23 months ago)
- Branches:
- main
- Children:
- 676144b
- Parents:
- ab952ab
- Location:
- src/main/java/com/example/autopartz/service
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/autopartz/service/LoginService.java
rab952ab r7d43957 2 2 3 3 import com.example.autopartz.model.User; 4 import com.example.autopartz.model.Warehouse; 4 5 5 6 public interface LoginService { 6 User register(String name, String username, String email, String number, String password);7 void register(String name, String username, String email, String number, String password, String role); 7 8 User login(String username, String password); 9 void registerWarehouseman(String name, String username, String email, String number, String password, String role, Warehouse warehouse); 8 10 } -
src/main/java/com/example/autopartz/service/impl/LoginServiceImpl.java
rab952ab r7d43957 1 1 package com.example.autopartz.service.impl; 2 2 3 import com.example.autopartz.model. User;3 import com.example.autopartz.model.*; 4 4 import com.example.autopartz.repository.UserRepository; 5 5 import com.example.autopartz.service.LoginService; 6 6 import org.springframework.stereotype.Service; 7 8 import java.util.Objects; 7 9 8 10 @Service … … 15 17 16 18 @Override 17 public User register(String name, String username, String email, String number, String password) { 18 return userRepository.save(new User(username,name,email,password,number)); 19 public void register(String name, String username, String email, String number, String password, String role) { 20 if (Objects.equals(role, "client")) { 21 userRepository.save(new Client(username, name, email, password, number)); 22 } 23 else { 24 userRepository.save(new Deliveryman(username, name, email, password, number)); 25 } 19 26 } 20 27 … … 24 31 } 25 32 33 @Override 34 public void registerWarehouseman(String name, String username, String email, String number, String password, String role, Warehouse warehouse) { 35 userRepository.save(new Warehouseman(username, name, email, password, number, warehouse)); 36 37 } 38 26 39 // @Override 27 40 // public User findByUsername(String username) {
Note:
See TracChangeset
for help on using the changeset viewer.