# 科技服务人员管理 — 技术方案 > 依据:同目录 `科技服务人员管理功能需求.md`。模式对齐「风险因子设置」:**全局单套 GET 查询 + PUT 保存(upsert)**。 --- ## 1. 技术架构 | 项 | 说明 | | --- | --- | | **后端** | RuoYi springboot2:JDK 8、Spring MVC、MyBatis | | **数据库** | MySQL 5.7,InnoDB,`utf8mb4` | | **前端** | 若依 Vue2 单页表单 | | **代码包** | `com.ruoyi.web.modules.farming` | **分层**:Controller → Service(校验 + 派生)→ Mapper/XML → domain。 --- ## 2. 数据库设计 ### 2.1 表 `biz_tech_service_personnel` 全局**单行**(`id = 1`)。 | 字段 | 类型 | 说明 | | --- | --- | --- | | `id` | bigint | 主键,固定 **1** | | `envoy_male_count` | int | 科技特派员男性人数 | | `envoy_female_count` | int | 科技特派员女性人数 | | `envoy_party_member_count` | int | 科技特派员党员人数 | | `envoy_total_count` | int | 科技特派员总人数(男+女) | | `agri_junior_count` | int | 农业事业单位初级人数 | | `agri_clerk_count` | int | 农业事业单位员级人数 | | `agri_intermediate_count` | int | 农业事业单位中级人数 | | `agri_associate_senior_count` | int | 农业事业单位副高人数 | | `agri_management_count` | int | 农业事业单位管理级人数 | | `agri_total_count` | int | 农业事业单位总人数(五级合计) | | `create_by` / `create_time` / `update_by` / `update_time` | 审计 | 若依惯例 | DDL:`sql/biz_tech_service_personnel.sql` **派生** - `envoy_total_count` = `envoy_male_count` + `envoy_female_count`(空项按未参与;皆空则总人数空) - `agri_total_count` = 五级人数之和(同上) --- ## 3. 接口设计 **权限**:`techService:techServicePersonnel:query|edit` **Base Path**:`/techService/techServicePersonnel` | # | 说明 | Method | URI | 权限 | | --- | --- | --- | --- | --- | | 3.1 | 获取当前填报 | GET | `/techService/techServicePersonnel` | `query` | | 3.2 | 保存填报 | PUT | `/techService/techServicePersonnel` | `edit` | 无分页 list、无按 id 删除;菜单进入用 `query`,保存用 `edit`。 ### 3.1 查询响应 `data`(示例) ```json { "envoyMaleCount": 10, "envoyFemaleCount": 8, "envoyPartyMemberCount": 5, "envoyTotalCount": 18, "agriJuniorCount": 3, "agriClerkCount": 4, "agriIntermediateCount": 6, "agriAssociateSeniorCount": 2, "agriManagementCount": 1, "agriTotalCount": 16, "updateBy": "admin", "updateTime": "2026-07-21 15:00:00" } ``` 无记录时 `data` 为 `null`。 ### 3.2 保存请求 Body 仅提交可填字段(不含两个总人数);服务端重算后落库。 ```json { "envoyMaleCount": 10, "envoyFemaleCount": 8, "envoyPartyMemberCount": 5, "agriJuniorCount": 3, "agriClerkCount": 4, "agriIntermediateCount": 6, "agriAssociateSeniorCount": 2, "agriManagementCount": 1 } ``` --- ## 4. 关键类 | 类 | 说明 | | --- | --- | | `BizTechServicePersonnelController` | GET / PUT | | `BizTechServicePersonnelServiceImpl` | 单例 upsert | | `TechServicePersonnelValidation` | 非负校验、派生、VO 转换 | | `TechServicePersonnelRules` | `SINGLETON_ID`、求和 | | `BizTechServicePersonnelMapper` | select / insert / update | --- ## 5. 菜单配置(手工) | 项 | 值 | | --- | --- | | 上级菜单 | 牧业养殖科技服务 | | 菜单名称 | 科技服务人员管理 | | 组件路径 | `techService/techServicePersonnel/index` | | 权限字符 | `techService:techServicePersonnel:query` / `edit` | --- ## 6. 前端 详见同目录 **[科技服务人员管理前端技术方案.md](./科技服务人员管理前端技术方案.md)**。 - 页面:`ruoyi-ui/src/views/techService/techServicePersonnel/index.vue` - API:`ruoyi-ui/src/api/techService/techServicePersonnel.js` --- ## 7. 修订记录 | 版本 | 说明 | | --- | --- | | 1.0 | 初版 | | 1.1 | 补充前端技术方案链接 |