package com.template.controller;


import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.template.annotation.DESRespondSecret;
import com.template.api.SmartNotificationControllerAPI;
import com.template.model.pojo.SmartNotification;
import com.template.model.pojo.SmartWarning;
import com.template.model.result.CommonResult;
import com.template.model.result.PageUtils;
import com.template.services.SmartNotificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author ceshi
 * @since 2024-01-30
 */
@RestController
//返回参数加密注解
@DESRespondSecret
public class SmartNotificationController implements SmartNotificationControllerAPI {

    @Autowired
    SmartNotificationService smartNotificationService;


    @Override
    @DESRespondSecret(validated = true)
    public CommonResult  remindingList(Integer id, int currentPage, int pageCount, String type) {
        if (ObjectUtils.isEmpty(currentPage) && currentPage <= 0) {
            currentPage = 1;
        }

        if (ObjectUtils.isEmpty(pageCount) && pageCount <= 0) {
            currentPage = 10;
        }

        PageUtils<SmartNotification> result = smartNotificationService.pageRemindingList(id, currentPage, pageCount, type);

        return CommonResult.ok(result);
    }
}

