学工发布通知功能代码

This commit is contained in:
MDSMO
2025-08-04 15:10:47 +08:00
parent 78a19c07ce
commit 28383d3a94
7 changed files with 756 additions and 0 deletions

View File

@@ -0,0 +1,142 @@
package com.srs.web.controller.routine;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.srs.routine.domain.NotificationManagement;
import com.srs.routine.domain.dto.SendNotificationDto;
import com.srs.routine.service.INotificationManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;
import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.enums.BusinessType;
import com.srs.common.annotation.Log;
import com.srs.common.core.page.TableDataInfo;
import com.srs.comprehensive.domain.SrsGrade;
/**
* 通知管理Controller
*
* @author srs
* @date 2025-07-30
*/
@RestController
@RequestMapping("/routine/NotificationManagement")
@Api(value = "通知管理管理", tags = "通知管理管理")
public class NotificationManagementController extends BaseController {
@Autowired
private INotificationManagementService notificationManagementService;
/**
* 查询通知管理列表
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:list')")
@GetMapping("/list")
@ApiOperation("查询通知管理列表")
public TableDataInfo list(NotificationManagement notificationManagement)
{
startPage();
List<NotificationManagement> list = notificationManagementService.selectNotificationManagementList(notificationManagement);
return getDataTable(list);
}
/**
* 导出通知管理列表
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:export')")
@Log(title = "通知管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ApiOperation("导出通知管理列表")
public void export(HttpServletResponse response, NotificationManagement notificationManagement)
{
List<NotificationManagement> list = notificationManagementService.selectNotificationManagementList(notificationManagement);
ExcelUtil<NotificationManagement> util = new ExcelUtil<NotificationManagement>(NotificationManagement.class);
util.exportExcel(response, list, "通知管理数据");
}
/**
* 获取通知管理详细信息
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:query')")
@GetMapping(value = "/{id}")
@ApiOperation("获取通知管理详细信息")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(notificationManagementService.selectNotificationManagementById(id));
}
/**
* 新增通知管理
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:add')")
@Log(title = "通知管理", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ApiOperation("新增通知管理")
public AjaxResult add(@RequestBody NotificationManagement notificationManagement)
{
return toAjax(notificationManagementService.insertNotificationManagement(notificationManagement));
}
/**
* 修改通知管理
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:edit')")
@Log(title = "通知管理", businessType = BusinessType.UPDATE)
@PostMapping("/update")
@ApiOperation("修改通知管理")
public AjaxResult edit(@RequestBody NotificationManagement notificationManagement)
{
return toAjax(notificationManagementService.updateNotificationManagement(notificationManagement));
}
/**
* 删除通知管理
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:remove')")
@Log(title = "通知管理", businessType = BusinessType.DELETE)
@PostMapping("/{ids}")
@ApiOperation("删除通知管理")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(notificationManagementService.deleteNotificationManagementByIds(ids));
}
/**
* 获取年级列表
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:list')")
@GetMapping("/gradeList")
@ApiOperation("获取年级列表")
public AjaxResult getGradeList()
{
List<SrsGrade> gradeList = notificationManagementService.getGradeList();
return success(gradeList);
}
/**
* 按年级发送通知
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:add')")
@Log(title = "按年级发送通知", businessType = BusinessType.INSERT)
@PostMapping("/sendByGrades")
@ApiOperation("按年级发送通知")
public AjaxResult sendNotificationByGrades(@RequestBody SendNotificationDto sendNotificationDto)
{
int result = notificationManagementService.sendNotificationByGrades(sendNotificationDto);
return toAjax(result);
}
/**
* 查询当前用户发送的通知列表
*/
@PreAuthorize("@ss.hasPermi('routine:NotificationManagement:list')")
@GetMapping("/my-sent")
@ApiOperation("查询当前用户发送的通知列表")
public TableDataInfo mySentList(NotificationManagement notificationManagement)
{
startPage();
List<NotificationManagement> list = notificationManagementService.selectNotificationManagementListBySender(notificationManagement);
return getDataTable(list);
}
}