| package com.doumee.api.business; | 
|   | 
| import com.doumee.api.BaseController; | 
| import com.doumee.core.annotation.excel.ExcelExporter; | 
| import com.doumee.core.annotation.pr.PreventRepeat; | 
| import com.doumee.core.model.ApiResponse; | 
| import com.doumee.core.model.PageWrap; | 
| import com.doumee.core.model.PageData; | 
| import com.doumee.dao.business.model.Labels; | 
| import com.doumee.service.business.LabelsService; | 
| import io.swagger.annotations.Api; | 
| import io.swagger.annotations.ApiOperation; | 
| import org.apache.shiro.authz.annotation.RequiresPermissions;     | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.web.bind.annotation.*; | 
| import javax.servlet.http.HttpServletResponse; | 
|   | 
| import java.util.ArrayList; | 
| import java.util.List; | 
|   | 
| /** | 
|  * @author 江蹄蹄 | 
|  * @date 2025/05/14 13:49 | 
|  */ | 
| @Api(tags = "知识库标签库信息表") | 
| @RestController | 
| @RequestMapping("/business/labels") | 
| public class LabelsController extends BaseController { | 
|   | 
|     @Autowired | 
|     private LabelsService labelsService; | 
|   | 
|     @PreventRepeat | 
|     @ApiOperation("新建") | 
|     @PostMapping("/create") | 
|     @RequiresPermissions("business:labels:create") | 
|     public ApiResponse create(@RequestBody Labels labels) { | 
|         return ApiResponse.success(labelsService.create(labels)); | 
|     } | 
|   | 
|   | 
|     @ApiOperation("获取列表") | 
|     @PostMapping("/list") | 
|     @RequiresPermissions("business:labels:query") | 
|     public ApiResponse<List<Labels>> list() { | 
|         return ApiResponse.success(labelsService.findList()); | 
|     } | 
|   | 
|     @ApiOperation("根据ID删除") | 
|     @GetMapping("/delete/{id}") | 
|     @RequiresPermissions("business:labels:delete") | 
|     public ApiResponse deleteById(@PathVariable Integer id) { | 
|         labelsService.deleteById(id); | 
|         return ApiResponse.success(null); | 
|     } | 
| // | 
| //    @ApiOperation("批量删除") | 
| //    @GetMapping("/delete/batch") | 
| //    @RequiresPermissions("business:labels:delete") | 
| //    public ApiResponse deleteByIdInBatch(@RequestParam String ids) { | 
| //        String [] idArray = ids.split(","); | 
| //        List<Integer> idList = new ArrayList<>(); | 
| //        for (String id : idArray) { | 
| //            idList.add(Integer.valueOf(id)); | 
| //        } | 
| //        labelsService.deleteByIdInBatch(idList); | 
| //        return ApiResponse.success(null); | 
| //    } | 
| // | 
| //    @ApiOperation("根据ID修改") | 
| //    @PostMapping("/updateById") | 
| //    @RequiresPermissions("business:labels:update") | 
| //    public ApiResponse updateById(@RequestBody Labels labels) { | 
| //        labelsService.updateById(labels); | 
| //        return ApiResponse.success(null); | 
| //    } | 
| // | 
| //    @ApiOperation("分页查询") | 
| //    @PostMapping("/page") | 
| //    @RequiresPermissions("business:labels:query") | 
| //    public ApiResponse<PageData<Labels>> findPage (@RequestBody PageWrap<Labels> pageWrap) { | 
| //        return ApiResponse.success(labelsService.findPage(pageWrap)); | 
| //    } | 
| // | 
| //    @ApiOperation("导出Excel") | 
| //    @PostMapping("/exportExcel") | 
| //    @RequiresPermissions("business:labels:exportExcel") | 
| //    public void exportExcel (@RequestBody PageWrap<Labels> pageWrap, HttpServletResponse response) { | 
| //        ExcelExporter.build(Labels.class).export(labelsService.findPage(pageWrap).getRecords(), "知识库标签库信息表", response); | 
| //    } | 
| // | 
| //    @ApiOperation("根据ID查询") | 
| //    @GetMapping("/{id}") | 
| //    @RequiresPermissions("business:labels:query") | 
| //    public ApiResponse findById(@PathVariable Integer id) { | 
| //        return ApiResponse.success(labelsService.findById(id)); | 
| //    } | 
| } |