数据视图:
v_farming_news(DDL 见sql/biz_v_farming_news.sql)。
后端包:com.ruoyi.web.modules.news;接口:BizAppFarmingNewsController。
资讯类别编码见 资讯类别接口说明。
v_farming_news仅聚合 publish_status = 1(已发布) 记录,字段统一如下:
| 视图列 | 说明 |
|---|---|
id |
来源业务表主键(同 type 下唯一;跨不同来源表可能重复) |
title |
标题(标准名/项目名/政策名等) |
introduction |
简介 |
type |
资讯类别编码(与 biz_information_category 叶子 code 一致) |
cover_file_url |
封面图访问 URL |
content_file_url |
正文/附件访问 URL(部分来源可为空字符串) |
publish_time |
发布时间 |
| 来源表 | type |
cover_file_url |
content_file_url |
|---|---|---|---|
biz_breeding_standard |
standard_type |
cover_file_url |
content_file_url |
biz_feeding_standard |
standard_type |
cover_file_url |
content_file_url |
biz_equipment_work_standard |
standard_type |
cover_file_url |
content_file_url |
biz_growth_slaughter_standard |
standard_type |
cover_file_url |
content_file_url |
biz_tech_project_guide |
project_type |
cover_file_url |
attachment_file_url |
biz_industry_policy_publicity |
固定 003001 |
cover_file_url |
policy_file_url |
biz_subsidy_project |
固定 003002 |
cover_file_url |
空(无正文附件) |
biz_subsidy_matter |
固定 003003 |
cover_file_url |
detail_file_url |
biz_common_prosperity_project |
固定 003004 |
cover_file_url |
video_file_url |
说明:id 为各 UNION 来源表主键,非全视图全局唯一;跳转源业务请使用 type + id。
type养殖资讯页 20 个 Tab 与资讯类别叶子编码一一对应(001001~001012、002001~002004、003001~003004),调用列表接口时传对应 type。
| 项 | 值 |
|---|---|
| Method | GET |
| URI | /app/farmingNews/list |
| 鉴权 | 移动端登录态(与 /app/* 其它接口一致) |
Query 参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
type |
string | 是 | 资讯类别编码,须为 资讯类别 中养殖资讯涉及的叶子 code |
title |
string | 否 | 标题关键字,对 title 列模糊匹配 |
pageNum |
int | 否 | 页码,默认 1;小于 1 时按 1 处理 |
pageSize |
int | 否 | 每页条数,默认 10;小于 1 时按 10 处理;最大 50 |
示例:
GET /app/farmingNews/list?type=001001&pageNum=1&pageSize=10
GET /app/farmingNews/list?type=002002&title=科技
RuoYi 分页 TableDataInfo:code、msg、rows(当前页数据)、total(符合条件的总条数)。排序固定为 publish_time 降序(与视图查询一致)。
rows[] 单条字段(驼峰)
| 字段 | 类型 | 说明 |
|---|---|---|
id |
number | 来源业务表主键;同 type 下唯一 |
title |
string | 标题 |
introduction |
string | 简介 |
type |
string | 资讯类别编码 |
coverFileUrl |
string | 封面 URL,可空 |
contentFileUrl |
string | 正文/附件 URL,可空或 "" |
publishTime |
string | 发布日期,yyyy-MM-dd |
示例
{
"code": 200,
"msg": "查询成功",
"total": 1,
"rows": [
{
"id": 1001,
"title": "繁育作业标准示例",
"introduction": "简介示例",
"type": "001001",
"coverFileUrl": "/profile/upload/cover.png",
"contentFileUrl": "/profile/upload/standard.pdf",
"publishTime": "2026-05-10"
}
]
}
| 场景 | 结果 |
|---|---|
type 为空 |
「资讯类型不能为空」 |
type 非资讯类别有效叶子编码 |
「资讯类型无效,请选择资讯类别中的类型」 |
校验实现:FarmingNewsTypeValidator(001 下 categoryType 1~4、002/003 子项,与视图涵盖范围一致)。
| 项 | 值 |
|---|---|
| Method | GET |
| URI | /app/farmingNews/{id} |
| 鉴权 | 移动端登录态 |
路径 / Query 参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
id |
long | 是 | 源表主键(与列表项 id 一致) |
type |
string | 是 | 资讯类别编码(与列表项 type 一致) |
示例:
GET /app/farmingNews/1001?type=001001
GET /app/farmingNews/88?type=003004
type |
查询表 |
|---|---|
001001~001004 |
biz_breeding_standard |
001005~001006 |
biz_feeding_standard |
001007~001010 |
biz_equipment_work_standard |
001011~001012 |
biz_growth_slaughter_standard |
002001~002004 |
biz_tech_project_guide |
003001 |
biz_industry_policy_publicity |
003002 |
biz_subsidy_project |
003003 |
biz_subsidy_matter |
003004 |
biz_common_prosperity_project(含运营图片 operationImages) |
标准 AjaxResult:code、msg、data。data 为对应源表实体 全部字段(驼峰 JSON)。
仅返回 已发布(publish_status=1)记录;标准类 / 科技项目另要求源表类型字段与请求 type 一致(standard_type / project_type)。
示例(type=001001,节选)
{
"code": 200,
"msg": "操作成功",
"data": {
"id": 1001,
"standardName": "繁育作业标准示例",
"introduction": "简介示例",
"standardType": "001001",
"coverFileUrl": "/profile/upload/cover.png",
"contentFileUrl": "/profile/upload/standard.pdf",
"publishStatus": 1
}
}
| 场景 | 结果 |
|---|---|
type 为空 / 非资讯类别叶子 |
同列表校验 |
id 为空 |
「资讯主键不能为空」 |
| 记录不存在 / 未发布 / type 与源表不一致 | 「该资讯已下线或不存在」 |
| 能力 | 字段 |
|---|---|
| 列表项主键 | id(配合 type 定位源业务) |
| 列表缩略图 | coverFileUrl |
| 详情正文/附件预览或下载 | contentFileUrl(为空则不展示附件入口) |
| 详情拉取 | GET /app/farmingNews/{id}?type={type} 返回源表全字段 |
| 分类筛选 | 请求参数 type = Tab 对应资讯类别 code |
| 分类名称展示 | 调用 GET /category/informationCategory/children 或 /tree 取 name |
| 分页 / 上拉加载 | 首屏 pageNum=1;加载更多时 pageNum++,当 rows.length < pageSize 或已加载条数 ≥ total 时无更多数据 |
页面参考:ruoyi-ui-app/package-a/breeding-news/index.vue。
| 日期 | 说明 |
|---|---|
| 2026-05-20 | 初版:列表接口;视图字段 cover_file_url、content_file_url(替代原单列 url) |
| 2026-05-20 | 补充视图 UNION 来源与响应字段说明 |
| 2026-05-20 | 明确分页参数默认值与 pageSize 上限 50;Controller 使用 PageHelper 返回 total |
| 2026-07-24 | 视图与列表响应增加来源表 id |
| 2026-07-24 | 新增 GET /app/farmingNews/{id}?type= 详情,按 type 路由源表返回全字段 |