| | |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.officesupplies.pojo.OfficeSupplies; |
| | | import com.ruoyi.officesupplies.service.OfficeSuppliesService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | * @date : 2025/9/4 14:16 |
| | | */ |
| | | @RestController |
| | | @Api(tags = "办公物资") |
| | | @Tag(name = "办公物资") |
| | | @RequestMapping("/officeSupplies") |
| | | @AllArgsConstructor |
| | | public class OfficeSuppliesController extends BaseController { |
| | | |
| | | @Autowired |
| | | private OfficeSuppliesService officeSuppliesService; |
| | | |
| | | @GetMapping("/listPage") |
| | | @ApiOperation("办公物资-分页查询") |
| | | @Operation(summary = "办公物资-分页查询") |
| | | public AjaxResult listPage(Page page, OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.listPage(page, officeSupplies); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @ApiOperation("办公物资-添加") |
| | | @Operation(summary = "办公物资-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody OfficeSupplies officeSupplies) { |
| | | // 按照当前时间yyyyMMdd + 当天新增数量 + 1生成编号 |
| | |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @ApiOperation("办公物资-修改") |
| | | @Operation(summary = "办公物资-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.updateById(officeSupplies) ? success() : error(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @ApiOperation("办公物资-删除") |
| | | @Operation(summary = "办公物资-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | |
| | | */ |
| | | @Log(title = "导出办公物资", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | @ApiOperation("导出办公物资") |
| | | @Operation(summary = "导出办公物资") |
| | | public void export(HttpServletResponse response) { |
| | | ExcelUtil<OfficeSupplies> util = new ExcelUtil<OfficeSupplies>(OfficeSupplies.class); |
| | | List<OfficeSupplies> list = officeSuppliesService.list(); |