| | |
| | | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.R; |
| | |
| | | return R.ok(); |
| | | } |
| | | @ApiOperation(value = "详情系统公告") |
| | | @PostMapping(value = "/detail") |
| | | @GetMapping(value = "/detail") |
| | | public R<TSystemBulletin> detail(@RequestParam String id) { |
| | | |
| | | return R.ok(systemBulletinService.getById(id)); |
| | | } |
| | | |
| | | @Log(title = "删除系统公告", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "删除系统公告") |
| | | @DeleteMapping(value = "/deleteById") |
| | | public R<Boolean> deleteById(@RequestParam String id) { |
| | | systemBulletinService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "批量删除系统公告", businessType = BusinessType.DELETE) |
| | | @ApiOperation(value = "批量删除系统公告") |
| | | @DeleteMapping(value = "/delete") |
| | | public R<Boolean> edit(@RequestParam String ids) { |
| | | @DeleteMapping(value = "/deleteByIds") |
| | | public R<Boolean> deleteByIds(@RequestParam String ids) { |
| | | String[] split = ids.split(","); |
| | | systemBulletinService.removeBatchByIds(Arrays.asList(split)); |
| | | return R.ok(); |
| | | } |
| | | @Log(title = "启用/禁用系统公告", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "启用/禁用系统公告") |
| | | @DeleteMapping(value = "/editStatus") |
| | | @GetMapping(value = "/editStatus") |
| | | public R<Boolean> editStatus(@RequestParam String id) { |
| | | TSystemBulletin byId = systemBulletinService.getById(id); |
| | | if (byId.getStatus()==1){ |
| | | byId.setStatus(2); |
| | | }else{ |
| | | // 查询是否存在已启用的公告 |
| | | long count = systemBulletinService.count(Wrappers.lambdaQuery(TSystemBulletin.class) |
| | | .eq(TSystemBulletin::getStatus, 1)); |
| | | if (count>0){ |
| | | return R.fail("已有启用公告,请将旧公告禁用"); |
| | | } |
| | | byId.setStatus(1); |
| | | } |
| | | systemBulletinService.updateById(byId); |