package com.gree.mall.manager.controller.notice;


import com.gree.mall.manager.helper.ResponseHelper;
import com.gree.mall.manager.logic.notice.MiniNoticeLogic;
import com.gree.mall.manager.plus.entity.MiniNotice;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Slf4j
@RestController
@Api(value = "提醒通知接口" ,tags = {"提醒通知接口"})
@RequestMapping(value = "/notice/mini" ,produces = "application/json; charset=utf-8")
public class MiniNoticeController {

    @Resource
    MiniNoticeLogic miniNoticeLogic;

    @PostMapping("/add")
    @ApiOperation(value = "新增")
    public ResponseHelper add(
            HttpServletRequest request,
            @ApiParam(value = "notice",required = true) @RequestBody MiniNotice miniNotice) {
        miniNoticeLogic.add(request,miniNotice);
        return ResponseHelper.success();
    }

    @PostMapping("/update")
    @ApiOperation(value = "修改")
    public ResponseHelper update(
            @ApiParam(value = "notice",required = true) @RequestBody MiniNotice miniNotice) {
        miniNoticeLogic.update(miniNotice);
        return ResponseHelper.success();
    }

    @GetMapping("/select")
    @ApiOperation(value = "查询")
    public ResponseHelper<List<MiniNotice>> select(HttpServletRequest request){
        List<MiniNotice> list = miniNoticeLogic.select(request);
        return ResponseHelper.success(list);
    }




}
