package com.ruoyi.web.controller.smartor; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.smartor.domain.BaseTagcategory; import com.smartor.service.IBaseTagcategoryService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * 标签分类Controller * * @author ruoyi * @date 2023-06-15 */ @Api(description = "标签分类") @Slf4j @RestController @RequestMapping("/system/tagcategory") public class BaseTagcategoryController extends BaseController { @Autowired private IBaseTagcategoryService baseTagcategoryService; /** * 查询标签分类列表 */ //@PreAuthorize("@ss.hasPermi('system:tagcategory:list')") @PostMapping("/list") public TableDataInfo list(@RequestBody BaseTagcategory baseTagcategory) { startPage(); List list = baseTagcategoryService.selectBaseTagcategoryList(baseTagcategory); return getDataTable(list); } /** * 导出标签分类列表 */ //@PreAuthorize("@ss.hasPermi('system:tagcategory:export')") @Log(title = "标签分类", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, BaseTagcategory baseTagcategory) { List list = baseTagcategoryService.selectBaseTagcategoryList(baseTagcategory); ExcelUtil util = new ExcelUtil(BaseTagcategory.class); util.exportExcel(response, list, "标签分类数据"); } /** * 获取标签分类详细信息 */ //@PreAuthorize("@ss.hasPermi('system:tagcategory:query')") @GetMapping(value = "/{tagcategoryid}") public AjaxResult getInfo(@PathVariable("tagcategoryid") Long tagcategoryid) { return success(baseTagcategoryService.selectBaseTagcategoryByTagcategoryid(tagcategoryid)); } /** * 新增标签分类 */ //@PreAuthorize("@ss.hasPermi('system:tagcategory:add')") @Log(title = "标签分类", businessType = BusinessType.INSERT) @ApiOperation("新增标签分类") @PostMapping("/add") public AjaxResult add(@RequestBody BaseTagcategory baseTagcategory) { SysUser user = getLoginUser().getUser(); baseTagcategory.setGuid(user.getGuid()); return toAjax(baseTagcategoryService.insertBaseTagcategory(baseTagcategory)); } /** * 修改标签分类 */ //@PreAuthorize("@ss.hasPermi('system:tagcategory:edit')") @Log(title = "标签分类", businessType = BusinessType.UPDATE) @ApiOperation("修改标签分类") @PostMapping("/edit") public AjaxResult edit(@RequestBody BaseTagcategory baseTagcategory) { return toAjax(baseTagcategoryService.updateBaseTagcategory(baseTagcategory)); } /** * 根据分类ID删除标签分类 */ //@PreAuthorize("@ss.hasPermi('system:tagcategory:remove')") @Log(title = "标签分类", businessType = BusinessType.DELETE) @ApiOperation("根据分类ID删除标签分类") @GetMapping("/remove/{tagcategoryids}") public AjaxResult remove(@PathVariable Long[] tagcategoryids) { return toAjax(baseTagcategoryService.deleteBaseTagcategoryByTagcategoryids(tagcategoryids)); } /** * 根据标签类别名获取标签分类信息 */ @ApiOperation("根据标签类别名获取标签分类信息(标签分类)") @PostMapping("/baseTagCategoryByName") public TableDataInfo baseTagCategoryByName(@RequestParam("name") String name) { return getDataTable(baseTagcategoryService.baseTagCategoryByName(name)); } }