| | |
| | | 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.waterrecord.pojo.WaterRecord; |
| | | import com.ruoyi.waterrecord.service.WaterRecordService; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | |
| | | |
| | | @GetMapping("/listPage") |
| | | @Log(title = "用水管理-分页查询", businessType = BusinessType.OTHER) |
| | | public AjaxResult listPage(Page page, WaterRecord waterRecord){ |
| | | public R<?> listPage(Page page, WaterRecord waterRecord){ |
| | | IPage<WaterRecord> listPage = waterRecordService.listPage(page, waterRecord); |
| | | return AjaxResult.success(listPage); |
| | | return R.ok(listPage); |
| | | } |
| | | |
| | | @PostMapping("/add") |
| | | @Log(title = "用水管理-新增", businessType = BusinessType.INSERT) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult add(@RequestBody WaterRecord waterRecord){ |
| | | public R<?> add(@RequestBody WaterRecord waterRecord){ |
| | | boolean save = waterRecordService.save(waterRecord); |
| | | return save ? AjaxResult.success() : AjaxResult.error(); |
| | | return save ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @PostMapping("/update") |
| | | @Log(title = "用水管理-修改", businessType = BusinessType.UPDATE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult update(@RequestBody WaterRecord waterRecord){ |
| | | public R<?> update(@RequestBody WaterRecord waterRecord){ |
| | | boolean update = waterRecordService.updateById(waterRecord); |
| | | return update ? AjaxResult.success() : AjaxResult.error(); |
| | | return update ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | @DeleteMapping("/delete") |
| | | @Log(title = "用水管理-删除", businessType = BusinessType.DELETE) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public AjaxResult delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return AjaxResult.error("请选择至少一条数据"); |
| | | public R<?> delete(@RequestBody List<Long> ids){ |
| | | if(CollectionUtils.isEmpty(ids)) return R.fail("请选择至少一条数据"); |
| | | boolean delete = waterRecordService.removeBatchByIds(ids); |
| | | return delete ? AjaxResult.success() : AjaxResult.error(); |
| | | return delete ? R.ok() : R.fail(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Log(title = "导入用水管理", businessType = BusinessType.IMPORT) |
| | | @PostMapping("/importData") |
| | | @Operation(summary = "导入用水管理") |
| | | public AjaxResult importData(MultipartFile file) throws Exception { |
| | | public R<?> importData(MultipartFile file) throws Exception { |
| | | return waterRecordService.importData(file); |
| | | } |
| | | |