gunshi-project-ss/src/main/java/com/gunshi/project/hsz/controller/ICommonQueryAttach.java

48 lines
1.7 KiB
Java
Raw Normal View History

2025-07-17 15:26:39 +08:00
package com.gunshi.project.hsz.controller;
2024-07-08 10:05:02 +08:00
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))));
}
2024-07-08 17:47:02 +08:00
@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))));
}
2024-07-08 10:05:02 +08:00
}