package com.srs.web.controller.comprehensive;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.*;
import org.springframework.security.access.prepost.PreAuthorize;

import com.srs.comprehensive.domain.CphLakeType;
import com.srs.comprehensive.service.ICphLakeTypeService;
import com.srs.common.core.controller.BaseController;
import com.srs.common.core.domain.AjaxResult;
import com.srs.common.utils.poi.ExcelUtil;
import com.srs.common.enums.BusinessType;
import com.srs.common.annotation.Log;

/**
 * 静湖之星类别Controller
 *
 * @author srs
 * @date 2023-10-31
 */
@RestController
@RequestMapping("/comprehensive/laketype")
@Api(value = "静湖之星类别管理", tags = "静湖之星类别管理")
public class CphLakeTypeController extends BaseController {
    @Autowired
    private ICphLakeTypeService cphLakeTypeService;

    @GetMapping("/listSelect")
    @ApiOperation("查询静湖之星下拉框搜索类别列表")
    public AjaxResult listSelect(){
        List<CphLakeType> list = cphLakeTypeService.listSelect();
        return success(list);
    }

    @GetMapping("/listOneHundred")
    @ApiOperation("查询静湖之星百名优秀大学生类别列表")
    public AjaxResult listOneHundred(){
        List<CphLakeType> list = cphLakeTypeService.listOneHundred();
        return success(list);
    }



    /**
     * 查询静湖之星类别列表
     */
@PreAuthorize("@ss.hasPermi('comprehensive:type:list')")
@GetMapping("/list")
@ApiOperation("查询静湖之星类别列表")
    public AjaxResult list(CphLakeType cphLakeType)
    {
        List<CphLakeType> list = cphLakeTypeService.selectCphLakeTypeList(cphLakeType);
        return success(list);
    }

    /**
     * 导出静湖之星类别列表
     */
    @PreAuthorize("@ss.hasPermi('comprehensive:type:export')")
    @Log(title = "静湖之星类别", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ApiOperation("导出静湖之星类别列表")
    public void export(HttpServletResponse response, CphLakeType cphLakeType)
    {
        List<CphLakeType> list = cphLakeTypeService.selectCphLakeTypeList(cphLakeType);
        ExcelUtil<CphLakeType> util = new ExcelUtil<CphLakeType>(CphLakeType.class);
        util.exportExcel(response, list, "静湖之星类别数据");
    }

    /**
     * 获取静湖之星类别详细信息
     */
    @PreAuthorize("@ss.hasPermi('comprehensive:type:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取静湖之星类别详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(cphLakeTypeService.selectCphLakeTypeById(id));
    }

    /**
     * 新增静湖之星类别
     */
    @PreAuthorize("@ss.hasPermi('comprehensive:type:add')")
    @Log(title = "静湖之星类别", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ApiOperation("新增静湖之星类别")
    public AjaxResult add(@RequestBody CphLakeType cphLakeType)
    {
        return toAjax(cphLakeTypeService.insertCphLakeType(cphLakeType));
    }

    /**
     * 修改静湖之星类别
     */
    @PreAuthorize("@ss.hasPermi('comprehensive:type:edit')")
    @Log(title = "静湖之星类别", businessType = BusinessType.UPDATE)
    @PostMapping("/update")
    @ApiOperation("修改静湖之星类别")
    public AjaxResult edit(@RequestBody CphLakeType cphLakeType)
    {
        return toAjax(cphLakeTypeService.updateCphLakeType(cphLakeType));
    }

    /**
     * 删除静湖之星类别
     */
    @PreAuthorize("@ss.hasPermi('comprehensive:type:remove')")
    @Log(title = "静湖之星类别", businessType = BusinessType.DELETE)
    @PostMapping("/{ids}")
    @ApiOperation("删除静湖之星类别")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(cphLakeTypeService.deleteCphLakeTypeByIds(ids));
    }
}
