3-11 Realization of User Login Information Verification

Verify the user name and password and then generate randomkey and token to

throw CommonServiceException. If the user name and password are wrong, throw this exception. CommonServiceException

User implementation class.

Talk about UserServiceAPI and add @Service annotation.

Implement methods within the interface. There are two ways to annotate here. Injecting Mapper If you use @Autowired injection method here, you will get an error. This error can be avoided. This is an error reported by IDEA. When scanning the data layer of Mybatis, it will show that no implementation class can be found. Because this implementation class is generated by Mybatis for you.


Don't worry about this. If you don't want to see this error, you can use @Resource to inject In this way, you wo n’t get the wrong 

two things to do.

Normally, we should use selectOne

here and use List

here. Here we take the first record

. Exceptions are thrown before data is queried.

verify password


Change to return String type,

return userid back to the

controller to call



 

End

 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/12690650.html