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