plusone-commons 做了调整。
parent
06ffc8d858
commit
0e0d6f1808
|
@ -1,5 +1,9 @@
|
|||
package xyz.zhouxy.plusone.constant;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import xyz.zhouxy.plusone.commons.util.Enumeration;
|
||||
|
||||
/**
|
||||
|
@ -9,24 +13,24 @@ import xyz.zhouxy.plusone.commons.util.Enumeration;
|
|||
*/
|
||||
public final class EntityStatus extends Enumeration<EntityStatus> {
|
||||
|
||||
private EntityStatus(int value, String name) {
|
||||
super(value, name);
|
||||
private EntityStatus(int id, @Nonnull String name) {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
// 常量
|
||||
public static final EntityStatus AVAILABLE = new EntityStatus(0, "正常");
|
||||
public static final EntityStatus DISABLED = new EntityStatus(1, "禁用");
|
||||
|
||||
private static final EnumerationValuesHolder<EntityStatus> ENUMERATION_VALUES = new EnumerationValuesHolder<>(
|
||||
AVAILABLE,
|
||||
DISABLED);
|
||||
private static final ValueSet<EntityStatus> VALUE_SET = new ValueSet<>(
|
||||
AVAILABLE, DISABLED);
|
||||
|
||||
public static EntityStatus of(int value) {
|
||||
return ENUMERATION_VALUES.get(value);
|
||||
@Nonnull
|
||||
public static EntityStatus of(int id) {
|
||||
return VALUE_SET.get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EntityStatus" + super.toString();
|
||||
@Nonnull
|
||||
public static Collection<EntityStatus> constants() {
|
||||
return VALUE_SET.getValues();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ public class MenuViewObject implements IWithOrderNumber {
|
|||
viewObject.icon = menu.getIcon();
|
||||
viewObject.hidden = menu.isHidden();
|
||||
viewObject.orderNumber = menu.getOrderNumber();
|
||||
viewObject.status = menu.getStatus().getValue();
|
||||
viewObject.status = menu.getStatus().getId();
|
||||
viewObject.remarks = menu.getRemarks();
|
||||
if (viewObject.type == MenuType.MENU_ITEM.ordinal()) {
|
||||
viewObject.component = menu.getComponent();
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
package xyz.zhouxy.plusone.system.domain.model.account;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import lombok.Getter;
|
||||
import xyz.zhouxy.plusone.commons.util.Enumeration;
|
||||
import xyz.zhouxy.plusone.domain.IValueObject;
|
||||
|
@ -12,18 +16,23 @@ import xyz.zhouxy.plusone.domain.IValueObject;
|
|||
@Getter
|
||||
public final class AccountStatus extends Enumeration<AccountStatus> implements IValueObject {
|
||||
|
||||
private AccountStatus(int value, String name) {
|
||||
super(value, name);
|
||||
private AccountStatus(int id, @Nonnull String name) {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
public static final AccountStatus AVAILABLE = new AccountStatus(0, "账号正常");
|
||||
public static final AccountStatus LOCKED = new AccountStatus(1, "账号被锁定");
|
||||
|
||||
private static final EnumerationValuesHolder<AccountStatus> ENUMERATION_VALUES = new EnumerationValuesHolder<>(
|
||||
private static final ValueSet<AccountStatus> VALUE_SET = new ValueSet<>(
|
||||
AVAILABLE,
|
||||
LOCKED);
|
||||
|
||||
public static AccountStatus of(int value) {
|
||||
return ENUMERATION_VALUES.get(value);
|
||||
public static AccountStatus of(int id) {
|
||||
return VALUE_SET.get(id);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Collection<AccountStatus> constants() {
|
||||
return VALUE_SET.getValues();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package xyz.zhouxy.plusone.system.domain.model.account;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import xyz.zhouxy.plusone.commons.util.Enumeration;
|
||||
|
@ -18,16 +20,19 @@ public final class Sex extends Enumeration<Sex> implements IValueObject {
|
|||
@Nonnull
|
||||
public static final Sex FEMALE = new Sex(2, "女性");
|
||||
|
||||
private Sex(int value, String name) {
|
||||
super(value, name);
|
||||
private Sex(int id, @Nonnull String name) {
|
||||
super(id, name);
|
||||
}
|
||||
|
||||
private static EnumerationValuesHolder<Sex> values = new EnumerationValuesHolder<>(
|
||||
UNSET,
|
||||
MALE,
|
||||
FEMALE);
|
||||
private static final ValueSet<Sex> VALUE_SET = new ValueSet<>(UNSET, MALE, FEMALE);
|
||||
|
||||
@Nonnull
|
||||
public static Sex of(int value) {
|
||||
return values.get(value);
|
||||
return VALUE_SET.get(value);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static Collection<Sex> constants() {
|
||||
return VALUE_SET.getValues();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,9 +206,9 @@ public class AccountRepositoryImpl extends JdbcRepositorySupport<Account, Long>
|
|||
.addValue("password", entity.getPassword().value())
|
||||
.addValue("salt", entity.getPassword().getSalt())
|
||||
.addValue("avatar", accountInfo.getAvatar().toString())
|
||||
.addValue("sex", accountInfo.getSex().getValue())
|
||||
.addValue("sex", accountInfo.getSex().getId())
|
||||
.addValue("nickname", getValueOrNull(accountInfo.getNickname()))
|
||||
.addValue("status", entity.getStatus().getValue())
|
||||
.addValue("status", entity.getStatus().getId())
|
||||
.addValue("createdBy", entity.getCreatedBy())
|
||||
.addValue("createTime", now)
|
||||
.addValue("updatedBy", entity.getUpdatedBy())
|
||||
|
|
|
@ -188,7 +188,7 @@ public class MenuRepositoryImpl extends JdbcRepositorySupport<Menu, Long> implem
|
|||
.addValue("icon", entity.getIcon())
|
||||
.addValue("hidden", entity.isHidden())
|
||||
.addValue("orderNumber", entity.getOrderNumber())
|
||||
.addValue("status", entity.getStatus().getValue())
|
||||
.addValue("status", entity.getStatus().getId())
|
||||
.addValue("remarks", entity.getRemarks())
|
||||
.addValue("component", entity.getComponent())
|
||||
.addValue("cache", entity.getCache())
|
||||
|
|
|
@ -135,7 +135,7 @@ public class RoleRepositoryImpl extends JdbcRepositorySupport<Role, Long> implem
|
|||
.addValue("id", id)
|
||||
.addValue("name", entity.getName())
|
||||
.addValue("identifier", entity.getIdentifier())
|
||||
.addValue("status", entity.getStatus().getValue())
|
||||
.addValue("status", entity.getStatus().getId())
|
||||
.addValue("remarks", entity.getRemarks())
|
||||
.addValue("createTime", now)
|
||||
.addValue("createdBy", loginId)
|
||||
|
|
Loading…
Reference in New Issue