package com.hxhq.business.controller;

import com.hxhq.business.domain.Notice;
import com.hxhq.business.dto.study.StudyListDto;
import com.hxhq.business.enums.study.StudyTypeEnum;
import com.hxhq.business.form.study.StudySearchForm;
import com.hxhq.business.service.INoticeService;
import com.hxhq.business.service.IStudyService;
import com.hxhq.common.core.web.controller.BaseController;
import com.hxhq.common.core.web.domain.AjaxResult;
import com.hxhq.common.core.web.page.TableDataInfo;
import com.hxhq.common.security.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * 首页Controller
 *
 * @author hxhq
 * @date 2025-12-24
 */
@RestController
@RequestMapping("/business/home")
public class HomeController extends BaseController
{
    @Autowired
    private IStudyService studyService;
    @Autowired
    private INoticeService noticeService;

    /**
     * 查询首页数量
     */
    @GetMapping("/count")
    @RequiresPermissions("business:user:work")
    public AjaxResult list()
    {
        return AjaxResult.success(studyService.queryHomeCount());
    }

    /**
     * 查询试验列表
     */
    @GetMapping("/noticeList")
    @RequiresPermissions("business:user:work")
    public TableDataInfo noticeService()
    {
        startPage();
        List<Notice> list = noticeService.queryList();
        TableDataInfo table = getDataTable(list);
        return table;
    }
}
