package com.ruoyi.web.controller; import java.util.Arrays; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.web.domain.HdQh; import com.ruoyi.web.service.IHdQhService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 活动信息-球耗Controller * * @author shenzx * @date 2025-11-22 */ @RestController @RequestMapping("/hd/qh") public class HdQhController extends BaseController { private IHdQhService hdQhService; @Autowired public void setHdQhService(IHdQhService hdQhService) { this.hdQhService = hdQhService; } /** * 查询活动信息-球耗列表 */ @PreAuthorize("@ss.hasPermi('hd:qh:list')") @GetMapping("/list") public TableDataInfo list(HdQh hdQh) { startPage(); QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.setEntity(hdQh); List hdQhList = hdQhService.list(queryWrapper); return getDataTable(hdQhList); } /** * 导出活动信息-球耗列表 */ @PreAuthorize("@ss.hasPermi('hd:qh:export')") @Log(title = "活动信息-球耗", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, HdQh hdQh) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.setEntity(hdQh); List list = hdQhService.list(queryWrapper); ExcelUtil util = new ExcelUtil<>(HdQh.class); util.exportExcel(response, list, "活动信息-球耗数据"); } /** * 获取活动信息-球耗详细信息 */ @PreAuthorize("@ss.hasPermi('hd:qh:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return success(hdQhService.getById(id)); } /** * 新增活动信息-球耗 */ @PreAuthorize("@ss.hasPermi('hd:qh:add')") @Log(title = "活动信息-球耗", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody HdQh hdQh) { hdQhService.save(hdQh); return success(hdQh); } /** * 修改活动信息-球耗 */ @PreAuthorize("@ss.hasPermi('hd:qh:edit')") @Log(title = "活动信息-球耗", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody HdQh hdQh) { hdQhService.updateById(hdQh); return success(hdQh); } /** * 删除活动信息-球耗 */ @PreAuthorize("@ss.hasPermi('hd:qh:remove')") @Log(title = "活动信息-球耗", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(hdQhService.removeByIds(Arrays.asList(ids))); } }