西藏巴青项目

养殖资讯接口说明.md 5.1KB

养殖资讯 — 接口说明

数据视图:v_farming_news(DDL 见 sql/biz_v_farming_news.sql)。
后端包:com.ruoyi.web.modules.news;接口:BizAppFarmingNewsController
资讯类别编码见 资讯类别接口说明


1. 视图 v_farming_news

仅聚合 publish_status = 1(已发布) 记录,字段统一如下:

视图列 说明
title 标题(标准名/项目名/政策名等)
introduction 简介
type 资讯类别编码(与 biz_information_category 叶子 code 一致)
cover_file_url 封面图访问 URL
content_file_url 正文/附件访问 URL(部分来源可为空字符串)
publish_time 发布时间

1.1 数据来源(UNION)

来源表 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;列表项无全局唯一主键,详情页若需跳转源业务,须按 type + 业务规则另行约定或扩展视图。

1.2 移动端分类 Tab 与 type

养殖资讯页 20 个 Tab 与资讯类别叶子编码一一对应(001001001012002001002004003001003004),调用列表接口时传对应 type


2. 列表接口

2.1 请求

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=科技

2.2 响应

RuoYi 分页 TableDataInfocodemsgrows(当前页数据)、total(符合条件的总条数)。排序固定为 publish_time 降序(与视图查询一致)。

rows[] 单条字段(驼峰)

字段 类型 说明
title string 标题
introduction string 简介
type string 资讯类别编码
coverFileUrl string 封面 URL,可空
contentFileUrl string 正文/附件 URL,可空或 ""
publishTime string 发布日期,yyyy-MM-dd

示例

{
  "code": 200,
  "msg": "查询成功",
  "total": 1,
  "rows": [
    {
      "title": "繁育作业标准示例",
      "introduction": "简介示例",
      "type": "001001",
      "coverFileUrl": "/profile/upload/cover.png",
      "contentFileUrl": "/profile/upload/standard.pdf",
      "publishTime": "2026-05-10"
    }
  ]
}

2.3 业务校验

场景 结果
type 为空 「资讯类型不能为空」
type 非资讯类别有效叶子编码 「资讯类型无效,请选择资讯类别中的类型」

校验实现:FarmingNewsTypeValidator001categoryType 1~4、002/003 子项,与视图涵盖范围一致)。


3. 前端(小程序)对接要点

能力 字段
列表缩略图 coverFileUrl
详情正文/附件预览或下载 contentFileUrl(为空则不展示附件入口)
分类筛选 请求参数 type = Tab 对应资讯类别 code
分类名称展示 调用 GET /category/informationCategory/children/treename
分页 / 上拉加载 首屏 pageNum=1;加载更多时 pageNum++,当 rows.length < pageSize 或已加载条数 ≥ total 时无更多数据

页面参考:ruoyi-ui-app/package-a/breeding-news/index.vue(列表数据源待接本接口)。


4. 修订记录

日期 说明
2026-05-20 初版:列表接口;视图字段 cover_file_urlcontent_file_url(替代原单列 url
2026-05-20 补充视图 UNION 来源与响应字段说明
2026-05-20 明确分页参数默认值与 pageSize 上限 50;Controller 使用 PageHelper 返回 total