package com.ruoyi.web.controller.dz;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.syzy.domain.BBusiWishUniversities;
import com.ruoyi.syzy.service.IBBusiWishUniversitiesService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 院校库Controller
 *
 * @author ie
 * @date 2026-01-20
 */
@RestController
@RequestMapping("/system/bBusiWishUniversities")
public class BBusiWishUniversitiesController extends BaseController
{
    @Autowired
    private IBBusiWishUniversitiesService bBusiWishUniversitiesService;

    /**
     * 查询院校库列表
     */
    @PreAuthorize("@ss.hasPermi('system:bBusiWishUniversities:list')")
    @GetMapping("/list")
    public TableDataInfo list(BBusiWishUniversities bBusiWishUniversities)
    {
        startPage();
        List<BBusiWishUniversities> list = bBusiWishUniversitiesService.selectBBusiWishUniversitiesList(bBusiWishUniversities);
        return getDataTable(list);
    }

    @PreAuthorize("@ss.hasPermi('system:bBusiWishUniversities:list')")
    @GetMapping("/listAll")
    public AjaxResult listAll(BBusiWishUniversities bBusiWishUniversities)
    {
        List<BBusiWishUniversities> list = bBusiWishUniversitiesService.selectBBusiWishUniversitiesList(bBusiWishUniversities);
        return AjaxResult.success(list);
    }

    /**
     * 导出院校库列表
     */
    @PreAuthorize("@ss.hasPermi('system:bBusiWishUniversities:export')")
    @Log(title = "院校库", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BBusiWishUniversities bBusiWishUniversities)
    {
        List<BBusiWishUniversities> list = bBusiWishUniversitiesService.selectBBusiWishUniversitiesList(bBusiWishUniversities);
        ExcelUtil<BBusiWishUniversities> util = new ExcelUtil<BBusiWishUniversities>(BBusiWishUniversities.class);
        util.exportExcel(response, list, "院校库数据");
    }

    /**
     * 获取院校库详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:bBusiWishUniversities:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(bBusiWishUniversitiesService.selectBBusiWishUniversitiesById(id));
    }

    /**
     * 新增院校库
     */
    @PreAuthorize("@ss.hasPermi('system:bBusiWishUniversities:add')")
    @Log(title = "院校库", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BBusiWishUniversities bBusiWishUniversities)
    {
        return toAjax(bBusiWishUniversitiesService.insertBBusiWishUniversities(bBusiWishUniversities));
    }

    /**
     * 修改院校库
     */
    @PreAuthorize("@ss.hasPermi('system:bBusiWishUniversities:edit')")
    @Log(title = "院校库", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BBusiWishUniversities bBusiWishUniversities)
    {
        return toAjax(bBusiWishUniversitiesService.updateBBusiWishUniversities(bBusiWishUniversities));
    }

    /**
     * 删除院校库
     */
    @PreAuthorize("@ss.hasPermi('system:bBusiWishUniversities:remove')")
    @Log(title = "院校库", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(bBusiWishUniversitiesService.deleteBBusiWishUniversitiesByIds(ids));
    }
}
