diff --git a/RFID.md b/RFID.md index 109357c..90d8fff 100644 --- a/RFID.md +++ b/RFID.md @@ -1,5 +1,54 @@ +# 主要展示(其余字段在前端暂时隐藏或注释掉) - 位置信息:标识、位置编号、位置别名、父级编号、是否标识、备注、创建人、创建时间、更新人、更新时间 - 设备信息:标识、设备编号、设备名称、所在位置、设备地址、设备端口、读取频率、是否标识、备注、创建人、创建时间、更新人、更新时间 - 读取记录:标识、设备编号、读取状态(1-成功;0-失败)、条码信息、记录时间 +- **代码注意事项** + 1. ** 连表查询规范** + 使用 `mybatis-plus`做连表查询时: + - 在实体类和 `VO` 中添加连表字段,实体类字段需加 `@TableField(exist = false)` 注解。 + - `MybatisPlus`自带方法不支持连表查询,需要在mapper.xml中编写sql语句 + 2. **types 同步维护** + 连表查询得到的字段,需要同步补充到前端 `types.ts` 中,保证类型定义完整。 + 3. **接口前缀规范** + 参考同模块下已有接口前缀,统一后台 `@RequestMapping` 前缀。 + 4. **前端列表 / 表单字段规范** + - 只展示业务字段,技术字段仅用于内部关联(连表查询得到名称字段),若无关联则隐藏技术字段(前端在 `columns` 中设为 `false`) + - 业务字段不显示多余的说明文字,例如字典字段的括号以及括号的字典数据 + - 列表不直接展示主键,使用“序号”列(`index`)替代。 + - 注释掉不合理的搜索条件,对话框中注释掉不合理的输入字段。 + - 数字字段使用数字输入框; + - 新增对话框时,前端激活标识 `isMarked` 默认为 `1`。 + - 需要绑定其他表字段时,通过下拉框选择,表单字段使用 `get${ClassName}List` 接口获取不分页的全部数据。 + 5. **主子表 List 字段** + 主子表结构时,需要在主表实体中将子表作为 `List` 类型字段,便于提交新增/修改、返回数据和删除时统一处理,保证事务一致性。 + 6. **字典使用规范** + - 后端只返回字典键值。 + - 前端列表通过 `dict-tag` 组件展示字典文本。 + - 前端需要显式声明字典,例如: + `const { project_category, change_type, project_phases } = toRefs(proxy?.useDict('project_category', 'change_type', 'project_phases'));` + 7. **实体字段类型规范** + - 数据库 `int` → Java `Integer` + - `decimal` → `BigDecimal` + - `bigint` → `Long` + - `double` → `Double` + - `float` → `Float` + 11. **主子表删除规范** + - 主子表删除时,必须在同一事务中同时删除主表与子表记录,保证数据一致性。 + 12. **接口合并与聚合** + - 前端调用接口应尽量合并:同一模块或同一功能点优先通过单个接口组装返回所需数据,减少多次请求。 + 13. **前端 columns 配置规则** + - `columns` 的 `key` 必须从 `0` 开始,不间断完整自增。 + - 对比实际表格列与 `columns` 配置,第 `0` 列使用“序号”(`index` 列)而不是主键。 + - 将“项目ID”等技术列从 `columns` 中完全移除(而不是隐藏),去掉租户编号等无业务意义的字段,其他字段根据实际情况调整,确保 `columns.key` 连续从 `0` 自增且与表格实际列一一对应。 + 14. **名称获取规范** + - 所有创建人名称、部门名称必须通过后端连表查询得到,而不是前端拼接或本地缓存获取。 + 15. **业务编号规范** + - 业务编号应该唯一。 + 16. **树形结构规范** + - 树形结构的parent_id和ancestors字段的逻辑需要完善,若parent_id和ancestors为0则为顶级节点,0是必须有的。 + 17. **更新子节点的ancestors** + - 更新子节点的ancestors时,需要更新所有子节点的ancestors,而不是只更新当前节点的ancestors。 + 18. **前端树形结构的新增或修改** + - 前端对话框第一行必须是先选择父节点! \ No newline at end of file diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 9e97804..d6dac94 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -93,6 +93,13 @@ ruoyi-workflow + + + org.dromara + hw-rfid + ${revision} + + de.codecentric spring-boot-admin-starter-client @@ -150,4 +157,4 @@ - + \ No newline at end of file diff --git a/ruoyi-modules/hw-rfid/pom.xml b/ruoyi-modules/hw-rfid/pom.xml new file mode 100644 index 0000000..3a11097 --- /dev/null +++ b/ruoyi-modules/hw-rfid/pom.xml @@ -0,0 +1,105 @@ + + + + org.dromara + ruoyi-modules + ${revision} + + 4.0.0 + + hw-rfid + + + hw-rfid模块 + + + + + + org.dromara + ruoyi-common-core + + + + org.dromara + ruoyi-common-doc + + + + org.dromara + ruoyi-common-mybatis + + + + org.dromara + ruoyi-common-translation + + + + + org.dromara + ruoyi-common-oss + + + + org.dromara + ruoyi-common-log + + + + + org.dromara + ruoyi-common-excel + + + + + org.dromara + ruoyi-common-sms + + + + org.dromara + ruoyi-common-tenant + + + + org.dromara + ruoyi-common-security + + + + org.dromara + ruoyi-common-web + + + + org.dromara + ruoyi-common-idempotent + + + + org.dromara + ruoyi-common-sensitive + + + + org.dromara + ruoyi-common-encrypt + + + + org.dromara + ruoyi-common-websocket + + + + org.dromara + ruoyi-common-sse + + + + + diff --git a/ruoyi-modules/pom.xml b/ruoyi-modules/pom.xml index daff497..a3ada9b 100644 --- a/ruoyi-modules/pom.xml +++ b/ruoyi-modules/pom.xml @@ -15,6 +15,7 @@ ruoyi-job ruoyi-system ruoyi-workflow + hw-rfid ruoyi-modules diff --git a/script/rfid.sql b/script/rfid.sql index 953b381..b215819 100644 --- a/script/rfid.sql +++ b/script/rfid.sql @@ -6,8 +6,9 @@ create table rfid_location ( id bigint(20) not null auto_increment comment '标识', location_code varchar(64) not null comment '位置编号', location_alias varchar(128) default null comment '位置别名', - location_type char(1) not null comment '位置类型(1-车间;2-工序;3-工位)', + location_type char(1) default null comment '位置类型(1-车间;2-工序;3-工位)', parent_id bigint(20) default null comment '父级编号,对应本表id', + ancestors varchar(512) default '0' comment '祖级列表', is_marked char(1) not null default '1' comment '是否标识(1-是;0-否)', remark varchar(255) default null comment '备注', created_by varchar(64) default '' comment '创建人', @@ -46,7 +47,7 @@ create table rfid_device ( drop table if exists rfid_read_record; create table rfid_read_record ( id bigint(20) not null auto_increment comment '标识', - device_id bigint(20) not null comment '设备编号,对应rfid_device.id', + device_id bigint(20) not null comment '设备id,对应rfid_device.id', read_status char(1) not null comment '读取状态(1-成功;0-失败)', barcode varchar(128) not null comment '条码信息', record_time datetime not null comment '记录时间',