| | |
| | | private final ITBatteryGroupService batteryGroupService; |
| | | @Autowired public TBatteryGroupController(ITBatteryGroupService batteryGroupService) { this.batteryGroupService = batteryGroupService; } |
| | | |
| | | /** 分页查询电池组列表。 */ |
| | | @PreAuthorize("@ss.hasPermi('system:batteryGroup:list')") @GetMapping("/list") |
| | | public TableDataInfo list(TBatteryGroup group) { startPage(); List<TBatteryGroup> list = batteryGroupService.selectBatteryGroupList(group); return getDataTable(list); } |
| | | |
| | | /** 返回可作为创建人的启用用户选项。 */ |
| | | @PreAuthorize("@ss.hasPermi('system:batteryGroup:list')") @GetMapping("/creatorOptions") |
| | | public AjaxResult creatorOptions() { return success(batteryGroupService.selectBatteryGroupCreatorOptions()); } |
| | | |
| | | /** 按电池组主键查询电池组及其当前字段值。 */ |
| | | @PreAuthorize("@ss.hasPermi('system:batteryGroup:query')") @GetMapping("/{groupId}") |
| | | public AjaxResult getInfo(@PathVariable Long groupId) { return success(batteryGroupService.selectBatteryGroupById(groupId)); } |
| | | |
| | | /** 新增电池组及电池号与字段值。 */ |
| | | @PreAuthorize("@ss.hasPermi('system:batteryGroup:add')") @Log(title = "电池组管理", businessType = BusinessType.INSERT) @PostMapping |
| | | public AjaxResult add(@Validated @RequestBody BatteryGroupDto request) { TBatteryGroup group = toDomain(request); group.setCreateBy(getUsername()); return toAjax(batteryGroupService.insertBatteryGroup(group)); } |
| | | |
| | | /** 修改电池组;字段值按提交内容整体替换为当前值。 */ |
| | | @PreAuthorize("@ss.hasPermi('system:batteryGroup:edit')") @Log(title = "电池组管理", businessType = BusinessType.UPDATE) @PutMapping |
| | | public AjaxResult edit(@Validated @RequestBody BatteryGroupDto request) { TBatteryGroup group = toDomain(request); group.setUpdateBy(getUsername()); return toAjax(batteryGroupService.updateBatteryGroup(group)); } |
| | | |
| | | /** 启用或停用电池组;已被测试引用的电池组不能删除,但可以停用。 */ |
| | | @PreAuthorize("@ss.hasPermi('system:batteryGroup:changeStatus')") @Log(title = "电池组管理", businessType = BusinessType.UPDATE) @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody TBatteryGroup group) { group.setUpdateBy(getUsername()); return toAjax(batteryGroupService.updateBatteryGroupStatus(group)); } |
| | | |
| | | /** 删除电池组;电池号与字段关系一并清理,被测试引用的电池组由服务层拒绝。 */ |
| | | @PreAuthorize("@ss.hasPermi('system:batteryGroup:remove')") @Log(title = "电池组管理", businessType = BusinessType.DELETE) @DeleteMapping("/{groupIds}") |
| | | public AjaxResult remove(@PathVariable Long[] groupIds) { return toAjax(batteryGroupService.deleteBatteryGroupByIds(groupIds, getUsername())); } |
| | | |