TestHhhController.java 3.2 KB
package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.system.domain.TestHhh;
import com.ruoyi.system.service.ITestHhhService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * ceshiController
 * 
 * @author ruoyi
 * @date 2023-06-27
 */
@RestController
@RequestMapping("/system/hhh")
public class TestHhhController extends BaseController
{
    @Autowired
    private ITestHhhService testHhhService;

    /**
     * 查询ceshi列表
     */
    @PreAuthorize("@ss.hasPermi('system:hhh:list')")
    @GetMapping("/list")
    public TableDataInfo list(TestHhh testHhh)
    {
        startPage();
        List<TestHhh> list = testHhhService.selectTestHhhList(testHhh);
        return getDataTable(list);
    }

    /**
     * 导出ceshi列表
     */
    @PreAuthorize("@ss.hasPermi('system:hhh:export')")
    @Log(title = "ceshi", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TestHhh testHhh)
    {
        List<TestHhh> list = testHhhService.selectTestHhhList(testHhh);
        ExcelUtil<TestHhh> util = new ExcelUtil<TestHhh>(TestHhh.class);
        util.exportExcel(response, list, "ceshi数据");
    }

    /**
     * 获取ceshi详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:hhh:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(testHhhService.selectTestHhhById(id));
    }

    /**
     * 新增ceshi
     */
    @PreAuthorize("@ss.hasPermi('system:hhh:add')")
    @Log(title = "ceshi", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TestHhh testHhh)
    {
        return toAjax(testHhhService.insertTestHhh(testHhh));
    }

    /**
     * 修改ceshi
     */
    @PreAuthorize("@ss.hasPermi('system:hhh:edit')")
    @Log(title = "ceshi", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TestHhh testHhh)
    {
        return toAjax(testHhhService.updateTestHhh(testHhh));
    }

    /**
     * 删除ceshi
     */
    @PreAuthorize("@ss.hasPermi('system:hhh:remove')")
    @Log(title = "ceshi", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(testHhhService.deleteTestHhhByIds(ids));
    }
}