Java Code: Querying User Existence with querypersonal() Method
I noticed a typo in your method name, it should be 'querypersonal' instead of 'querypersionsal'. Here's the corrected code:
public Result querypersonal(String username) {
List list = userdao.selectUsername(username);
if (list == null) {
return Result.fail().msg('没有该用户');
}
return Result.ok().msg('有该用户').data(list);
}
Assuming that userdao.selectUsername(username) returns a List of some sort, this method checks if the list is null. If it is null, it returns a failure result with the message '没有该用户' (meaning 'No such user'). Otherwise, it returns a success result with the message '有该用户' (meaning 'User exists') and the list as the data.
原文地址: http://www.cveoy.top/t/topic/ism2 著作权归作者所有。请勿转载和采集!