xuhy
2024-12-25 dc77b1d5327dc7b2b07abdde50d67f600eae680b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package com.stylefeng.guns.modular.api;
 
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.modular.system.model.TNotices;
import com.stylefeng.guns.modular.system.service.ITNoticesService;
import com.stylefeng.guns.modular.system.util.ResultUtil;
import com.stylefeng.guns.modular.system.warpper.TNoticeWarpper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
/**
 * 公告控制器
 */
@Api
@RestController
@RequestMapping("/base/notice")
public class TNoticeController {
 
    @Autowired
    private ITNoticesService noticeService;
 
 
    /**
     * 获取公告列表
     * @param type
     * @return
     */
    @ResponseBody
    @PostMapping("/queryNotices")
    @ApiOperation(value = "获取滚动消息", tags = {"用户端-首页"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "数据类型(1:滚动消息)", name = "type", required = true, dataType = "int")
    })
    public ResultUtil<List<TNoticeWarpper>> queryNotices(Integer type){
        try {
            List<TNoticeWarpper> list = noticeService.queryNotices(type);
            return ResultUtil.success(list);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
    @ResponseBody
    @PostMapping("/allert")
    @ApiOperation(value = "获取公告弹窗", tags = {"用户端-首页"}, notes = "")
    @ApiImplicitParams({
            @ApiImplicitParam(value = "数据类型(2:滚动消息)", name = "type", required = true, dataType = "int")
    })
    public ResultUtil<List<TNotices>> allert(Integer type){
        try {
            List<TNotices> tNotices = noticeService.selectList(new EntityWrapper<TNotices>()
                    .eq("type", 2).eq("isUser",2)
                    .eq("isShow", 1).ne("flag", 3).eq("isAlert",1).eq("isDelete", 1)
            );
            return ResultUtil.success(tNotices);
        }catch (Exception e){
            e.printStackTrace();
            return ResultUtil.runErr();
        }
    }
 
 
}