使用 Integer 接收前端的参数,而不是枚举类。
parent
993ba7fa7b
commit
1e31e1f327
|
@ -26,8 +26,10 @@ import xyz.zhouxy.plusone.system.application.service.command.UpdateAccountComman
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.Account;
|
import xyz.zhouxy.plusone.system.domain.model.account.Account;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.AccountInfo;
|
import xyz.zhouxy.plusone.system.domain.model.account.AccountInfo;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.AccountRepository;
|
import xyz.zhouxy.plusone.system.domain.model.account.AccountRepository;
|
||||||
|
import xyz.zhouxy.plusone.system.domain.model.account.AccountStatus;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.Email;
|
import xyz.zhouxy.plusone.system.domain.model.account.Email;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.MobilePhone;
|
import xyz.zhouxy.plusone.system.domain.model.account.MobilePhone;
|
||||||
|
import xyz.zhouxy.plusone.system.domain.model.account.Sex;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.Username;
|
import xyz.zhouxy.plusone.system.domain.model.account.Username;
|
||||||
import xyz.zhouxy.plusone.util.AssertResult;
|
import xyz.zhouxy.plusone.util.AssertResult;
|
||||||
|
|
||||||
|
@ -67,12 +69,12 @@ public class AccountManagementService {
|
||||||
mobilePhone,
|
mobilePhone,
|
||||||
command.getPassword(),
|
command.getPassword(),
|
||||||
command.getPasswordConfirmation(),
|
command.getPasswordConfirmation(),
|
||||||
command.getStatus(),
|
AccountStatus.of(command.getStatus()),
|
||||||
command.getRoleRefs(),
|
command.getRoleRefs(),
|
||||||
AccountInfo.builder()
|
AccountInfo.builder()
|
||||||
.nickname(command.getNickname())
|
.nickname(command.getNickname())
|
||||||
.avatar(command.getAvatar())
|
.avatar(command.getAvatar())
|
||||||
.sex(command.getSex())
|
.sex(Sex.of(command.getSex()))
|
||||||
.build(),
|
.build(),
|
||||||
adminAuthLogic.getLoginIdAsLong());
|
adminAuthLogic.getLoginIdAsLong());
|
||||||
accountRepository.save(account);
|
accountRepository.save(account);
|
||||||
|
@ -91,7 +93,7 @@ public class AccountManagementService {
|
||||||
Assert.isTrue(Objects.equals(id, command.getId()), "参数错误: id 不匹配");
|
Assert.isTrue(Objects.equals(id, command.getId()), "参数错误: id 不匹配");
|
||||||
Account account = accountRepository.find(id)
|
Account account = accountRepository.find(id)
|
||||||
.orElseThrow(() -> new DataNotExistException("该账号不存在"));
|
.orElseThrow(() -> new DataNotExistException("该账号不存在"));
|
||||||
account.setAccountInfo(command.getNickname(), command.getAvatar(), command.getSex());
|
account.setAccountInfo(command.getNickname(), command.getAvatar(), Sex.of(command.getSex()));
|
||||||
account.setUpdatedBy(adminAuthLogic.getLoginIdAsLong());
|
account.setUpdatedBy(adminAuthLogic.getLoginIdAsLong());
|
||||||
accountRepository.save(account);
|
accountRepository.save(account);
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import xyz.zhouxy.plusone.constant.EntityStatus;
|
||||||
import xyz.zhouxy.plusone.domain.IWithOrderNumber;
|
import xyz.zhouxy.plusone.domain.IWithOrderNumber;
|
||||||
import xyz.zhouxy.plusone.exception.DataNotExistException;
|
import xyz.zhouxy.plusone.exception.DataNotExistException;
|
||||||
import xyz.zhouxy.plusone.system.application.exception.UnsupportedMenuTypeException;
|
import xyz.zhouxy.plusone.system.application.exception.UnsupportedMenuTypeException;
|
||||||
|
@ -66,7 +67,7 @@ public class MenuManagementService {
|
||||||
command.getIcon(),
|
command.getIcon(),
|
||||||
command.getHidden(),
|
command.getHidden(),
|
||||||
command.getOrderNumber(),
|
command.getOrderNumber(),
|
||||||
command.getStatus(),
|
EntityStatus.of(command.getStatus()),
|
||||||
command.getRemarks());
|
command.getRemarks());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ public class MenuManagementService {
|
||||||
command.getIcon(),
|
command.getIcon(),
|
||||||
command.getHidden(),
|
command.getHidden(),
|
||||||
command.getOrderNumber(),
|
command.getOrderNumber(),
|
||||||
command.getStatus(),
|
EntityStatus.of(command.getStatus()),
|
||||||
command.getComponent(),
|
command.getComponent(),
|
||||||
command.getResource(),
|
command.getResource(),
|
||||||
command.getCache(),
|
command.getCache(),
|
||||||
|
@ -107,7 +108,7 @@ public class MenuManagementService {
|
||||||
command.getIcon(),
|
command.getIcon(),
|
||||||
command.getHidden(),
|
command.getHidden(),
|
||||||
command.getOrderNumber(),
|
command.getOrderNumber(),
|
||||||
command.getStatus(),
|
EntityStatus.of(command.getStatus()),
|
||||||
command.getComponent(),
|
command.getComponent(),
|
||||||
command.getResource(),
|
command.getResource(),
|
||||||
command.getCache(),
|
command.getCache(),
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import xyz.zhouxy.plusone.constant.EntityStatus;
|
||||||
import xyz.zhouxy.plusone.exception.DataNotExistException;
|
import xyz.zhouxy.plusone.exception.DataNotExistException;
|
||||||
import xyz.zhouxy.plusone.system.application.query.RoleQueries;
|
import xyz.zhouxy.plusone.system.application.query.RoleQueries;
|
||||||
import xyz.zhouxy.plusone.system.application.query.params.RoleQueryParams;
|
import xyz.zhouxy.plusone.system.application.query.params.RoleQueryParams;
|
||||||
|
@ -54,7 +55,7 @@ public class RoleManagementService {
|
||||||
Role roleToCreate = Role.newInstance(
|
Role roleToCreate = Role.newInstance(
|
||||||
command.getName(),
|
command.getName(),
|
||||||
command.getIdentifier(),
|
command.getIdentifier(),
|
||||||
command.getStatus(),
|
EntityStatus.of(command.getStatus()),
|
||||||
command.getRemarks(),
|
command.getRemarks(),
|
||||||
menuRefs,
|
menuRefs,
|
||||||
permissionRefs);
|
permissionRefs);
|
||||||
|
@ -67,7 +68,7 @@ public class RoleManagementService {
|
||||||
roleToUpdate.update(
|
roleToUpdate.update(
|
||||||
command.getName(),
|
command.getName(),
|
||||||
command.getIdentifier(),
|
command.getIdentifier(),
|
||||||
command.getStatus(),
|
EntityStatus.of(command.getStatus()),
|
||||||
command.getRemarks(),
|
command.getRemarks(),
|
||||||
Set.copyOf(_menuRepository.findByIdIn(command.getMenus())),
|
Set.copyOf(_menuRepository.findByIdIn(command.getMenus())),
|
||||||
Set.copyOf(_menuRepository.findPermissionsByIdIn(command.getPermissions())));
|
Set.copyOf(_menuRepository.findPermissionsByIdIn(command.getPermissions())));
|
||||||
|
|
|
@ -12,8 +12,6 @@ import org.hibernate.validator.constraints.URL;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import xyz.zhouxy.plusone.commons.constant.RegexConsts;
|
import xyz.zhouxy.plusone.commons.constant.RegexConsts;
|
||||||
import xyz.zhouxy.plusone.domain.ICommand;
|
import xyz.zhouxy.plusone.domain.ICommand;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.AccountStatus;
|
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.Sex;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建账号命令
|
* 创建账号命令
|
||||||
|
@ -41,7 +39,7 @@ public class CreateAccountCommand implements ICommand {
|
||||||
String passwordConfirmation;
|
String passwordConfirmation;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
AccountStatus status;
|
Integer status;
|
||||||
|
|
||||||
Set<Long> roleRefs;
|
Set<Long> roleRefs;
|
||||||
|
|
||||||
|
@ -52,5 +50,5 @@ public class CreateAccountCommand implements ICommand {
|
||||||
@URL
|
@URL
|
||||||
String avatar;
|
String avatar;
|
||||||
|
|
||||||
Sex sex;
|
Integer sex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import xyz.zhouxy.plusone.constant.EntityStatus;
|
|
||||||
import xyz.zhouxy.plusone.domain.ICommand;
|
import xyz.zhouxy.plusone.domain.ICommand;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType;
|
import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType;
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ public class CreateMenuCommand implements ICommand {
|
||||||
private Integer orderNumber;
|
private Integer orderNumber;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private EntityStatus status;
|
private Integer status;
|
||||||
|
|
||||||
private String component;
|
private String component;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import xyz.zhouxy.plusone.constant.EntityStatus;
|
|
||||||
import xyz.zhouxy.plusone.domain.ICommand;
|
import xyz.zhouxy.plusone.domain.ICommand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +22,7 @@ public class CreateRoleCommand implements ICommand {
|
||||||
String identifier;
|
String identifier;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
EntityStatus status;
|
Integer status;
|
||||||
String remarks;
|
String remarks;
|
||||||
|
|
||||||
Set<Long> menus;
|
Set<Long> menus;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import org.hibernate.validator.constraints.URL;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import xyz.zhouxy.plusone.commons.constant.RegexConsts;
|
import xyz.zhouxy.plusone.commons.constant.RegexConsts;
|
||||||
import xyz.zhouxy.plusone.domain.ICommand;
|
import xyz.zhouxy.plusone.domain.ICommand;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.account.Sex;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新账号信息命令
|
* 更新账号信息命令
|
||||||
|
@ -27,5 +26,5 @@ public class UpdateAccountCommand implements ICommand {
|
||||||
@URL
|
@URL
|
||||||
String avatar;
|
String avatar;
|
||||||
|
|
||||||
Sex sex;
|
Integer sex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import xyz.zhouxy.plusone.constant.EntityStatus;
|
|
||||||
import xyz.zhouxy.plusone.domain.ICommand;
|
import xyz.zhouxy.plusone.domain.ICommand;
|
||||||
import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType;
|
import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType;
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ public class UpdateMenuCommand implements ICommand {
|
||||||
private Integer orderNumber;
|
private Integer orderNumber;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private EntityStatus status;
|
private Integer status;
|
||||||
|
|
||||||
private String component;
|
private String component;
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import xyz.zhouxy.plusone.constant.EntityStatus;
|
|
||||||
import xyz.zhouxy.plusone.domain.ICommand;
|
import xyz.zhouxy.plusone.domain.ICommand;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +26,7 @@ public class UpdateRoleCommand implements ICommand {
|
||||||
String identifier;
|
String identifier;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
EntityStatus status;
|
Integer status;
|
||||||
|
|
||||||
@NotBlank
|
@NotBlank
|
||||||
String remarks;
|
String remarks;
|
||||||
|
|
Loading…
Reference in New Issue