package com.gunshi.project.xyt.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.gunshi.core.result.R; import com.gunshi.db.dao.BaseDao; import com.gunshi.db.dao.IMapper; 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; import java.util.List; /** * 类描述 * * @author lyf * @version 1.0.0 * @since 2024-03-19 */ public interface ICommonQueryAttach, AutoDao extends BaseDao> { AutoDao getAttachAutoDao(); String getAttachBzIdName(); IdType getId(Serializable id); @Operation(summary = "按id查询") @GetMapping("/attach/getById/{id}") default R commonGetAttachById(@Schema(name = "id") @PathVariable("id") Serializable id) { return R.ok(getAttachAutoDao().getById(id)); } @Operation(summary = "按bzId查询") @GetMapping("/attach/getByBzId/{bzId}") default R> commonGetAttachByBzId(@Schema(name = "bzId") @PathVariable("bzId") Serializable bzId) { return R.ok(getAttachAutoDao().list(new QueryWrapper().eq(getAttachBzIdName(), getId(bzId)))); } @Operation(summary = "列表查询") @GetMapping("/attach/find") default R> commonFind(@Schema(name = "bzId") @PathVariable("bzId") Serializable bzId) { return R.ok(getAttachAutoDao().list(new QueryWrapper().eq(getAttachBzIdName(), getId(bzId)))); } }