Compare commits

..

2 Commits

Author SHA1 Message Date
ZhouXY108 cc3c4be8de 升级 hutool。 2023-03-14 18:10:02 +08:00
ZhouXY108 1e31e1f327 使用 Integer 接收前端的参数,而不是枚举类。 2023-03-14 10:51:11 +08:00
10 changed files with 20 additions and 23 deletions

View File

@ -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.AccountInfo;
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.MobilePhone;
import xyz.zhouxy.plusone.system.domain.model.account.Sex;
import xyz.zhouxy.plusone.system.domain.model.account.Username;
import xyz.zhouxy.plusone.util.AssertResult;
@ -67,12 +69,12 @@ public class AccountManagementService {
mobilePhone,
command.getPassword(),
command.getPasswordConfirmation(),
command.getStatus(),
AccountStatus.of(command.getStatus()),
command.getRoleRefs(),
AccountInfo.builder()
.nickname(command.getNickname())
.avatar(command.getAvatar())
.sex(command.getSex())
.sex(Sex.of(command.getSex()))
.build(),
adminAuthLogic.getLoginIdAsLong());
accountRepository.save(account);
@ -91,7 +93,7 @@ public class AccountManagementService {
Assert.isTrue(Objects.equals(id, command.getId()), "参数错误: id 不匹配");
Account account = accountRepository.find(id)
.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());
accountRepository.save(account);
}

View File

@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import xyz.zhouxy.plusone.constant.EntityStatus;
import xyz.zhouxy.plusone.domain.IWithOrderNumber;
import xyz.zhouxy.plusone.exception.DataNotExistException;
import xyz.zhouxy.plusone.system.application.exception.UnsupportedMenuTypeException;
@ -66,7 +67,7 @@ public class MenuManagementService {
command.getIcon(),
command.getHidden(),
command.getOrderNumber(),
command.getStatus(),
EntityStatus.of(command.getStatus()),
command.getRemarks());
}
@ -79,7 +80,7 @@ public class MenuManagementService {
command.getIcon(),
command.getHidden(),
command.getOrderNumber(),
command.getStatus(),
EntityStatus.of(command.getStatus()),
command.getComponent(),
command.getResource(),
command.getCache(),
@ -107,7 +108,7 @@ public class MenuManagementService {
command.getIcon(),
command.getHidden(),
command.getOrderNumber(),
command.getStatus(),
EntityStatus.of(command.getStatus()),
command.getComponent(),
command.getResource(),
command.getCache(),

View File

@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import xyz.zhouxy.plusone.constant.EntityStatus;
import xyz.zhouxy.plusone.exception.DataNotExistException;
import xyz.zhouxy.plusone.system.application.query.RoleQueries;
import xyz.zhouxy.plusone.system.application.query.params.RoleQueryParams;
@ -54,7 +55,7 @@ public class RoleManagementService {
Role roleToCreate = Role.newInstance(
command.getName(),
command.getIdentifier(),
command.getStatus(),
EntityStatus.of(command.getStatus()),
command.getRemarks(),
menuRefs,
permissionRefs);
@ -67,7 +68,7 @@ public class RoleManagementService {
roleToUpdate.update(
command.getName(),
command.getIdentifier(),
command.getStatus(),
EntityStatus.of(command.getStatus()),
command.getRemarks(),
Set.copyOf(_menuRepository.findByIdIn(command.getMenus())),
Set.copyOf(_menuRepository.findPermissionsByIdIn(command.getPermissions())));

View File

@ -12,8 +12,6 @@ import org.hibernate.validator.constraints.URL;
import lombok.Data;
import xyz.zhouxy.plusone.commons.constant.RegexConsts;
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;
@NotNull
AccountStatus status;
Integer status;
Set<Long> roleRefs;
@ -52,5 +50,5 @@ public class CreateAccountCommand implements ICommand {
@URL
String avatar;
Sex sex;
Integer sex;
}

View File

@ -5,7 +5,6 @@ import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import xyz.zhouxy.plusone.constant.EntityStatus;
import xyz.zhouxy.plusone.domain.ICommand;
import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType;
@ -42,7 +41,7 @@ public class CreateMenuCommand implements ICommand {
private Integer orderNumber;
@NotNull
private EntityStatus status;
private Integer status;
private String component;

View File

@ -6,7 +6,6 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import lombok.Data;
import xyz.zhouxy.plusone.constant.EntityStatus;
import xyz.zhouxy.plusone.domain.ICommand;
/**
@ -23,7 +22,7 @@ public class CreateRoleCommand implements ICommand {
String identifier;
@NotNull
EntityStatus status;
Integer status;
String remarks;
Set<Long> menus;

View File

@ -8,7 +8,6 @@ import org.hibernate.validator.constraints.URL;
import lombok.Data;
import xyz.zhouxy.plusone.commons.constant.RegexConsts;
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
String avatar;
Sex sex;
Integer sex;
}

View File

@ -5,7 +5,6 @@ import javax.validation.constraints.NotNull;
import lombok.Getter;
import lombok.Setter;
import xyz.zhouxy.plusone.constant.EntityStatus;
import xyz.zhouxy.plusone.domain.ICommand;
import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType;
@ -46,7 +45,7 @@ public class UpdateMenuCommand implements ICommand {
private Integer orderNumber;
@NotNull
private EntityStatus status;
private Integer status;
private String component;

View File

@ -6,7 +6,6 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import lombok.Data;
import xyz.zhouxy.plusone.constant.EntityStatus;
import xyz.zhouxy.plusone.domain.ICommand;
/**
@ -27,7 +26,7 @@ public class UpdateRoleCommand implements ICommand {
String identifier;
@NotNull
EntityStatus status;
Integer status;
@NotBlank
String remarks;

View File

@ -27,7 +27,7 @@
<spring-boot.version>2.7.9</spring-boot.version>
<sa-token.version>1.34.0</sa-token.version>
<hutool.version>5.8.14</hutool.version>
<hutool.version>5.8.15</hutool.version>
<mybatis-starter.version>3.0.1</mybatis-starter.version>
<mybatis-plus.version>3.5.3.1</mybatis-plus.version>
<commons-io.version>2.11.0</commons-io.version>