48 lines
1.7 KiB
Java
48 lines
1.7 KiB
Java
package com.gunshi.project.hsz.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<AttachModel, IdType, AutoMapper extends IMapper<AttachModel>, AutoDao extends BaseDao<AutoMapper, AttachModel>> {
|
|
AutoDao getAttachAutoDao();
|
|
|
|
String getAttachBzIdName();
|
|
|
|
IdType getId(Serializable id);
|
|
|
|
@Operation(summary = "按id查询")
|
|
@GetMapping("/attach/getById/{id}")
|
|
default R<AttachModel> commonGetAttachById(@Schema(name = "id") @PathVariable("id") Serializable id) {
|
|
return R.ok(getAttachAutoDao().getById(id));
|
|
}
|
|
|
|
@Operation(summary = "按bzId查询")
|
|
@GetMapping("/attach/getByBzId/{bzId}")
|
|
default R<List<AttachModel>> commonGetAttachByBzId(@Schema(name = "bzId") @PathVariable("bzId") Serializable bzId) {
|
|
return R.ok(getAttachAutoDao().list(new QueryWrapper<AttachModel>().eq(getAttachBzIdName(), getId(bzId))));
|
|
}
|
|
|
|
@Operation(summary = "列表查询")
|
|
@GetMapping("/attach/find")
|
|
default R<List<AttachModel>> commonFind(@Schema(name = "bzId") @PathVariable("bzId") Serializable bzId) {
|
|
return R.ok(getAttachAutoDao().list(new QueryWrapper<AttachModel>().eq(getAttachBzIdName(), getId(bzId))));
|
|
}
|
|
}
|
|
|