| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.system.model.TItem; |
| | | import com.ruoyi.system.query.TItemQuery; |
| | | import com.ruoyi.system.service.TItemService; |
| | | import com.ruoyi.system.vo.TItemVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author xiaochen |
| | | * @since 2025-01-17 |
| | | */ |
| | | @Api(tags = "维修物品管理") |
| | | @RestController |
| | | @RequestMapping("/t-item") |
| | | public class TItemController { |
| | | |
| | | private final TItemService itemService; |
| | | @Autowired |
| | | public TItemController(TItemService itemService) { |
| | | this.itemService = itemService; |
| | | } |
| | | |
| | | /** |
| | | * 获取维修物品管理列表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:item:list')") |
| | | @ApiOperation(value = "获取维修物品分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TItemVO>> pageList(@RequestBody TItemQuery query) { |
| | | return R.ok(itemService.pageList(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加维修物品管理 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:item:add')") |
| | | @Log(title = "维修物品信息-新增维修物品", businessType = BusinessType.INSERT) |
| | | @ApiOperation(value = "添加维修物品") |
| | | @PostMapping(value = "/add") |
| | | public R<Boolean> add(@Validated @RequestBody TItem dto) { |
| | | return R.ok(itemService.save(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 修改维修物品 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:item:update')") |
| | | @Log(title = "维修物品信息-修改维修物品", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "修改维修物品") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TItem dto) { |
| | | return R.ok(itemService.updateById(dto)); |
| | | } |
| | | |
| | | /** |
| | | * 查看维修物品详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:item:detail')") |
| | | @ApiOperation(value = "查看维修物品详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TItem> getDetailById(@RequestParam String id) { |
| | | return R.ok(itemService.getById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 删除维修物品 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:item:delete')") |
| | | @Log(title = "维修物品信息-删除维修物品", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除维修物品") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | return R.ok(itemService.removeById(id)); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除维修物品 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('system:item:delete')") |
| | | @Log(title = "维修物品信息-删除维修物品", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除维修物品") |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestBody List<String> ids) { |
| | | return R.ok(itemService.removeByIds(ids)); |
| | | } |
| | | |
| | | } |
| | | |