package com.ruoyi.newstocksystem.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.newstocksystem.domain.TTrends; import com.ruoyi.newstocksystem.service.TTrendsService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 趋势Controller * * @author lxy * @date 2026-01-21 */ @RestController @RequestMapping("/newstocksystem/trends") public class TTrendsController extends BaseController { @Autowired private TTrendsService tTrendsService; /** * 查询趋势列表 */ @PreAuthorize("@ss.hasPermi('newstocksystem:trends:list')") @GetMapping("/list") public TableDataInfo list(TTrends tTrends) { startPage(); List list = tTrendsService.selectTTrendsList(tTrends); return getDataTable(list); } /** * 导出趋势列表 */ @PreAuthorize("@ss.hasPermi('newstocksystem:trends:export')") @Log(title = "趋势", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, TTrends tTrends) { List list = tTrendsService.selectTTrendsList(tTrends); ExcelUtil util = new ExcelUtil(TTrends.class); util.exportExcel(response, list, "趋势数据"); } /** * 获取趋势详细信息 */ @PreAuthorize("@ss.hasPermi('newstocksystem:trends:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(tTrendsService.selectTTrendsById(id)); } /** * 新增趋势 */ @PreAuthorize("@ss.hasPermi('newstocksystem:trends:add')") @Log(title = "趋势", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody TTrends tTrends) { return toAjax(tTrendsService.insertTTrends(tTrends)); } /** * 修改趋势 */ @PreAuthorize("@ss.hasPermi('newstocksystem:trends:edit')") @Log(title = "趋势", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody TTrends tTrends) { return toAjax(tTrendsService.updateTTrends(tTrends)); } /** * 删除趋势 */ @PreAuthorize("@ss.hasPermi('newstocksystem:trends:remove')") @Log(title = "趋势", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(tTrendsService.deleteTTrendsByIds(ids)); } }