You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.3 KiB
76 lines
2.3 KiB
package com.yanzhen.controller;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.yanzhen.entity.NoticeReceive;
|
|
import com.yanzhen.service.NoticeReceiveService;
|
|
import com.yanzhen.utils.Result;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.Map; // 导入Map接口
|
|
//公告接收管理的控制器
|
|
@RestController
|
|
@RequestMapping("/noticeReceive")
|
|
public class NoticeReceiveController {
|
|
//注入实例
|
|
//注入公告接收的服务类
|
|
@Autowired
|
|
private NoticeReceiveService noticeReceiveService;
|
|
//创建新的实例
|
|
@PostMapping("create")
|
|
public Result create(@RequestBody NoticeReceive noticeReceive){
|
|
//在公告接收服务类中引用create方法
|
|
int flag = noticeReceiveService.create(noticeReceive);
|
|
//判断是否创建成功
|
|
if(flag>0){
|
|
//成功
|
|
return Result.ok();
|
|
}else{
|
|
//失败
|
|
return Result.fail();
|
|
}
|
|
}
|
|
//删除公告接收信息
|
|
@GetMapping("delete")
|
|
public Result delete(String ids){
|
|
//在公告接收服务类中引用delete方法
|
|
int flag = noticeReceiveService.delete(ids);
|
|
//判断是否删除成功
|
|
if(flag>0){
|
|
//成功
|
|
return Result.ok();
|
|
}else{
|
|
//失败
|
|
return Result.fail();
|
|
}
|
|
}
|
|
//更新公告接收信息
|
|
@PostMapping("update")
|
|
public Result update(@RequestBody NoticeReceive noticeReceive){
|
|
//在公告接收服务类中引用update方法
|
|
int flag = noticeReceiveService.update(noticeReceive);
|
|
//判断是否更新成功
|
|
if(flag>0){
|
|
//成功
|
|
return Result.ok();
|
|
}else{
|
|
//失败
|
|
return Result.fail();
|
|
}
|
|
}
|
|
//获取公告接收的详细信息
|
|
@GetMapping("detail")
|
|
public NoticeReceive detail(Integer id){
|
|
//返回结果
|
|
return noticeReceiveService.detail(id);
|
|
}
|
|
//查询公告接收信息
|
|
@PostMapping("query")
|
|
public Map<String,Object> query(@RequestBody NoticeReceive noticeReceive){
|
|
//创建分页对象
|
|
PageInfo<NoticeReceive> pageInfo = noticeReceiveService.query(noticeReceive);
|
|
//返回结果
|
|
return Result.ok(pageInfo);
|
|
}
|
|
|
|
} |