mirror of
https://github.moeyy.xyz/https://github.com/GeWuYou/forgeboot
synced 2025-10-28 05:02:07 +08:00
refactor(webmvc): Optimized the naming of CRUD interface methods
- Rename the delete method to deleteById to explicitly delete by ID - Rename the delete(ids) method to deleteByIds, explicitly indicating bulk deletion- Rename the delete(entity) method to deleteByOne, explicitly deleting a single entity - Rename the delete(entities) method to deleteByAll to explicitly delete entities in bulk - Removed unused MapStruct dependencies
This commit is contained in:
parent
530936b76a
commit
ab035cce14
@ -1,6 +1,5 @@
|
||||
|
||||
dependencies {
|
||||
compileOnly(libs.springBootStarter.jpa)
|
||||
compileOnly(libs.org.mapstruct)
|
||||
implementation(project(Modules.Webmvc.DTO))
|
||||
}
|
||||
|
||||
@ -51,28 +51,28 @@ interface CrudServiceSpec<Entity: Any, Id: Any, Filter: Any> {
|
||||
*
|
||||
* @param id 要删除的实体的ID
|
||||
*/
|
||||
fun delete(id: Id)
|
||||
fun deleteById(id: Id)
|
||||
|
||||
/**
|
||||
* 批量删除实体
|
||||
*
|
||||
* @param ids 要删除的实体的ID列表
|
||||
*/
|
||||
fun delete(ids: List<Id>)
|
||||
fun deleteByIds(ids: List<Id>)
|
||||
|
||||
/**
|
||||
* 删除一个实体
|
||||
*
|
||||
* @param entity 要删除的实体
|
||||
*/
|
||||
fun delete(entity: Entity)
|
||||
fun deleteByOne(entity: Entity)
|
||||
|
||||
/**
|
||||
* 批量删除实体
|
||||
*
|
||||
* @param entities 要删除的实体列表
|
||||
*/
|
||||
fun delete(entities: List<Entity>)
|
||||
fun deleteByAll(entities: List<Entity>)
|
||||
|
||||
/**
|
||||
* 根据ID检查实体是否存在
|
||||
|
||||
@ -77,7 +77,7 @@ abstract class CrudServiceImplSpec<Entity : Any, Id : Any, Filter : Any>(
|
||||
*
|
||||
* @param id 要删除的实体的唯一标识符
|
||||
*/
|
||||
override fun delete(id: Id) {
|
||||
override fun deleteById(id: Id) {
|
||||
repository.deleteById(id)
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ abstract class CrudServiceImplSpec<Entity : Any, Id : Any, Filter : Any>(
|
||||
*
|
||||
* @param ids 要删除的实体 ID 列表
|
||||
*/
|
||||
override fun delete(ids: List<Id>) {
|
||||
override fun deleteByIds(ids: List<Id>) {
|
||||
repository.deleteAllById(ids)
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ abstract class CrudServiceImplSpec<Entity : Any, Id : Any, Filter : Any>(
|
||||
*
|
||||
* @param entity 要删除的实体对象
|
||||
*/
|
||||
override fun delete(entity: Entity) {
|
||||
override fun deleteByOne(entity: Entity) {
|
||||
repository.delete(entity)
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ abstract class CrudServiceImplSpec<Entity : Any, Id : Any, Filter : Any>(
|
||||
*
|
||||
* @param entities 要删除的实体列表
|
||||
*/
|
||||
override fun delete(entities: List<Entity>) {
|
||||
override fun deleteByAll(entities: List<Entity>) {
|
||||
repository.deleteAll(entities)
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user