From 71a60043b32ca1b6ed0e2ac54437b1a2f4f51404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=88=9A=E8=BE=B0=E5=85=88=E7=94=9F?= Date: Sun, 1 Dec 2024 11:28:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=A7=92=E8=89=B2=E6=A0=87?= =?UTF-8?q?=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deploy/backend/api/RoleApiController.java | 17 ++++ .../backend/api/RoleTagApiController.java | 30 +++++++ .../backend/converter/RoleConverter.java | 28 ++++++- .../backend/converter/RoleTagConverter.java | 26 ++++++ .../backend/converter/UserConverter.java | 1 + .../qqchen/deploy/backend/entity/Role.java | 4 +- .../qqchen/deploy/backend/entity/RoleTag.java | 12 ++- .../backend/framework/enums/ResponseCode.java | 7 +- .../qqchen/deploy/backend/model/RoleDTO.java | 3 + .../deploy/backend/model/RoleTagDTO.java | 16 ++++ .../backend/model/query/RoleTagQuery.java | 15 ++++ .../repository/IRoleTagRepository.java | 12 +++ .../deploy/backend/service/IRoleService.java | 5 ++ .../backend/service/IRoleTagService.java | 10 +++ .../backend/service/impl/RoleServiceImpl.java | 22 +++++ .../service/impl/RoleTagServiceImpl.java | 36 ++++++++ .../src/main/resources/messages.properties | 83 ++++++++++--------- .../src/main/resources/messages_en.properties | 5 +- .../main/resources/messages_zh_CN.properties | 78 ++++++++--------- 19 files changed, 325 insertions(+), 85 deletions(-) create mode 100644 backend/src/main/java/com/qqchen/deploy/backend/api/RoleTagApiController.java create mode 100644 backend/src/main/java/com/qqchen/deploy/backend/converter/RoleTagConverter.java create mode 100644 backend/src/main/java/com/qqchen/deploy/backend/model/RoleTagDTO.java create mode 100644 backend/src/main/java/com/qqchen/deploy/backend/model/query/RoleTagQuery.java create mode 100644 backend/src/main/java/com/qqchen/deploy/backend/repository/IRoleTagRepository.java create mode 100644 backend/src/main/java/com/qqchen/deploy/backend/service/IRoleTagService.java create mode 100644 backend/src/main/java/com/qqchen/deploy/backend/service/impl/RoleTagServiceImpl.java diff --git a/backend/src/main/java/com/qqchen/deploy/backend/api/RoleApiController.java b/backend/src/main/java/com/qqchen/deploy/backend/api/RoleApiController.java index 13aaa950..75e740a9 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/api/RoleApiController.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/api/RoleApiController.java @@ -1,10 +1,17 @@ package com.qqchen.deploy.backend.api; import com.qqchen.deploy.backend.entity.Role; +import com.qqchen.deploy.backend.framework.api.Response; import com.qqchen.deploy.backend.framework.controller.BaseController; import com.qqchen.deploy.backend.model.RoleDTO; import com.qqchen.deploy.backend.model.query.RoleQuery; +import com.qqchen.deploy.backend.service.IRoleService; +import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -15,6 +22,16 @@ import java.util.List; @RequestMapping("/api/v1/role") public class RoleApiController extends BaseController { + @Resource + private IRoleService roleService; + + @Operation(summary = "分配标签") + @PostMapping("/{id}/tags") + public Response assignTags(@PathVariable Long id, @RequestBody List tagIds) { + roleService.assignTags(id, tagIds); + return Response.success(); + } + @Override protected void exportData(jakarta.servlet.http.HttpServletResponse response, List data) { // TODO: 实现导出功能 diff --git a/backend/src/main/java/com/qqchen/deploy/backend/api/RoleTagApiController.java b/backend/src/main/java/com/qqchen/deploy/backend/api/RoleTagApiController.java new file mode 100644 index 00000000..9d6293be --- /dev/null +++ b/backend/src/main/java/com/qqchen/deploy/backend/api/RoleTagApiController.java @@ -0,0 +1,30 @@ +package com.qqchen.deploy.backend.api; + +import com.qqchen.deploy.backend.entity.RoleTag; +import com.qqchen.deploy.backend.framework.controller.BaseController; +import com.qqchen.deploy.backend.framework.query.BaseQuery; +import com.qqchen.deploy.backend.model.RoleTagDTO; +import com.qqchen.deploy.backend.model.query.RoleTagQuery; +import com.qqchen.deploy.backend.service.IRoleTagService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import java.util.List; + +@Tag(name = "角色标签管理") +@RestController +@RequestMapping("/api/v1/role-tag") +public class RoleTagApiController extends BaseController { + + @Resource + private IRoleTagService roleTagService; + + @Override + protected void exportData(HttpServletResponse response, List data) { + + } +} \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/converter/RoleConverter.java b/backend/src/main/java/com/qqchen/deploy/backend/converter/RoleConverter.java index ab748597..58b68b23 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/converter/RoleConverter.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/converter/RoleConverter.java @@ -4,8 +4,34 @@ import com.qqchen.deploy.backend.model.RoleDTO; import com.qqchen.deploy.backend.entity.Role; import com.qqchen.deploy.backend.framework.converter.BaseConverter; import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.Mappings; @Mapper(config = BaseConverter.class) public interface RoleConverter extends BaseConverter { - // MapStruct 会自动实现所有方法 + + @Override + @Mappings({ + @Mapping(target = "id", ignore = true), + @Mapping(target = "createTime", ignore = true), + @Mapping(target = "createBy", ignore = true), + @Mapping(target = "updateTime", ignore = true), + @Mapping(target = "updateBy", ignore = true), + @Mapping(target = "version", ignore = true), + @Mapping(target = "deleted", ignore = true) + }) + void updateEntity(@MappingTarget Role entity, RoleDTO dto); + + @Override + @Mappings({ + @Mapping(target = "tags", source = "tags") + }) + RoleDTO toDto(Role entity); + + @Override + @Mappings({ + @Mapping(target = "tags", source = "tags") + }) + Role toEntity(RoleDTO dto); } \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/converter/RoleTagConverter.java b/backend/src/main/java/com/qqchen/deploy/backend/converter/RoleTagConverter.java new file mode 100644 index 00000000..b3e88cc6 --- /dev/null +++ b/backend/src/main/java/com/qqchen/deploy/backend/converter/RoleTagConverter.java @@ -0,0 +1,26 @@ +package com.qqchen.deploy.backend.converter; + +import com.qqchen.deploy.backend.entity.RoleTag; +import com.qqchen.deploy.backend.framework.converter.BaseConverter; +import com.qqchen.deploy.backend.model.RoleTagDTO; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.Mappings; + +@Mapper(config = BaseConverter.class) +public interface RoleTagConverter extends BaseConverter { + + @Override + @Mappings({ + @Mapping(target = "id", ignore = true), + @Mapping(target = "roles", ignore = true), + @Mapping(target = "createTime", ignore = true), + @Mapping(target = "createBy", ignore = true), + @Mapping(target = "updateTime", ignore = true), + @Mapping(target = "updateBy", ignore = true), + @Mapping(target = "version", ignore = true), + @Mapping(target = "deleted", ignore = true) + }) + void updateEntity(@MappingTarget RoleTag entity, RoleTagDTO dto); +} \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/converter/UserConverter.java b/backend/src/main/java/com/qqchen/deploy/backend/converter/UserConverter.java index 3ab42a5a..ef737b9f 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/converter/UserConverter.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/converter/UserConverter.java @@ -29,6 +29,7 @@ public interface UserConverter extends BaseConverter { @Mappings({ @Mapping(target = "id", ignore = true), @Mapping(target = "password", ignore = true), + @Mapping(target = "roles", ignore = true), @Mapping(target = "createTime", ignore = true), @Mapping(target = "createBy", ignore = true), @Mapping(target = "updateTime", ignore = true), diff --git a/backend/src/main/java/com/qqchen/deploy/backend/entity/Role.java b/backend/src/main/java/com/qqchen/deploy/backend/entity/Role.java index 8542bce7..5868efea 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/entity/Role.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/entity/Role.java @@ -14,7 +14,7 @@ import java.util.HashSet; import java.util.Set; @Data -@EqualsAndHashCode(callSuper = true) +@EqualsAndHashCode(callSuper = true, exclude = {"menus", "tags"}) @jakarta.persistence.Entity @Table(name = "sys_role") @LogicDelete @@ -40,7 +40,7 @@ public class Role extends Entity { ) private Set menus = new HashSet<>(); - @ManyToMany(fetch = FetchType.LAZY) + @ManyToMany(fetch = FetchType.EAGER) @JoinTable( name = "sys_role_tag_relation", joinColumns = @JoinColumn(name = "role_id"), diff --git a/backend/src/main/java/com/qqchen/deploy/backend/entity/RoleTag.java b/backend/src/main/java/com/qqchen/deploy/backend/entity/RoleTag.java index 561e1aef..7d65e836 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/entity/RoleTag.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/entity/RoleTag.java @@ -1,10 +1,12 @@ package com.qqchen.deploy.backend.entity; +import com.qqchen.deploy.backend.framework.annotation.LogicDelete; import com.qqchen.deploy.backend.framework.domain.Entity; import jakarta.persistence.Column; -import jakarta.persistence.ManyToMany; import jakarta.persistence.Table; +import jakarta.persistence.ManyToMany; import lombok.Data; +import lombok.EqualsAndHashCode; import java.util.HashSet; import java.util.Set; @@ -13,8 +15,10 @@ import java.util.Set; * 角色标签实体 */ @Data +@EqualsAndHashCode(callSuper = true, exclude = "roles") @jakarta.persistence.Entity @Table(name = "sys_role_tag") +@LogicDelete public class RoleTag extends Entity { /** @@ -29,6 +33,12 @@ public class RoleTag extends Entity { @Column(length = 20) private String color; + /** + * 标签描述 + */ + @Column(length = 200) + private String description; + /** * 关联的角色列表 */ diff --git a/backend/src/main/java/com/qqchen/deploy/backend/framework/enums/ResponseCode.java b/backend/src/main/java/com/qqchen/deploy/backend/framework/enums/ResponseCode.java index fb52ac27..76bf39a0 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/framework/enums/ResponseCode.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/framework/enums/ResponseCode.java @@ -44,7 +44,12 @@ public enum ResponseCode { // JWT相关错误码 (2200-2299) JWT_EXPIRED(2200, "jwt.token.expired"), JWT_INVALID(2201, "jwt.token.invalid"), - JWT_MISSING(2202, "jwt.token.missing"); + JWT_MISSING(2202, "jwt.token.missing"), + + // 角色标签相关错误码 (4300-4399) + ROLE_TAG_NAME_EXISTS(4300, "role.tag.name.exists"), + ROLE_TAG_NOT_FOUND(4301, "role.tag.not.found"), + ROLE_TAG_IN_USE(4302, "role.tag.in.use"); private final int code; private final String messageKey; // 国际化消息key diff --git a/backend/src/main/java/com/qqchen/deploy/backend/model/RoleDTO.java b/backend/src/main/java/com/qqchen/deploy/backend/model/RoleDTO.java index c912d428..042f1cfe 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/model/RoleDTO.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/model/RoleDTO.java @@ -3,6 +3,7 @@ package com.qqchen.deploy.backend.model; import com.qqchen.deploy.backend.framework.dto.BaseDTO; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.Set; @Data @EqualsAndHashCode(callSuper = true) @@ -16,4 +17,6 @@ public class RoleDTO extends BaseDTO { private Integer sort; + private Set tags; + } \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/model/RoleTagDTO.java b/backend/src/main/java/com/qqchen/deploy/backend/model/RoleTagDTO.java new file mode 100644 index 00000000..e5efd7b0 --- /dev/null +++ b/backend/src/main/java/com/qqchen/deploy/backend/model/RoleTagDTO.java @@ -0,0 +1,16 @@ +package com.qqchen.deploy.backend.model; + +import com.qqchen.deploy.backend.framework.dto.BaseDTO; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class RoleTagDTO extends BaseDTO { + + private String name; + + private String color; + + private String description; +} \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/model/query/RoleTagQuery.java b/backend/src/main/java/com/qqchen/deploy/backend/model/query/RoleTagQuery.java new file mode 100644 index 00000000..a2487ee1 --- /dev/null +++ b/backend/src/main/java/com/qqchen/deploy/backend/model/query/RoleTagQuery.java @@ -0,0 +1,15 @@ +package com.qqchen.deploy.backend.model.query; + +import com.qqchen.deploy.backend.framework.query.BaseQuery; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class RoleTagQuery extends BaseQuery { + + /** + * 标签名称 + */ + private String name; +} \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/repository/IRoleTagRepository.java b/backend/src/main/java/com/qqchen/deploy/backend/repository/IRoleTagRepository.java new file mode 100644 index 00000000..1c9d9c39 --- /dev/null +++ b/backend/src/main/java/com/qqchen/deploy/backend/repository/IRoleTagRepository.java @@ -0,0 +1,12 @@ +package com.qqchen.deploy.backend.repository; + +import com.qqchen.deploy.backend.entity.RoleTag; +import com.qqchen.deploy.backend.framework.repository.IBaseRepository; +import org.springframework.stereotype.Repository; +import java.util.List; + +@Repository +public interface IRoleTagRepository extends IBaseRepository { + + boolean existsByNameAndDeletedFalse(String name); +} \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/service/IRoleService.java b/backend/src/main/java/com/qqchen/deploy/backend/service/IRoleService.java index 35a6cf12..52f93ac7 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/service/IRoleService.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/service/IRoleService.java @@ -22,4 +22,9 @@ public interface IRoleService extends IBaseService { * 获取用户的所有角色ID */ List getUserRoleIds(Long userId); + + /** + * 分配标签 + */ + void assignTags(Long roleId, List tagIds); } \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/service/IRoleTagService.java b/backend/src/main/java/com/qqchen/deploy/backend/service/IRoleTagService.java new file mode 100644 index 00000000..0920081e --- /dev/null +++ b/backend/src/main/java/com/qqchen/deploy/backend/service/IRoleTagService.java @@ -0,0 +1,10 @@ +package com.qqchen.deploy.backend.service; + +import com.qqchen.deploy.backend.entity.RoleTag; +import com.qqchen.deploy.backend.framework.service.IBaseService; +import com.qqchen.deploy.backend.model.RoleTagDTO; +import java.util.List; + +public interface IRoleTagService extends IBaseService { + +} \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/service/impl/RoleServiceImpl.java b/backend/src/main/java/com/qqchen/deploy/backend/service/impl/RoleServiceImpl.java index ba1afa20..30f791aa 100644 --- a/backend/src/main/java/com/qqchen/deploy/backend/service/impl/RoleServiceImpl.java +++ b/backend/src/main/java/com/qqchen/deploy/backend/service/impl/RoleServiceImpl.java @@ -1,19 +1,24 @@ package com.qqchen.deploy.backend.service.impl; import com.qqchen.deploy.backend.entity.Role; +import com.qqchen.deploy.backend.entity.RoleTag; import com.qqchen.deploy.backend.framework.enums.ResponseCode; import com.qqchen.deploy.backend.framework.exception.BusinessException; import com.qqchen.deploy.backend.framework.exception.UniqueConstraintException; import com.qqchen.deploy.backend.model.RoleDTO; import com.qqchen.deploy.backend.framework.service.impl.BaseServiceImpl; import com.qqchen.deploy.backend.repository.IRoleRepository; +import com.qqchen.deploy.backend.repository.IRoleTagRepository; import com.qqchen.deploy.backend.service.IRoleService; import com.qqchen.deploy.backend.framework.annotation.ServiceType; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import jakarta.annotation.Resource; +import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; import static com.qqchen.deploy.backend.framework.annotation.ServiceType.Type.DATABASE; @@ -25,6 +30,9 @@ public class RoleServiceImpl extends BaseServiceImpl implem @Resource private IRoleRepository roleRepository; + @Resource + private IRoleTagRepository roleTagRepository; + @Override public List getUserRoleIds(Long userId) { return roleRepository.findRoleIdsByUserId(userId); @@ -56,4 +64,18 @@ public class RoleServiceImpl extends BaseServiceImpl implem throw new UniqueConstraintException(ResponseCode.ROLE_NAME_EXISTS, "name", dto.getName()); } } + + @Override + @Transactional + public void assignTags(Long roleId, List tagIds) { + Role role = findEntityById(roleId); + // 先清除原有关系 + role.getTags().clear(); + // 设置新的关系 + Set tags = roleTagRepository.findAllById(tagIds) + .stream() + .collect(Collectors.toSet()); + role.setTags(tags); + roleRepository.save(role); + } } \ No newline at end of file diff --git a/backend/src/main/java/com/qqchen/deploy/backend/service/impl/RoleTagServiceImpl.java b/backend/src/main/java/com/qqchen/deploy/backend/service/impl/RoleTagServiceImpl.java new file mode 100644 index 00000000..dfda11f0 --- /dev/null +++ b/backend/src/main/java/com/qqchen/deploy/backend/service/impl/RoleTagServiceImpl.java @@ -0,0 +1,36 @@ +package com.qqchen.deploy.backend.service.impl; + +import com.qqchen.deploy.backend.entity.RoleTag; +import com.qqchen.deploy.backend.framework.enums.ResponseCode; +import com.qqchen.deploy.backend.framework.exception.UniqueConstraintException; +import com.qqchen.deploy.backend.framework.service.impl.BaseServiceImpl; +import com.qqchen.deploy.backend.model.RoleTagDTO; +import com.qqchen.deploy.backend.repository.IRoleTagRepository; +import com.qqchen.deploy.backend.service.IRoleTagService; +import com.qqchen.deploy.backend.framework.annotation.ServiceType; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import jakarta.annotation.Resource; +import java.util.List; + +import static com.qqchen.deploy.backend.framework.annotation.ServiceType.Type.DATABASE; + +@Slf4j +@Service +@ServiceType(DATABASE) +public class RoleTagServiceImpl extends BaseServiceImpl implements IRoleTagService { + + @Resource + private IRoleTagRepository roleTagRepository; + + + + + @Override + protected void validateUniqueConstraints(RoleTagDTO dto) { + // 检查标签名称唯一性 + if (roleTagRepository.existsByNameAndDeletedFalse(dto.getName())) { + throw new UniqueConstraintException(ResponseCode.ROLE_TAG_NAME_EXISTS, "name", dto.getName()); + } + } +} \ No newline at end of file diff --git a/backend/src/main/resources/messages.properties b/backend/src/main/resources/messages.properties index 760340d4..e102c95c 100644 --- a/backend/src/main/resources/messages.properties +++ b/backend/src/main/resources/messages.properties @@ -1,49 +1,52 @@ -# 通用响应 -response.success=操作成功 -response.error=系统错误 -response.invalid.param=无效的参数 -response.unauthorized=未授权 -response.forbidden=禁止访问 -response.not.found=资源未找到 -response.conflict=资源冲突 -response.unauthorized.full=访问此资源需要完全身份验证 +# \u901A\u7528\u54CD\u5E94 +response.success=\u64CD\u4F5C\u6210\u529F +response.error=\u7CFB\u7EDF\u9519\u8BEF +response.invalid.param=\u65E0\u6548\u7684\u53C2\u6570 +response.unauthorized=\u672A\u6388\u6743 +response.forbidden=\u7981\u6B62\u8BBF\u95EE +response.not.found=\u8D44\u6E90\u672A\u627E\u5230 +response.conflict=\u8D44\u6E90\u51B2\u7A81 +response.unauthorized.full=\u8BBF\u95EE\u6B64\u8D44\u6E90\u9700\u8981\u5B8C\u5168\u8EAB\u4EFD\u9A8C\u8BC1 -# 业务错误 -tenant.not.found=租户不存在 -data.not.found=找不到ID为{0}的{1} +# \u4E1A\u52A1\u9519\u8BEF +tenant.not.found=\u79DF\u6237\u4E0D\u5B58\u5728 +data.not.found=\u627E\u4E0D\u5230ID\u4E3A{0}\u7684{1} -# 用户相关 -user.not.found=用户不存在 -user.username.exists=用户名"{0}"已存在 -user.email.exists=邮箱"{0}"已存在 -user.login.error=用户名或密码错误 +# \u7528\u6237\u76F8\u5173 +user.not.found=\u7528\u6237\u4E0D\u5B58\u5728 +user.username.exists=\u7528\u6237\u540D"{0}"\u5DF2\u5B58\u5728 +user.email.exists=\u90AE\u7BB1"{0}"\u5DF2\u5B58\u5728 +user.login.error=\u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF -# 系统异常消息 -system.optimistic.lock.error=数据已被其他用户修改,请刷新后重试 -system.pessimistic.lock.error=数据正被其他用户操作,请稍后重试 -system.concurrent.update.error=并发更新冲突,请重试 -system.retry.exceeded.error=操作重试次数超限,请稍后再试 +# \u7CFB\u7EDF\u5F02\u5E38\u6D88\u606F +system.optimistic.lock.error=\u6570\u636E\u5DF2\u88AB\u5176\u4ED6\u7528\u6237\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5 +system.pessimistic.lock.error=\u6570\u636E\u6B63\u88AB\u5176\u4ED6\u7528\u6237\u64CD\u4F5C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5 +system.concurrent.update.error=\u5E76\u53D1\u66F4\u65B0\u51B2\u7A81\uFF0C\u8BF7\u91CD\u8BD5 +system.retry.exceeded.error=\u64CD\u4F5C\u91CD\u8BD5\u6B21\u6570\u8D85\u9650\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5 # Entity Not Found Messages -entity.not.found.id=找不到ID为{0}的实体 +entity.not.found.id=\u627E\u4E0D\u5230ID\u4E3A{0}\u7684\u5B9E\u4F53 entity.not.found.message={0} -entity.not.found.name.id=找不到ID为{1}的{0} +entity.not.found.name.id=\u627E\u4E0D\u5230ID\u4E3A{1}\u7684{0} -# 依赖注入相关 -dependency.injection.service.not.found=找不到实体 {0} 对应的服务 (尝试过的bean名称: {1}) -dependency.injection.repository.not.found=找不到实体 {0} 对应的Repository: {1} -dependency.injection.converter.not.found=找不到实体 {0} 对应的Converter: {1} -dependency.injection.entitypath.failed=初始化实体 {0} 的EntityPath失败: {1} +# \u4F9D\u8D56\u6CE8\u5165\u76F8\u5173 +dependency.injection.service.not.found=\u627E\u4E0D\u5230\u5B9E\u4F53 {0} \u5BF9\u5E94\u7684\u670D\u52A1 (\u5C1D\u8BD5\u8FC7\u7684bean\u540D\u79F0: {1}) +dependency.injection.repository.not.found=\u627E\u4E0D\u5230\u5B9E\u4F53 {0} \u5BF9\u5E94\u7684Repository: {1} +dependency.injection.converter.not.found=\u627E\u4E0D\u5230\u5B9E\u4F53 {0} \u5BF9\u5E94\u7684Converter: {1} +dependency.injection.entitypath.failed=\u521D\u59CB\u5316\u5B9E\u4F53 {0} \u7684EntityPath\u5931\u8D25: {1} -# JWT相关 -jwt.token.expired=登录已过期,请重新登录 -jwt.token.invalid=无效的登录凭证 -jwt.token.missing=未提供登录凭证 +# JWT\u76F8\u5173 +jwt.token.expired=\u767B\u5F55\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u767B\u5F55 +jwt.token.invalid=\u65E0\u6548\u7684\u767B\u5F55\u51ED\u8BC1 +jwt.token.missing=\u672A\u63D0\u4F9B\u767B\u5F55\u51ED\u8BC1 -# 角色相关错误消息 -role.not.found=角色不存在 -role.code.exists=角色编码"{0}"已存在 -role.name.exists=角色名称"{0}"已存在 -role.in.use=角色正在使用中,无法删除 -role.admin.cannot.delete=不能删除超级管理员角色 -role.admin.cannot.update=不能修改超级管理员角色 \ No newline at end of file +# \u89D2\u8272\u76F8\u5173\u9519\u8BEF\u6D88\u606F +role.not.found=\u89D2\u8272\u4E0D\u5B58\u5728 +role.code.exists=\u89D2\u8272\u7F16\u7801"{0}"\u5DF2\u5B58\u5728 +role.name.exists=\u89D2\u8272\u540D\u79F0"{0}"\u5DF2\u5B58\u5728 +role.in.use=\u89D2\u8272\u6B63\u5728\u4F7F\u7528\u4E2D\uFF0C\u65E0\u6CD5\u5220\u9664 +role.admin.cannot.delete=\u4E0D\u80FD\u5220\u9664\u8D85\u7EA7\u7BA1\u7406\u5458\u89D2\u8272 +role.admin.cannot.update=\u4E0D\u80FD\u4FEE\u6539\u8D85\u7EA7\u7BA1\u7406\u5458\u89D2\u8272 +role.tag.name.exists=\u6807\u7B7E\u540D\u79F0\u5DF2\u5B58\u5728 +role.tag.not.found=\u6807\u7B7E\u4E0D\u5B58\u5728 +role.tag.in.use=\u6807\u7B7E\u6B63\u5728\u4F7F\u7528\u4E2D\uFF0C\u65E0\u6CD5\u5220\u9664 \ No newline at end of file diff --git a/backend/src/main/resources/messages_en.properties b/backend/src/main/resources/messages_en.properties index 4223b0e1..2b5f1802 100644 --- a/backend/src/main/resources/messages_en.properties +++ b/backend/src/main/resources/messages_en.properties @@ -46,4 +46,7 @@ role.code.exists=Role code already exists role.name.exists=Role name already exists role.in.use=Role is in use and cannot be deleted role.admin.cannot.delete=Cannot delete admin role -role.admin.cannot.update=Cannot update admin role \ No newline at end of file +role.admin.cannot.update=Cannot update admin role +role.tag.name.exists=Tag name already exists +role.tag.not.found=Tag not found +role.tag.in.use=Tag is in use and cannot be deleted \ No newline at end of file diff --git a/backend/src/main/resources/messages_zh_CN.properties b/backend/src/main/resources/messages_zh_CN.properties index 7b86c1af..f61c4b98 100644 --- a/backend/src/main/resources/messages_zh_CN.properties +++ b/backend/src/main/resources/messages_zh_CN.properties @@ -1,47 +1,47 @@ -# 通用响应 -response.success=操作成功 -response.error=系统错误 -response.invalid.param=无效的参数 -response.unauthorized=未授权 -response.forbidden=禁止访问 -response.not.found=资源未找到 -response.conflict=资源冲突 -response.unauthorized.full=访问此资源需要完全身份验证 +# \u901A\u7528\u54CD\u5E94 +response.success=\u64CD\u4F5C\u6210\u529F +response.error=\u7CFB\u7EDF\u9519\u8BEF +response.invalid.param=\u65E0\u6548\u7684\u53C2\u6570 +response.unauthorized=\u672A\u6388\u6743 +response.forbidden=\u7981\u6B62\u8BBF\u95EE +response.not.found=\u8D44\u6E90\u672A\u627E\u5230 +response.conflict=\u8D44\u6E90\u51B2\u7A81 +response.unauthorized.full=\u8BBF\u95EE\u6B64\u8D44\u6E90\u9700\u8981\u5B8C\u5168\u8EAB\u4EFD\u9A8C\u8BC1 -# 业务错误 -tenant.not.found=租户不存在 -data.not.found=数据不存在 +# \u4E1A\u52A1\u9519\u8BEF +tenant.not.found=\u79DF\u6237\u4E0D\u5B58\u5728 +data.not.found=\u6570\u636E\u4E0D\u5B58\u5728 -# 用户相关 -user.not.found=用户不存在 -user.username.exists=用户名已存在 -user.email.exists=邮箱已存在 -user.login.error=用户名或密码错误 +# \u7528\u6237\u76F8\u5173 +user.not.found=\u7528\u6237\u4E0D\u5B58\u5728 +user.username.exists=\u7528\u6237\u540D\u5DF2\u5B58\u5728 +user.email.exists=\u90AE\u7BB1\u5DF2\u5B58\u5728 +user.login.error=\u7528\u6237\u540D\u6216\u5BC6\u7801\u9519\u8BEF -# 系统异常消息 -system.optimistic.lock.error=数据已被其他用户修改,请刷新后重试 -system.pessimistic.lock.error=数据正被其他用户操作,请稍后重试 -system.concurrent.update.error=并发更新冲突,请重试 -system.retry.exceeded.error=操作重试次数超限,请稍后再试 +# \u7CFB\u7EDF\u5F02\u5E38\u6D88\u606F +system.optimistic.lock.error=\u6570\u636E\u5DF2\u88AB\u5176\u4ED6\u7528\u6237\u4FEE\u6539\uFF0C\u8BF7\u5237\u65B0\u540E\u91CD\u8BD5 +system.pessimistic.lock.error=\u6570\u636E\u6B63\u88AB\u5176\u4ED6\u7528\u6237\u64CD\u4F5C\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5 +system.concurrent.update.error=\u5E76\u53D1\u66F4\u65B0\u51B2\u7A81\uFF0C\u8BF7\u91CD\u8BD5 +system.retry.exceeded.error=\u64CD\u4F5C\u91CD\u8BD5\u6B21\u6570\u8D85\u9650\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5 # Entity Not Found Messages -entity.not.found.id=找不到ID为{0}的实体 +entity.not.found.id=\u627E\u4E0D\u5230ID\u4E3A{0}\u7684\u5B9E\u4F53 entity.not.found.message={0} -entity.not.found.name.id=找不到ID为{1}的{0} +entity.not.found.name.id=\u627E\u4E0D\u5230ID\u4E3A{1}\u7684{0} -# 依赖注入相关 -dependency.injection.service.not.found=找不到实体 {0} 对应的服务 (尝试过的bean名称: {1}) -dependency.injection.repository.not.found=找不到实体 {0} 对应的Repository: {1} -dependency.injection.converter.not.found=找不到实体 {0} 对应的Converter: {1} -dependency.injection.entitypath.failed=初始化实体 {0} 的EntityPath失败: {1} +# \u4F9D\u8D56\u6CE8\u5165\u76F8\u5173 +dependency.injection.service.not.found=\u627E\u4E0D\u5230\u5B9E\u4F53 {0} \u5BF9\u5E94\u7684\u670D\u52A1 (\u5C1D\u8BD5\u8FC7\u7684bean\u540D\u79F0: {1}) +dependency.injection.repository.not.found=\u627E\u4E0D\u5230\u5B9E\u4F53 {0} \u5BF9\u5E94\u7684Repository: {1} +dependency.injection.converter.not.found=\u627E\u4E0D\u5230\u5B9E\u4F53 {0} \u5BF9\u5E94\u7684Converter: {1} +dependency.injection.entitypath.failed=\u521D\u59CB\u5316\u5B9E\u4F53 {0} \u7684EntityPath\u5931\u8D25: {1} -# 角色相关错误消息 -role.not.found=角色不存在 -role.code.exists=角色编码已存在 -role.name.exists=角色名称已存在 -role.in.use=角色正在使用中,无法删除 -role.admin.cannot.delete=不能删除超级管理员角色 -role.admin.cannot.update=不能修改超级管理员角色 - -# 请求相关错误消息 -request.api.not.found=请求的API不存在: {0} \ No newline at end of file +# \u89D2\u8272\u76F8\u5173\u9519\u8BEF\u6D88\u606F +role.not.found=\u89D2\u8272\u4E0D\u5B58\u5728 +role.code.exists=\u89D2\u8272\u7F16\u7801\u5DF2\u5B58\u5728 +role.name.exists=\u89D2\u8272\u540D\u79F0\u5DF2\u5B58\u5728 +role.in.use=\u89D2\u8272\u6B63\u5728\u4F7F\u7528\u4E2D\uFF0C\u65E0\u6CD5\u5220\u9664 +role.admin.cannot.delete=\u4E0D\u80FD\u5220\u9664\u8D85\u7EA7\u7BA1\u7406\u5458\u89D2\u8272 +role.admin.cannot.update=\u4E0D\u80FD\u4FEE\u6539\u8D85\u7EA7\u7BA1\u7406\u5458\u89D2\u8272 +role.tag.name.exists=\u6807\u7B7E\u540D\u79F0\u5DF2\u5B58\u5728 +role.tag.not.found=\u6807\u7B7E\u4E0D\u5B58\u5728 +role.tag.in.use=\u6807\u7B7E\u6B63\u5728\u4F7F\u7528\u4E2D\uFF0C\u65E0\u6CD5\u5220\u9664 \ No newline at end of file