package cn.iocoder.yudao.module.reminder.controller.admin;


import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.reminder.entity.InspectionReminderConfig;
import cn.iocoder.yudao.module.reminder.service.IInspectionReminderConfigService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 年审和年检提醒配置表 前端控制器
 * </p>
 *
 * @author lighting
 * @since 2025-07-21
 */
@RestController
@RequestMapping("/inspection-reminder-config")
@RequiredArgsConstructor
public class InspectionReminderConfigController {

    private final IInspectionReminderConfigService inspectionReminderConfigService;

    /**
     * 年审和年检提醒
     */
    @RequestMapping("/expireInspectionReminder")
    public void expireInspectionReminder() {
        inspectionReminderConfigService.expireInspectionReminder();
    }

    /**
     * 获取信息
     *
     * @return InspectionReminderConfig
     */
    @GetMapping
    public CommonResult<?> getInfo() {
        return CommonResult.success(inspectionReminderConfigService.getOne(Wrappers.<InspectionReminderConfig>lambdaQuery()));
    }

    /**
     * 添加信息
     *
     * @param inspectionReminderConfig
     * @return InspectionReminderConfig
     */
    @PostMapping
    public CommonResult<?> addInfo(@RequestBody InspectionReminderConfig inspectionReminderConfig) {
        return CommonResult.success(inspectionReminderConfigService.save(inspectionReminderConfig));
    }

    /**
     * 修改信息
     *
     * @param inspectionReminderConfig
     * @return InspectionReminderConfig
     */
    @PutMapping
    public CommonResult<?> updateInfo(@RequestBody InspectionReminderConfig inspectionReminderConfig) {
        return CommonResult.success(inspectionReminderConfigService.updateById(inspectionReminderConfig));
    }
}
