|
1
2
|
package com.huaheng.pc.system.notice.controller;
|
|
3
4
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
5
|
import com.huaheng.common.utils.Wrappers;
|
|
6
7
8
9
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.framework.web.controller.BaseController;
|
|
10
|
import com.huaheng.framework.web.domain.AjaxResult;
|
|
11
12
13
14
|
import com.huaheng.framework.web.page.PageDomain;
import com.huaheng.framework.web.page.TableDataInfo;
import com.huaheng.framework.web.page.TableSupport;
import com.huaheng.pc.receipt.receiptHeader.domain.ReceiptHeader;
|
|
15
16
17
18
19
20
|
import com.huaheng.pc.system.notice.domain.SysNotice;
import com.huaheng.pc.system.notice.service.SysNoticeService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
|
|
21
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
22
23
24
25
26
27
28
|
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.ArrayList;
@Controller
@RequestMapping("/system/notice")
|
|
29
|
public class SysNoticeController extends BaseController {
|
|
30
31
32
33
34
|
@Resource
private SysNoticeService sysNoticeService;
private String prefix = "system/notice";
|
|
35
|
@GetMapping("")
|
|
36
37
|
public String mailbox(ModelMap mmap){
mmap.put("user",ShiroUtils.getUser());
|
|
38
39
40
|
return prefix+"/mailbox";
}
|
|
41
42
43
44
45
46
47
|
@GetMapping("/list")
@ResponseBody
public TableDataInfo list(String status) {
LambdaQueryWrapper<SysNotice> lambdaQueryWrapper = Wrappers.lambdaQuery();
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();
|
|
48
49
|
lambdaQueryWrapper.eq(StringUtils.isNotEmpty(status), SysNotice::getStatus, status)
.orderByAsc(SysNotice::getStatus);
|
|
50
51
52
53
54
55
56
57
58
|
if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)) {
Page<SysNotice> page = new Page(pageNum, pageSize);
IPage<SysNotice> iPage = sysNoticeService.page(page, lambdaQueryWrapper);
return getMpDataTable(iPage.getRecords(), iPage.getTotal());
} else {
return getDataTable(sysNoticeService.list(lambdaQueryWrapper));
}
}
|
|
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/**
* 将所有消息已读
* @return
*/
@GetMapping("/readAll")
@ResponseBody
public AjaxResult readAll(){
if (sysNoticeService.readAll()){
return AjaxResult.success();
}else {
return AjaxResult.error("消息记录状态修改失败");
}
}
|
|
72
73
74
75
76
77
78
79
80
81
|
@GetMapping("/readOne")
@ResponseBody
public AjaxResult readOne(@RequestParam String id){
if (sysNoticeService.readOne(id)){
return AjaxResult.success();
}else {
return AjaxResult.error("id为"+id+"消息记录状态修改失败");
}
}
|
|
82
|
}
|