sequenceDiagram
participant User as 用户
participant Controller as GxtEquipmentController
participant Service as IGxtEquipmentService
participant Mapper as GxtEquipmentMapper
participant Database as 数据库
User->>Controller: GET /gxt/equipment/list
Controller->>Service: selectGxtEquipmentList(gxtEquipment)
Service->>Mapper: selectGxtEquipmentList(gxtEquipment)
Mapper->>Database: 执行查询SQL
Database-->>Mapper: 返回查询结果
Mapper-->>Service: 返回GxtEquipment列表
Service-->>Controller: 返回GxtEquipment列表
Controller-->>User: 返回TableDataInfo结果
User->>Controller: POST /gxt/equipment
Controller->>Service: insertGxtEquipment(gxtEquipment)
Service->>Service: 验证设备唯一性
Service->>Mapper: selectGxtEquipmentByCodeAndLocation(equipment)
Mapper->>Database: 执行查询SQL
Database-->>Mapper: 返回查询结果
Mapper-->>Service: 返回GxtEquipment对象
Service->>Service: 判断设备是否存在
alt 设备不存在
Service->>Mapper: insertGxtEquipment(gxtEquipment)
Mapper->>Database: 执行插入SQL
Database-->>Mapper: 返回插入结果
Mapper-->>Service: 返回插入结果
else 设备已存在
Service-->>Controller: 抛出ServiceException异常
Controller-->>User: 返回错误信息
end
Service-->>Controller: 返回插入结果
Controller-->>User: 返回AjaxResult结果
User->>Controller: PUT /gxt/equipment
Controller->>Service: updateGxtEquipment(gxtEquipment)
Service->>Service: 验证设备唯一性(排除当前设备)
Service->>Mapper: selectGxtEquipmentByCodeAndLocation(equipment)
Mapper->>Database: 执行查询SQL
Database-->>Mapper: 返回查询结果
Mapper-->>Service: 返回GxtEquipment对象
Service->>Service: 判断设备是否存在
alt 设备不存在或为当前设备
Service->>Mapper: updateGxtEquipment(gxtEquipment)
Mapper->>Database: 执行更新SQL
Database-->>Mapper: 返回更新结果
Mapper-->>Service: 返回更新结果
else 存在其他相同设备
Service-->>Controller: 抛出ServiceException异常
Controller-->>User: 返回错误信息
end
Service-->>Controller: 返回更新结果
Controller-->>User: 返回AjaxResult结果
User->>Controller: DELETE /gxt/equipment/{equipmentIds}
Controller->>Service: deleteGxtEquipmentByEquipmentIds(equipmentIds)
Service->>Mapper: deleteGxtEquipmentByEquipmentIds(equipmentIds)
Mapper->>Database: 执行删除SQL
Database-->>Mapper: 返回删除结果
Mapper-->>Service: 返回删除结果
Service-->>Controller: 返回删除结果
Controller-->>User: 返回AjaxResult结果
User->>Controller: POST /gxt/equipment/importData
Controller->>Service: importGxtEquipment(equipmentList, updateSupport, operName)
loop 遍历导入数据
Service->>Service: 验证数据有效性
Service->>Mapper: selectGxtEquipmentByCodeAndLocation(equipment)
Mapper->>Database: 执行查询SQL
Database-->>Mapper: 返回查询结果
Mapper-->>Service: 返回GxtEquipment对象
Service->>Service: 判断设备是否存在
alt 设备不存在
Service->>Mapper: insertGxtEquipment(equipment)
Mapper->>Database: 执行插入SQL
Database-->>Mapper: 返回插入结果
Mapper-->>Service: 返回插入结果
else 设备已存在且支持更新
Service->>Mapper: updateGxtEquipment(equipment)
Mapper->>Database: 执行更新SQL
Database-->>Mapper: 返回更新结果
Mapper-->>Service: 返回更新结果
else 设备已存在且不支持更新
Service->>Service: 记录错误信息
end
end
Service-->>Controller: 返回导入结果信息
Controller-->>User: 返回AjaxResult结果