package com.gunshi.project.hsz.controller; import com.gunshi.core.result.R; import com.gunshi.db.dao.BaseDao; import com.gunshi.db.dao.IMapper; import com.gunshi.project.hsz.service.AbstractModelWithAttachService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Schema; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import java.io.Serializable; /** * 通用按id删除 * * @author lyf * @version 1.0.0 * @since 2024-01-31 */ public interface ICommonDeleteByIdWithAttach, AutoDao extends BaseDao, AttachModel, AttachModelAutoMapper extends IMapper, AttachModelAutoDao extends BaseDao> { AbstractModelWithAttachService getModelService(); Serializable getId(Serializable id); @Operation(summary = "按id删除") @GetMapping("/deleteById/{id}") default R commonDeleteById(@Schema(name = "id") @PathVariable("id") Serializable id) { return R.ok(getModelService().removeById(getId(id))); } }