Skip to content

Conversation

@lu-yg
Copy link
Collaborator

@lu-yg lu-yg commented Jun 13, 2025

English | 简体中文

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • Built its own designer, fully self-validated

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

Background and solution

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Chores
    • Updated backend service components to inherit enhanced base functionalities, potentially improving consistency and maintainability.
    • Upgraded OpenAPI documentation dependency to a newer version for improved compatibility and features.

@coderabbitai
Copy link

coderabbitai bot commented Jun 13, 2025

Walkthrough

This update refactors multiple service interfaces and their implementations to extend MyBatis-Plus's generic IService and ServiceImpl classes, respectively, across application, material, and platform modules. Additionally, the Maven POM replaces the springdoc-openapi-ui dependency with the newer springdoc-openapi-starter-webmvc-ui version, updating both the artifact and version.

Changes

Files/Paths Change Summary
.../service/app/*Service.java
.../service/material/*Service.java
.../service/platform/*Service.java
Service interfaces now extend MyBatis-Plus's IService<Entity>, integrating default CRUD operations.
.../service/app/impl/*ServiceImpl.java
.../service/material/impl/*ServiceImpl.java
.../service/platform/impl/*ServiceImpl.java
Service implementation classes now extend ServiceImpl<Mapper, Entity> from MyBatis-Plus.
pom.xml Replaces springdoc-openapi-ui v1.6.14 with springdoc-openapi-starter-webmvc-ui v2.5.0.

Sequence Diagram(s)

sequenceDiagram
    participant Controller
    participant ServiceImpl
    participant Mapper
    participant Database

    Controller->>ServiceImpl: callServiceMethod()
    ServiceImpl->>Mapper: callMapperMethod()
    Mapper->>Database: execute SQL
    Database-->>Mapper: return results
    Mapper-->>ServiceImpl: return data
    ServiceImpl-->>Controller: return response
Loading

Poem

In the warren of code, a hop and a leap,
Services now inherit, their CRUD not so deep.
With MyBatis-Plus, the chores are less hairy,
And OpenAPI docs are now modern and merry.
A carrot for progress, a thump for the team—
This rabbit approves of the streamlined scheme! 🥕

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Commit Unit Tests in branch feat/develop
  • Post Copyable Unit Tests in Comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🔭 Outside diff range comments (5)
base/src/main/java/com/tinyengine/it/service/app/PageService.java (1)

30-87: 🛠️ Refactor suggestion

Re-evaluate custom CRUD wrappers after switching to IService

Now that the interface extends IService<Page>, default CRUD helpers (save, updateById, removeById, list, etc.) are already available. The bespoke variants createPage, delPage, updatePage, etc. duplicate that functionality and may confuse users about the “preferred” API.

Consider either:

  1. Removing the custom methods and delegating to the generic ones, or
  2. Renaming them to truly domain-specific operations that wrap extra logic beyond a plain CRUD call.
base/src/main/java/com/tinyengine/it/service/app/I18nEntryService.java (1)

36-99: 🛠️ Refactor suggestion

Potential overlap with IService CRUD

After inheriting IService<I18nEntry>, methods like updateI18nEntryById, bulkCreate, bulkUpdate, etc. partially overlap with IService’s updateById, saveBatch, and updateBatchById. Audit these signatures and consolidate where possible to reduce surface area and cognitive load.

base/src/main/java/com/tinyengine/it/service/platform/PlatformHistoryService.java (1)

28-75: 🛠️ Refactor suggestion

Duplicate CRUD verbs versus IService

Methods like deletePlatformHistoryById, updatePlatformHistoryById, and createPlatformHistory now parallel removeById, updateById, and save. Streamline to maintain a single CRUD vocabulary.

base/src/main/java/com/tinyengine/it/service/app/impl/DatasourceServiceImpl.java (1)

104-113: ⚠️ Potential issue

Missing return causes wrong error code and mis-reports failure

If res != 1, the code calls Result.failed(ExceptionEnum.CM001); but doesn’t return it, so execution falls through and returns CM002 instead.

-            int res = datasourceMapper.createDatasource(datasource);
-            if (res == 1) {
-                int id = datasource.getId();
-                return Result.success(queryDatasourceById(id));
-            } else {
-                Result.failed(ExceptionEnum.CM001);
-            }
+            int res = datasourceMapper.createDatasource(datasource);
+            if (res == 1) {
+                return Result.success(queryDatasourceById(datasource.getId()));
+            }
+            return Result.failed(ExceptionEnum.CM001);

While here, also guard against null names to avoid NullPointerException:

String name = datasource.getName();
if (appId > 0 && StringUtils.hasText(name)) {
    ...
}
base/src/main/java/com/tinyengine/it/service/app/AppService.java (1)

15-24: 🛠️ Refactor suggestion

@Param imports don’t belong in a service interface

org.apache.ibatis.annotations.Param is meant for mapper signatures, not service APIs. It leaks persistence-layer details into the service layer and couples callers to MyBatis.

Delete the annotation (and the import) from all method signatures; parameter names are preserved by the compiler when using -parameters.

♻️ Duplicate comments (1)
base/src/main/java/com/tinyengine/it/service/platform/TenantService.java (1)

15-16: Same duplication caveat as in DatasourceService

TenantService now exposes both IService<Tenant> CRUD and bespoke find* / delete*
methods. Audit the interface for redundant operations and either rely on the generic
CRUD helpers or rename / remove overlapping ones for clarity.

Also applies to: 27-27

🧹 Nitpick comments (40)
base/src/main/java/com/tinyengine/it/service/app/DatasourceService.java (1)

15-16: IService<Datasource> gives you CRUD – reconsider the extra bespoke CRUD-like methods

By extending IService<Datasource> the interface already inherits:

  • getById(id)
  • save(entity)
  • updateById(entity)
  • removeById(id)
  • etc.

The custom queryDatasourceById, deleteDatasourceById, createDatasource, … now duplicate
functionality and add a second vocabulary (query*, delete*, create*) that future
contributors have to learn.

Consider either:

  1. Relying on the default IService CRUD helpers and keeping only the truly
    domain-specific queries; or
  2. Keeping the custom methods but dropping the IService inheritance to avoid an API
    surface that does the same thing twice.

This keeps the service contract minimal and avoids maintenance overhead.

Also applies to: 28-28

base/src/main/java/com/tinyengine/it/service/app/PageTemplateService.java (1)

15-16: Check return-type consistency with IService

IService<PageTemplate> already declares removeByIds(Collection<?>).
The custom deletePageTemplateByIds(List<Integer>) overlaps but wraps the integer in
Result<>, creating two different ways to delete records.

This asymmetry can confuse callers and complicate transactional handling.
Standardise on one approach (plain boolean / count vs. wrapped Result)
across the whole service layer.

Also applies to: 28-28

base/src/main/java/com/tinyengine/it/service/material/BlockService.java (1)

15-17: Potential name clash with MyBatis-Plus paging helpers

BlockService defines findBlocksByPagetionList and findBlocksByConditionPagetion
while IService + ServiceImpl already give you page(Page,Wrapper).

If you keep the custom names:

  • Fix the typo “Pagetion” → “Pagination”.
  • Document why the built-in page helper is insufficient (e.g., extra joins).

Otherwise consider deleting these methods and delegate to IService#page in the
implementation to reduce surface area.

Also applies to: 36-36

base/src/main/java/com/tinyengine/it/service/app/UserService.java (1)

15-16: Consider pruning redundant CRUD methods after introducing IService

Now that the interface inherits all generic CRUD helpers from IService<User>, several hand-rolled methods (createUser, deleteUserById, updateUserById, queryUserById, etc.) overlap in responsibility with save, removeById, updateById, getById, list, … supplied by MyBatis-Plus.
Keeping both sets increases surface area, maintenance cost, and the risk of divergent behaviour.

If project conventions allow, deprecate or remove the bespoke variants and let callers use the standard ones. At minimum, add JavaDoc explaining why both coexist.

Also applies to: 27-27

base/src/main/java/com/tinyengine/it/service/material/BusinessCategoryService.java (1)

15-16: Same duplication concern as in UserService

Extending IService<BusinessCategory> already exposes list(), getById(), save(), removeById() and others. Re-evaluating the custom CRUD-style methods could slim the API and avoid confusion.

Also applies to: 27-27

base/src/main/java/com/tinyengine/it/service/app/I18nLangService.java (1)

15-16: Potential overlap between MyBatis-Plus defaults and bespoke calls

IService<I18nLang> exposes generic CRUD helpers identical in purpose to createI18nLang, deleteI18nLangById, etc.
Unless these methods add extra business constraints (validation, auditing…), consider delegating to / or replacing them with the framework-provided ones.

Also applies to: 27-27

base/src/main/java/com/tinyengine/it/service/material/BlockGroupService.java (2)

15-16: Javadoc–signature mismatch: return type

findBlockGroupById’s Javadoc advertises BlockGroupDto, yet the method returns BlockGroup.
Either update the Javadoc or change the return type so that documentation and API stay aligned.

Also applies to: 29-29


15-16: Reassess bespoke CRUD after inheriting IService<BlockGroup>

Similar to previous files: with IService now in place, methods such as createBlockGroup, deleteBlockGroupById, updateBlockGroupById duplicate save, removeById, updateById. Streamlining will reduce boilerplate.

Also applies to: 29-29

base/src/main/java/com/tinyengine/it/service/material/BlockHistoryService.java (1)

15-16: Duplicate CRUD surface

The custom createBlockHistory, deleteBlockHistoryById, etc. echo built-ins from IService<BlockHistory>. Consider delegating to—or deprecating in favour of—the generic operations to keep the service layer lean.

Also applies to: 27-27

base/src/main/java/com/tinyengine/it/service/material/ComponentService.java (1)

33-33: Extending IService makes many handwritten CRUD methods redundant

IService<Component> already supplies list(), getById(), save(), updateById(), removeById() and batch variants. Consider deleting the duplicated custom methods (or at least those that map 1-to-1) to cut noise and future maintenance.

base/src/main/java/com/tinyengine/it/service/app/PageHistoryService.java (1)

30-30: IService<PageHistory> added – rethink custom CRUD signatures

After inheriting from IService, a good chunk of the interface overlaps with the base CRUD API. Keeping both increases cognitive load and requires duplicate tests.

base/src/main/java/com/tinyengine/it/service/app/TaskRecordService.java (1)

27-27: Redundant CRUD declarations

Extending IService<TaskRecord> renders several handcrafted CRUD methods superfluous. Streamlining the interface will simplify the implementation layer as well.

base/src/main/java/com/tinyengine/it/service/platform/PlatformService.java (1)

28-28: Leverage IService default methods

Now that the interface extends IService<Platform>, consider eliminating boiler-plate CRUD declarations unless they add domain-specific behavior (e.g., wrapping results in Result<>).

base/src/main/java/com/tinyengine/it/service/material/ComponentLibraryService.java (1)

28-28: Assess duplication vs. IService

Extending IService<ComponentLibrary> makes most CRUD helpers unnecessary; trimming them will keep the API minimal and clearer.

base/src/main/java/com/tinyengine/it/service/app/PageService.java (1)

15-30: Remove MyBatis @Param imports from service layer

@Param is a MyBatis-Mapper annotation. Service interfaces are not scanned by MyBatis, so the annotation is a no-op here and just adds an unnecessary compile-time dependency on mybatis-spring. Drop the import (and the annotation usages further down) to keep the service layer framework-agnostic.

-import org.apache.ibatis.annotations.Param;

Follow-up: remove the @Param on every method parameter in this interface.

base/src/main/java/com/tinyengine/it/service/app/I18nEntryService.java (1)

15-36: Strip framework annotations from service contracts

Same as in PageService: @Param belongs in mapper interfaces only. Eliminating it (and its import) keeps the service module cleanly decoupled from persistence details.

base/src/main/java/com/tinyengine/it/service/material/TaskRecordService.java (2)

15-30: Avoid leaking persistence annotations to the service layer

@Param and its import should be removed for the same reasons mentioned in previous files.


30-47: Custom “status” query might be better placed in mapper

IService<TaskRecord> already exposes read helpers; placing the complex status query directly in the service interface couples consumers to implementation details. Consider declaring it in the mapper and exposing it via the service implementation instead of the interface, unless it is intentionally part of the public domain API.

base/src/main/java/com/tinyengine/it/service/platform/PlatformHistoryService.java (1)

15-28: Remove persistence-layer annotations

As with other services, drop @Param usages/imports to keep the service layer agnostic of MyBatis.

base/src/main/java/com/tinyengine/it/service/platform/impl/TenantServiceImpl.java (1)

36-39: Favour constructor injection (or rely on ServiceImpl) over field injection

If you decide the dedicated mapper is still required (e.g. for clarity), prefer constructor injection to keep the field final and simplify testing:

private final TenantMapper tenantMapper;

public TenantServiceImpl(TenantMapper tenantMapper) {
    this.tenantMapper = tenantMapper;
}

Field injection hides dependencies and complicates immutability.

base/src/main/java/com/tinyengine/it/service/app/AppService.java (1)

31-32: Double-exposed CRUD surface: consider delegating to IService defaults

By extending IService<App> you already get getById, list, save, removeById, etc. The custom methods queryAppById, deleteAppById, createApp, … are semantically identical and add maintenance overhead. Unless they apply extra business rules, you can delete them or delegate internally to the generic methods.

base/src/main/java/com/tinyengine/it/service/app/AppExtensionService.java (1)

28-29: Redundant CRUD wrappers

As with AppService, evaluate whether custom CRUD methods are still required now that IService<AppExtension> provides them out of the box.

base/src/main/java/com/tinyengine/it/service/material/MaterialHistoryService.java (1)

28-29: Overlap with IService<MaterialHistory>

Consider removing or delegating the CRUD-only methods to the inherited defaults to reduce duplication.

base/src/main/java/com/tinyengine/it/service/material/MaterialService.java (1)

15-16: Re-evaluate the need for custom CRUD declarations after extending IService.

By extending IService<Material> you already inherit the default CRUD APIs (save, getById, removeById, etc.).
Keeping hand-rolled methods such as createMaterial, deleteMaterialById, etc. is perfectly valid when you need the customised Result<Material> wrapper, but it does introduce two parallel CRUD surfaces that can drift.

If the wrapper is not strictly required everywhere, consider:

-public interface MaterialService extends IService<Material> {
-
-    Result<Material> createMaterial(Material material);
-}
+public interface MaterialService extends IService<Material> {
+    // Domain-specific queries only; reuse default CRUD from IService.
+}

This keeps the service footprint minimal and leans fully on MyBatis-Plus.

Also applies to: 28-30

base/src/main/java/com/tinyengine/it/service/app/impl/I18nEntryServiceImpl.java (1)

17-18: Consider consolidating mapper access to baseMapper for consistency.

With ServiceImpl<I18nEntryMapper, I18nEntry> in place you can eliminate the explicit @Autowired I18nEntryMapper i18nEntryMapper and use baseMapper. Keeping both variants is harmless but increases mental load for maintainers.

Also applies to: 69-77

base/src/main/java/com/tinyengine/it/service/app/impl/PageHistoryServiceImpl.java (1)

40-45: Consider relying on ServiceImpl’s built-in baseMapper instead of injecting your own mapper

Now that the class extends ServiceImpl<PageHistoryMapper, PageHistory>, an initialized PageHistoryMapper is already available via the protected baseMapper field.
Keeping a separate @Autowired PageHistoryMapper pageHistoryMapper; duplicates the dependency and slightly complicates maintenance/testing.

-    @Autowired
-    private PageHistoryMapper pageHistoryMapper;
+    // `baseMapper` provided by ServiceImpl already points to PageHistoryMapper

Unless you need two distinct mapper instances, drop the manual field and use baseMapper (or add an accessor) throughout the class.
This keeps the codebase leaner and avoids accidental divergence.

base/src/main/java/com/tinyengine/it/service/material/impl/MaterialHistoryServiceImpl.java (1)

38-44: Duplicate mapper injection after extending ServiceImpl

ServiceImpl<MaterialHistoryMapper, MaterialHistory> supplies a baseMapper already wired by Spring.
The explicit

@Autowired
private MaterialHistoryMapper materialHistoryMapper;

is therefore redundant. Consider removing it and migrating calls to baseMapper to reduce boiler-plate and keep one single injection point.

base/src/main/java/com/tinyengine/it/service/platform/impl/PlatformServiceImpl.java (1)

37-40: Redundant PlatformMapper field

Because the class now inherits from ServiceImpl<PlatformMapper, Platform>, the mapper is injected in baseMapper.
Unless you need special qualification, you can safely delete the @Autowired private PlatformMapper platformMapper; field and reference baseMapper instead.
This avoids duplicate beans and keeps the service thinner.

base/src/main/java/com/tinyengine/it/service/material/impl/BlockServiceImpl.java (1)

80-83: Remove manual BlockMapper injection; use baseMapper

After extending ServiceImpl<BlockMapper, Block> the framework already autowires a BlockMapper instance (field baseMapper).
Keeping another injected blockMapper introduces two mapper handles that can diverge in transactional context or mock setups. Switch existing calls to baseMapper and drop the field to simplify the service.

base/src/main/java/com/tinyengine/it/service/material/impl/ComponentServiceImpl.java (1)

56-63: Leverage ServiceImpl’s baseMapper instead of custom field

With the new inheritance you already get a Spring-managed mapper. Replacing

@Autowired
private ComponentMapper componentMapper;

by baseMapper trims code and avoids bean duplication.
Note: adjust downstream calls (queryAllComponent, createComponent, etc.) accordingly.

base/src/main/java/com/tinyengine/it/service/app/impl/PageTemplateServiceImpl.java (1)

40-42: Drop the explicit PageTemplateMapper field – ServiceImpl already wires it in.

ServiceImpl injects a baseMapper instance of the generic type (PageTemplateMapper). Keeping a second, manually-wired @Autowired field is redundant noise and may lead to confusion about which instance is being used or mocked in tests.

-    @Autowired
-    private PageTemplateMapper pageTemplateMapper;
+    // `ServiceImpl` provides a protected `baseMapper`; use it directly.

Follow-up: Replace every pageTemplateMapper. call in this class with baseMapper. (or getBaseMapper() if you prefer explicit access).

base/src/main/java/com/tinyengine/it/service/app/impl/TaskRecordServiceImpl.java (1)

35-37: Same redundancy here – remove the custom-wired mapper.

Extending ServiceImpl<TaskRecordMapper, TaskRecord> already gives you baseMapper. Keep one source of truth.

-    @Autowired
-    private TaskRecordMapper taskRecordMapper;
+    // Rely on `baseMapper` supplied by `ServiceImpl`.

Adjust method bodies accordingly.

base/src/main/java/com/tinyengine/it/service/material/impl/ComponentLibraryServiceImpl.java (1)

37-40: Consolidate mapper access – avoid duplicate injection.

ServiceImpl autowires ComponentLibraryMapper; there’s no need for an extra field.

-    @Autowired
-    private ComponentLibraryMapper componentLibraryMapper;
+    // Use `baseMapper` from the superclass.

This clean-up will also make unit testing simpler.

base/src/main/java/com/tinyengine/it/service/material/impl/BusinessCategoryServiceImpl.java (1)

36-38: Drop manual mapper wiring; leverage baseMapper.

Consistent with other services, remove the redundant @Autowired mapper and use the one provided by ServiceImpl.

-    @Autowired
-    private BusinessCategoryMapper businessCategoryMapper;

After removal, update method bodies to reference baseMapper.

base/src/main/java/com/tinyengine/it/service/app/impl/AppExtensionServiceImpl.java (1)

38-41: Replace explicit mapper field with the inherited baseMapper.

Redundant injection adds boilerplate and potential for inconsistent mocks.

-    @Autowired
-    private AppExtensionMapper appExtensionMapper;
+    // Leverage `baseMapper` from `ServiceImpl`.

Update method implementations to use baseMapper.

base/src/main/java/com/tinyengine/it/service/app/impl/I18nLangServiceImpl.java (1)

35-37: Redundant manual mapper injection after extending ServiceImpl

ServiceImpl already autowires a protected BaseMapper instance (baseMapper) of the same generic type.
Keeping the extra

@Autowired
private I18nLangMapper i18nLangMapper;

duplicates the dependency, increases memory footprint, and may confuse future maintainers.

Consider deleting the field and switching method bodies to baseMapper:

-    @Autowired
-    private I18nLangMapper i18nLangMapper;
+    // baseMapper is inherited from ServiceImpl<I18nLangMapper, I18nLang>

Example refactor:

-    return i18nLangMapper.queryAllI18nLang();
+    return baseMapper.queryAllI18nLang();

(The same replacement applies to all other mapper usages in this class.)

base/src/main/java/com/tinyengine/it/service/material/impl/TaskRecordMaterialServiceImpl.java (1)

40-43: Duplicate mapper field – favour baseMapper from ServiceImpl

After inheriting ServiceImpl<TaskRecordMapper, TaskRecord>, the superclass wires baseMapper.
The explicit @Autowired TaskRecordMapper taskRecordMapper; is now superfluous and can be removed to avoid ambiguity.

-    @Autowired
-    TaskRecordMapper taskRecordMapper;
+    // baseMapper is available from ServiceImpl

Update the method bodies accordingly (taskRecordMapperbaseMapper).

base/src/main/java/com/tinyengine/it/service/material/impl/BlockGroupServiceImpl.java (1)

47-55: Remove unnecessary field injections – rely on baseMapper chain

BlockGroupServiceImpl now extends ServiceImpl<BlockGroupMapper, BlockGroup> but still keeps:

@Autowired
private BlockGroupMapper blockGroupMapper;

and similar mapper fields.
This is redundant; baseMapper and the other injected mappers can be accessed through constructor injection or separate service classes if really needed. At minimum, drop blockGroupMapper to prevent two independent instances of the same bean.

-    @Autowired
-    private BlockGroupMapper blockGroupMapper;
+    // baseMapper provided by ServiceImpl covers BlockGroupMapper

(Adapt usages throughout the class.)

base/src/main/java/com/tinyengine/it/service/material/impl/BlockHistoryServiceImpl.java (1)

35-38: Leverage inherited baseMapper instead of explicit mapper injection

Same pattern: ServiceImpl<BlockHistoryMapper, BlockHistory> injects baseMapper.
Eliminate the manual @Autowired BlockHistoryMapper blockHistoryMapper; and switch to baseMapper.

This trims boilerplate and aligns with MyBatis-Plus conventions.

base/src/main/java/com/tinyengine/it/service/platform/impl/PlatformHistoryServiceImpl.java (1)

36-38: Superfluous mapper field after extending ServiceImpl

PlatformHistoryServiceImpl now extends ServiceImpl<PlatformHistoryMapper, PlatformHistory> yet still defines its own PlatformHistoryMapper. Remove it and use the inherited baseMapper.

Also consider switching to constructor injection if additional mappers are required; this improves testability and immutability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 929a971 and 67daf4e.

📒 Files selected for processing (45)
  • base/src/main/java/com/tinyengine/it/service/app/AppExtensionService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/AppService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/DatasourceService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/I18nEntryService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/I18nLangService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/PageHistoryService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/PageService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/PageTemplateService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/TaskRecordService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/UserService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/AppExtensionServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/AppServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/DatasourceServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/I18nEntryServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/I18nLangServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/PageHistoryServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/PageServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/PageTemplateServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/TaskRecordServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/app/impl/UserServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/BlockGroupService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/BlockHistoryService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/BlockService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/BusinessCategoryService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/ComponentLibraryService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/ComponentService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/MaterialHistoryService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/MaterialService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/TaskRecordService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/BlockGroupServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/BlockHistoryServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/BlockServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/BusinessCategoryServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/ComponentLibraryServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/ComponentServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/MaterialHistoryServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/MaterialServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/material/impl/TaskRecordMaterialServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/platform/PlatformHistoryService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/platform/PlatformService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/platform/TenantService.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/platform/impl/PlatformHistoryServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/platform/impl/PlatformServiceImpl.java (2 hunks)
  • base/src/main/java/com/tinyengine/it/service/platform/impl/TenantServiceImpl.java (2 hunks)
  • pom.xml (2 hunks)
🔇 Additional comments (7)
pom.xml (1)

33-33:

Details

❌ Incorrect review comment

Remove the orphaned springdoc-openapi-ui property to avoid confusion.

A new property springdoc-openapi-starter-webmvc-ui.version has been added, but the legacy
springdoc-openapi-ui.version property (defined elsewhere in the POM or in child modules) is now obsolete.
Keeping both properties around risks version drift and mistaken references.

-        <springdoc-openapi-ui.version>1.6.14</springdoc-openapi-ui.version>

Run the grep below to make sure no module still references the old property / artifact:


🏁 Script executed:

#!/bin/bash
rg -n "springdoc-openapi-ui" -g '*.xml'

Length of output: 39


No obsolete springdoc-openapi-ui.version property found

  • Ran rg -n "springdoc-openapi-ui" -g '*.xml' across the repository; no matches were found.
  • The legacy <springdoc-openapi-ui.version> property does not exist in any POM, so no removal is necessary.

Likely an incorrect or invalid review comment.

base/src/main/java/com/tinyengine/it/service/material/ComponentService.java (1)

15-16: Dependency scope check for MyBatis-Plus import

The new IService import is correct, but please verify that the project BOM / parent POM exposes a single, consistent MyBatis-Plus version; otherwise several modules may silently pull different transitive versions and break the generic‐service hierarchy at runtime.

base/src/main/java/com/tinyengine/it/service/app/PageHistoryService.java (1)

16-16: Import is fine – double-check shading conflicts

Same note as other services: ensure a single MyBatis-Plus version is used across the multi-module build.

base/src/main/java/com/tinyengine/it/service/app/TaskRecordService.java (1)

15-15: Verify MyBatis-Plus dependency alignment

Confirm there are no conflicting IService classes on the class-path (e.g., old 3.4.x vs. 3.5.x).

base/src/main/java/com/tinyengine/it/service/platform/PlatformService.java (1)

15-15: Ensure consistent MyBatis-Plus version across modules

Repeated reminder to lock the dependency to a single version to avoid ClassCastException between different class-loaders.

base/src/main/java/com/tinyengine/it/service/material/ComponentLibraryService.java (1)

15-15: Version sanity check for MyBatis-Plus

As with the other services, please confirm a unified MyBatis-Plus version to avoid linkage errors.

base/src/main/java/com/tinyengine/it/service/app/impl/AppServiceImpl.java (1)

52-55: 👍 Extending ServiceImpl correctly integrates MyBatis-Plus

The switch to ServiceImpl<AppMapper, App> is spot-on and unlocks generic CRUD helpers while keeping existing custom logic intact.

Comment on lines 108 to +110
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc-openapi-ui.version}</version>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc-openapi-starter-webmvc-ui.version}</version>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🛠️ Refactor suggestion

🧩 Analysis chain

Confirm that the new starter is compatible with both spring-boot-starter-web and spring-boot-starter-webflux.

springdoc-openapi-starter-webmvc-ui pulls in spring-webmvc.
Because this POM also includes spring-boot-starter-webflux (line 48), the application
will have both the servlet and reactive stacks on the class-path, which can lead to
ambiguous handler mappings at runtime.

If the project does not serve WebFlux endpoints, drop the webflux starter; otherwise
use springdoc-openapi-starter-webflux-ui instead.


🏁 Script executed:

#!/bin/bash
set -e

# Check for Spring WebFlux starter dependency
grep -R "<artifactId>spring-boot-starter-webflux</artifactId>" -n pom.xml

# Check for Spring WebMVC/Web starter dependency
grep -R "<artifactId>spring-boot-starter-web</artifactId>" -n pom.xml

# Check if the WebFlux-specific SpringDoc starter is referenced
grep -R "<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>" -n pom.xml || echo "No springdoc-openapi-starter-webflux-ui found"

Length of output: 474


pom.xml: Ensure SpringDoc starter matches your web stack

Detected dependencies:

  • Line 41: <artifactId>spring-boot-starter-web</artifactId>
  • Line 49: <artifactId>spring-boot-starter-webflux</artifactId>
  • SpringDoc starter in use (lines 108–110):
    <groupId>org.springdoc</groupId>
    <artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
    <version>${springdoc-openapi-starter-webmvc-ui.version}</version>
    

Having both servlet (WebMVC) and reactive (WebFlux) on the classpath can lead to ambiguous handler mappings at runtime.

Actions:

  • If you only serve servlet endpoints, remove the spring-boot-starter-webflux dependency.
  • If you expose WebFlux endpoints, swap in the reactive SpringDoc starter:
    <artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
🤖 Prompt for AI Agents
In pom.xml around lines 41, 49, and 108 to 110, there is a conflict between the
SpringDoc starter and the web stack dependencies. The project includes both
spring-boot-starter-webflux (line 49) and spring-boot-starter-web (line 41), but
the SpringDoc starter used is springdoc-openapi-starter-webmvc-ui (lines
108-110), which is for the servlet stack. To fix this, either remove the
spring-boot-starter-webflux dependency if you only serve servlet endpoints, or
if you serve reactive WebFlux endpoints, replace the SpringDoc starter
artifactId with springdoc-openapi-starter-webflux-ui to match the reactive
stack.

Comment on lines +15 to 18
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tinyengine.it.mapper.TenantMapper;
import com.tinyengine.it.model.entity.Tenant;
import com.tinyengine.it.service.platform.TenantService;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

ServiceImpl already provides baseMapper; the explicit @Autowired TenantMapper becomes redundant

Now that the class inherits from ServiceImpl<TenantMapper, Tenant>, the protected baseMapper field gives you full access to the mapper. Keeping a second, manually-wired tenantMapper:

  • duplicates the dependency,
  • slightly increases startup time,
  • makes unit-testing harder (two fields to mock), and
  • risks accidental divergence if one of them is refactored.

Consider deleting the explicit field and updating the methods to use baseMapper instead.
Example:

-@Autowired
-private TenantMapper tenantMapper;
+// ServiceImpl already exposes `protected TenantMapper baseMapper;`
-return tenantMapper.queryAllTenant();
+return baseMapper.queryAllTenant();

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
base/src/main/java/com/tinyengine/it/service/platform/impl/TenantServiceImpl.java
around lines 15 to 18, remove the explicit @Autowired TenantMapper field since
ServiceImpl already provides the protected baseMapper field. Refactor all usages
of tenantMapper in the class to use baseMapper instead, eliminating the
redundant dependency and simplifying testing and maintenance.

Comment on lines +37 to 40
public class DatasourceServiceImpl extends ServiceImpl<DatasourceMapper, Datasource> implements DatasourceService {
@Autowired
private DatasourceMapper datasourceMapper;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same mapper-duplication issue as in TenantServiceImpl

ServiceImpl<DatasourceMapper, Datasource> already wires a mapper. Remove the extra @Autowired DatasourceMapper or switch your code to baseMapper.

🤖 Prompt for AI Agents
In
base/src/main/java/com/tinyengine/it/service/app/impl/DatasourceServiceImpl.java
around lines 37 to 40, there is a redundant injection of DatasourceMapper via
@Autowired despite extending ServiceImpl which already provides a mapper
instance as baseMapper. Remove the @Autowired DatasourceMapper field and update
any references from datasourceMapper to baseMapper to avoid duplication and use
the inherited mapper correctly.

Comment on lines +15 to 18
import com.baomidou.mybatisplus.extension.service.IService;
import com.tinyengine.it.common.base.Result;
import com.tinyengine.it.model.entity.AppExtension;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same layering concern: remove @Param and keep service layer free from MyBatis specifics

See comment in AppService.

🤖 Prompt for AI Agents
In base/src/main/java/com/tinyengine/it/service/app/AppExtensionService.java
around lines 15 to 18, remove all usages and imports of MyBatis-specific
annotations like @Param from the service layer. Refactor method signatures to
use plain Java parameters without MyBatis annotations to keep the service layer
independent of persistence framework details, following the same layering
principle applied in AppService.

Comment on lines +15 to 18
import com.baomidou.mybatisplus.extension.service.IService;
import com.tinyengine.it.common.base.Result;
import com.tinyengine.it.model.entity.MaterialHistory;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Service interface should not import MyBatis @Param

Keep persistence annotations in mapper interfaces only.

🤖 Prompt for AI Agents
In
base/src/main/java/com/tinyengine/it/service/material/MaterialHistoryService.java
around lines 15 to 18, remove any import of MyBatis `@Param` annotation from the
service interface. Ensure that `@Param` and other persistence-related
annotations are only used in the mapper interfaces, not in service layer
interfaces, to maintain proper separation of concerns.

Comment on lines +37 to 40
public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
@Autowired
private MaterialMapper materialMapper;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Drop the redundant @Autowired MaterialMapperServiceImpl already wires one.

ServiceImpl<MaterialMapper, Material> injects a protected baseMapper instance.
Keeping a second MaterialMapper materialMapper:

  1. duplicates the bean injection,
  2. risks accidental divergence (someone might use baseMapper in a future edit),
  3. slightly increases memory footprint.

Suggested clean-up:

-@Autowired
-private MaterialMapper materialMapper;

and replace internal usages with baseMapper.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In
base/src/main/java/com/tinyengine/it/service/material/impl/MaterialServiceImpl.java
around lines 37 to 40, remove the redundant @Autowired MaterialMapper field
since ServiceImpl already provides a protected baseMapper instance. Replace all
internal usages of materialMapper with baseMapper to avoid duplicate injection
and potential inconsistencies.

Comment on lines +17 to 18
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tinyengine.it.common.base.Result;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same duplication pattern – rely on baseMapper instead of a second mapper field.

ServiceImpl<PageMapper, Page> already gives you baseMapper; additionally wiring pageMapper adds no value and muddies the waters when both names appear in the file.

Apply the same removal pattern as suggested for MaterialServiceImpl:

-@Autowired
-private PageMapper pageMapper;

Then rename references (pageMapperbaseMapper) in this class.
This also applies to other *ServiceImpl classes introduced in this PR.

Also applies to: 75-82

🤖 Prompt for AI Agents
In base/src/main/java/com/tinyengine/it/service/app/impl/PageServiceImpl.java
around lines 17-18 and 75-82, remove the explicit declaration and injection of
the pageMapper field since ServiceImpl<PageMapper, Page> already provides
baseMapper. Replace all references of pageMapper with baseMapper throughout the
class to avoid duplication and confusion, following the same pattern used in
MaterialServiceImpl and other similar service implementations in this PR.

Comment on lines +15 to 16
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tinyengine.it.mapper.UserMapper;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Duplicate mapper injection – remove and use baseMapper.

Same comment as above: ServiceImpl<UserMapper, User> already wires a UserMapper. Recommend deleting the explicit field to avoid redundancy.

-@Autowired
-private UserMapper userMapper;

Then update the method bodies to baseMapper.*.

Also applies to: 34-37

🤖 Prompt for AI Agents
In base/src/main/java/com/tinyengine/it/service/app/impl/UserServiceImpl.java
around lines 15-16 and 34-37, there is a redundant explicit injection of
UserMapper despite extending ServiceImpl which already provides a baseMapper
instance. Remove the explicit UserMapper field declaration and replace all
references to the explicit mapper in method bodies with baseMapper to avoid
duplication and simplify the code.

@lu-yg lu-yg closed this Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant