用户名优化

This commit is contained in:
zhongzb
2023-05-14 13:20:34 +08:00
parent 8dc2c8a103
commit 972561e231
8 changed files with 29 additions and 10 deletions

View File

@@ -12,7 +12,7 @@ import lombok.Getter;
@Getter
public enum BusinessErrorEnum implements ErrorEnum {
//==================================common==================================
BUSINESS_ERROR(1001, "{}"),
BUSINESS_ERROR(1001, "{0}"),
//==================================user==================================
//==================================chat==================================
SYSTEM_ERROR(1001, "系统出小差了,请稍后再试哦~~"),

View File

@@ -7,6 +7,7 @@ import com.abin.mallchat.common.common.exception.ErrorEnum;
import com.abin.mallchat.common.user.domain.entity.UserBackpack;
import org.apache.commons.lang3.StringUtils;
import java.text.MessageFormat;
import java.util.Objects;
/**
@@ -71,7 +72,7 @@ public class AssertUtil {
if (Objects.isNull(errorEnum)) {
errorEnum = BusinessErrorEnum.BUSINESS_ERROR;
}
throw new BusinessException(errorEnum.getErrorCode(), String.format(errorEnum.getErrorMsg(), arg));
throw new BusinessException(errorEnum.getErrorCode(), MessageFormat.format(errorEnum.getErrorMsg(), arg));
}

View File

@@ -40,9 +40,9 @@ public class UserBackpackDao extends ServiceImpl<UserBackpackMapper, UserBackpac
return getOne(wrapper);
}
public boolean invalidItem(Long itemId) {
public boolean invalidItem(Long id) {
UserBackpack update = new UserBackpack();
update.setItemId(itemId);
update.setId(id);
update.setStatus(YesOrNoEnum.YES.getStatus());
return updateById(update);
}

View File

@@ -37,4 +37,8 @@ public class UserDao extends ServiceImpl<UserMapper, User> {
update.setItemId(badgeId);
updateById(update);
}
public User getByName(String name) {
return lambdaQuery().eq(User::getName, name).one();
}
}

View File

@@ -20,6 +20,11 @@ spring:
username: ${mallchat.mysql.username}
password: ${mallchat.mysql.password}
driver-class-name: com.mysql.cj.jdbc.Driver
hikari:
minimum-idle: 3
maximum-pool-size: 10
max-lifetime: 30000 #不能小于30秒否则默认回到1800秒
connection-test-query: SELECT 1
mvc:
pathmatch:
matching-strategy: ANT_PATH_MATCHER