查询返回类型优化
This commit is contained in:
		@@ -16,7 +16,7 @@ public class MerchantsController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @PostMapping("/add")
 | 
					    @PostMapping("/add")
 | 
				
			||||||
    public Merchants saveMerchants(@RequestBody Merchants merchants) {
 | 
					    public Merchants saveMerchants(@RequestBody Merchants merchants) {
 | 
				
			||||||
        return merchantsService.insetMerchants(merchants);
 | 
					        return merchantsService.addMerchants(merchants);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @DeleteMapping("/delete/{id}")
 | 
					    @DeleteMapping("/delete/{id}")
 | 
				
			||||||
@@ -30,7 +30,7 @@ public class MerchantsController {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @GetMapping("/find")
 | 
					    @GetMapping("/find")
 | 
				
			||||||
    public List<Merchants> getMerchants() {
 | 
					    public Iterable<Merchants> getMerchants() {
 | 
				
			||||||
        return merchantsService.findAllMerchants();
 | 
					        return merchantsService.findAllMerchants();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,7 +16,7 @@ public class UsersController {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @PostMapping("/add")
 | 
					    @PostMapping("/add")
 | 
				
			||||||
    public Users saveUsers(@RequestBody Users users) {
 | 
					    public Users saveUsers(@RequestBody Users users) {
 | 
				
			||||||
        return usersService.insetUsers(users);
 | 
					        return usersService.addUsers(users);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @DeleteMapping("/delete/{id}")
 | 
					    @DeleteMapping("/delete/{id}")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,17 +2,16 @@ package com.example.springdemo.service;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.example.springdemo.entities.Merchants;
 | 
					import com.example.springdemo.entities.Merchants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Optional;
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface MerchantsService {
 | 
					public interface MerchantsService {
 | 
				
			||||||
    Merchants insetMerchants(Merchants merchant);
 | 
					    Merchants addMerchants(Merchants merchant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void deleteMerchantsById(Long id);
 | 
					    void deleteMerchantsById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Merchants updateMerchants(Merchants merchant);
 | 
					    Merchants updateMerchants(Merchants merchant);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    List<Merchants> findAllMerchants();
 | 
					    Iterable<Merchants> findAllMerchants();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Optional<Merchants> findById(Long id);
 | 
					    Optional<Merchants> findById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,7 +14,7 @@ public class MerchantsServiceImpl implements MerchantsService {
 | 
				
			|||||||
    private MerchantsRepository merchantsRepository;
 | 
					    private MerchantsRepository merchantsRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public Merchants insetMerchants(Merchants merchant) {
 | 
					    public Merchants addMerchants(Merchants merchant) {
 | 
				
			||||||
        return merchantsRepository.save(merchant);
 | 
					        return merchantsRepository.save(merchant);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,18 +2,17 @@ package com.example.springdemo.service;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.example.springdemo.entities.Users;
 | 
					import com.example.springdemo.entities.Users;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Optional;
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface UsersService {
 | 
					public interface UsersService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Users insetUsers(Users user);
 | 
					    Users addUsers(Users user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void deleteUsersById(Long id);
 | 
					    void deleteUsersById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Users updateUsers(Users user);
 | 
					    Users updateUsers(Users user);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    List<Users> findAllUsers();
 | 
					    Iterable<Users> findAllUsers();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Optional<Users> findById(Long id);
 | 
					    Optional<Users> findById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,6 @@ import com.example.springdemo.entities.Users;
 | 
				
			|||||||
import jakarta.annotation.Resource;
 | 
					import jakarta.annotation.Resource;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Optional;
 | 
					import java.util.Optional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Service
 | 
					@Service
 | 
				
			||||||
@@ -14,7 +13,7 @@ public class UsersServiceImpl implements UsersService {
 | 
				
			|||||||
    private UsersRepository usersRepository;
 | 
					    private UsersRepository usersRepository;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public Users insetUsers(Users user) {
 | 
					    public Users addUsers(Users user) {
 | 
				
			||||||
        return usersRepository.save(user);
 | 
					        return usersRepository.save(user);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -29,7 +28,7 @@ public class UsersServiceImpl implements UsersService {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<Users> findAllUsers() {
 | 
					    public Iterable<Users> findAllUsers() {
 | 
				
			||||||
        return usersRepository.findAll();
 | 
					        return usersRepository.findAll();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user