baomidou / mybatis-plus

An powerful enhanced toolkit of MyBatis for simplify development
https://baomidou.com
Apache License 2.0
16.36k stars 4.31k forks source link

[命名讨论]领域设计驱动中将数据持久化类命名:XXXRepository #1396

Closed daviyang35 closed 5 years ago

daviyang35 commented 5 years ago

这不是一个bug反馈

当前使用版本(必须填写清楚,否则不予处理)

<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.7.1</version>

希望达到的效果

CRUD扩展从Service/ServiceImpl改为Repository/RepositoryImpl。

目前在一些架构设计与实践中,将领域内的具体业务服务称为Service,数据持久化层称为Repository。

例如:org.springframework.data.repository.CrudRepository

是否有可能,在未来的版本中将IService/ServiceImpl 更改为类似于 CrudRepository 这样的以 Repository作为标记的名称。

为什么要更改

  1. 最新的架构实践中造成误解和困扰
  2. 与Spring官方的data.repository命名更一致

目前即使不修改MyBatisPlus的命名,个人可以对自己的代码生成器或者类对象做重命名处理。 这虽然可以解决问题,但对使用者容易造成误解和歧义。因为Service在同一个工程中有不用的用意。

miemieYaho commented 5 years ago

不会

qmdx commented 5 years ago

命名意义不大,修改过影响面太大,如果你真实觉得有必要修改,你可以建立自己的基类继承 mp 的基类

daviyang35 commented 5 years ago

为了提供向后兼容性,官方新增一个以Repository命名的类也是一个可行方案。