package com.ruoyi.mall.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.mall.domain.MallIndustryClass; import com.ruoyi.mall.service.IMallIndustryClassService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** * 行业分类Controller * * @author ruoyi * @date 2023-12-15 */ @RestController @RequestMapping("/mall/IndustryClass") public class MallIndustryClassController extends BaseController { @Autowired private IMallIndustryClassService mallIndustryClassService; /** * 查询行业分类列表 */ @PreAuthorize("@ss.hasPermi('mall:IndustryClass:list')") @GetMapping("/list") public List classList(MallIndustryClass mallIndustryClass) { return mallIndustryClassService.selectMallIndustryClassList(mallIndustryClass); } /** * 查询行业分类列表 */ @PreAuthorize("@ss.hasPermi('mall:IndustryClass:list')") @GetMapping("/PageList") public TableDataInfo list(MallIndustryClass mallIndustryClass) { startPage(); List list = mallIndustryClassService.selectMallIndustryClassList(mallIndustryClass); return getDataTable(list); } /** * 导出行业分类列表 */ @PreAuthorize("@ss.hasPermi('mall:IndustryClass:export')") @Log(title = "行业分类", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, MallIndustryClass mallIndustryClass) { List list = mallIndustryClassService.selectMallIndustryClassList(mallIndustryClass); ExcelUtil util = new ExcelUtil(MallIndustryClass.class); util.exportExcel(response, list, "行业分类数据"); } /** * 获取行业分类详细信息 */ @PreAuthorize("@ss.hasPermi('mall:IndustryClass:query')") @GetMapping(value = "/{id}") public AjaxResult getInfo(@PathVariable("id") Long id) { return AjaxResult.success(mallIndustryClassService.selectMallIndustryClassById(id)); } /** * 新增行业分类 */ @PreAuthorize("@ss.hasPermi('mall:IndustryClass:add')") @Log(title = "行业分类", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody MallIndustryClass mallIndustryClass) { return toAjax(mallIndustryClassService.insertMallIndustryClass(mallIndustryClass)); } /** * 修改行业分类 */ @PreAuthorize("@ss.hasPermi('mall:IndustryClass:edit')") @Log(title = "行业分类", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody MallIndustryClass mallIndustryClass) { return toAjax(mallIndustryClassService.updateMallIndustryClass(mallIndustryClass)); } /** * 删除行业分类 */ @PreAuthorize("@ss.hasPermi('mall:IndustryClass:remove')") @Log(title = "行业分类", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable Long[] ids) { return toAjax(mallIndustryClassService.deleteMallIndustryClassByIds(ids)); } }