增加消息板块
This commit is contained in:
@ -0,0 +1,108 @@
|
||||
package com.ruoyi.web.controller.wgz.controller;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.ruoyi.wgz.domain.WgzMessage;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.wgz.bo.WgzMessageQueryBo;
|
||||
import com.ruoyi.wgz.service.IWgzMessageService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* 消息Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-24
|
||||
*/
|
||||
@Api(value = "消息控制器", tags = {"消息管理"})
|
||||
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||
@RestController
|
||||
@RequestMapping("/wgz/message")
|
||||
public class WgzMessageController extends BaseController {
|
||||
|
||||
private final IWgzMessageService iWgzMessageService;
|
||||
|
||||
/**
|
||||
* 查询消息列表
|
||||
*/
|
||||
@ApiOperation("查询消息列表")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:message:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<WgzMessage> list(@Validated WgzMessageQueryBo bo) {
|
||||
return iWgzMessageService.queryPageList(bo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出消息列表
|
||||
*/
|
||||
@ApiOperation("导出消息列表")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:message:export')")
|
||||
@Log(title = "消息", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult<WgzMessage> export(@Validated WgzMessageQueryBo bo) {
|
||||
List<WgzMessage> list = iWgzMessageService.queryList(bo);
|
||||
ExcelUtil<WgzMessage> util = new ExcelUtil<WgzMessage>(WgzMessage.class);
|
||||
return util.exportExcel(list, "消息");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取消息详细信息
|
||||
*/
|
||||
@ApiOperation("获取消息详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:message:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult<WgzMessage> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return AjaxResult.success(iWgzMessageService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增消息
|
||||
*/
|
||||
@ApiOperation("新增消息")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:message:add')")
|
||||
@Log(title = "消息", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit
|
||||
@PostMapping()
|
||||
public AjaxResult<Void> add(@Validated @RequestBody WgzMessage bo) {
|
||||
return toAjax(iWgzMessageService.insert(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改消息
|
||||
*/
|
||||
@ApiOperation("修改消息")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:message:edit')")
|
||||
@Log(title = "消息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit
|
||||
@PutMapping()
|
||||
public AjaxResult<Void> edit(@Validated @RequestBody WgzMessage bo) {
|
||||
return toAjax(iWgzMessageService.update(bo) ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除消息
|
||||
*/
|
||||
@ApiOperation("删除消息")
|
||||
@PreAuthorize("@ss.hasPermi('wgz:message:remove')")
|
||||
@Log(title = "消息" , businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(iWgzMessageService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user