| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.officesupplies.pojo.OfficeSupplies; |
| | | import com.ruoyi.officesupplies.service.OfficeSuppliesService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Operation(summary = "办公物资-分页查询") |
| | | public AjaxResult listPage(Page page, OfficeSupplies officeSupplies) { |
| | | public R<?> listPage(Page page, OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.listPage(page, officeSupplies); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Operation(summary = "办公物资-添加") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody OfficeSupplies officeSupplies) { |
| | | public R<?> add(@RequestBody OfficeSupplies officeSupplies) { |
| | | // 按照当前时间yyyyMMdd + 当天新增数量 + 1生成编号 |
| | | // 获取当天新增数量 |
| | | long count = officeSuppliesService.count(new LambdaQueryWrapper<OfficeSupplies>() |
| | |
| | | officeSupplies.setCode(code); |
| | | officeSupplies.setStatus(1); |
| | | officeSupplies.setApplyTime(new Date()); |
| | | return officeSuppliesService.save(officeSupplies) ? success() : error(); |
| | | return officeSuppliesService.save(officeSupplies) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Operation(summary = "办公物资-修改") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.updateById(officeSupplies) ? success() : error(); |
| | | public R<?> update(@RequestBody OfficeSupplies officeSupplies) { |
| | | return officeSuppliesService.updateById(officeSupplies) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Operation(summary = "办公物资-删除") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请传入要删除的ID"); |
| | | return officeSuppliesService.removeBatchByIds(ids) ? success() : error(); |
| | | public R<?> delete(@RequestBody List<Long> ids) { |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请传入要删除的ID"); |
| | | return officeSuppliesService.removeBatchByIds(ids) ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |