¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.ruoyi.chat.controller.chat; |
| | | |
| | | import java.util.List; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import jakarta.validation.constraints.*; |
| | | import cn.dev33.satoken.annotation.SaCheckPermission; |
| | | import org.ruoyi.common.excel.utils.ExcelUtil; |
| | | import org.ruoyi.common.idempotent.annotation.RepeatSubmit; |
| | | import org.ruoyi.core.page.TableDataInfo; |
| | | import org.ruoyi.domain.bo.ChatSessionBo; |
| | | import org.ruoyi.domain.vo.ChatSessionVo; |
| | | import org.ruoyi.service.IChatSessionService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.ruoyi.common.log.annotation.Log; |
| | | import org.ruoyi.common.web.core.BaseController; |
| | | import org.ruoyi.core.page.PageQuery; |
| | | import org.ruoyi.common.core.domain.R; |
| | | import org.ruoyi.common.core.validate.AddGroup; |
| | | import org.ruoyi.common.core.validate.EditGroup; |
| | | import org.ruoyi.common.log.enums.BusinessType; |
| | | |
| | | /** |
| | | * ä¼è¯ç®¡ç |
| | | * |
| | | * @author ageerle |
| | | * @date 2025-05-03 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @RestController |
| | | @RequestMapping("/system/session") |
| | | public class ChatSessionController extends BaseController { |
| | | |
| | | private final IChatSessionService chatSessionService; |
| | | |
| | | /** |
| | | * æ¥è¯¢ä¼è¯ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:session:list") |
| | | @GetMapping("/list") |
| | | public TableDataInfo<ChatSessionVo> list(ChatSessionBo bo, PageQuery pageQuery) { |
| | | return chatSessionService.queryPageList(bo, pageQuery); |
| | | } |
| | | |
| | | /** |
| | | * 导åºä¼è¯ç®¡çå表 |
| | | */ |
| | | @SaCheckPermission("system:session:export") |
| | | @Log(title = "ä¼è¯ç®¡ç", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(ChatSessionBo bo, HttpServletResponse response) { |
| | | List<ChatSessionVo> list = chatSessionService.queryList(bo); |
| | | ExcelUtil.exportExcel(list, "ä¼è¯ç®¡ç", ChatSessionVo.class, response); |
| | | } |
| | | |
| | | /** |
| | | * è·åä¼è¯ç®¡ç详ç»ä¿¡æ¯ |
| | | * |
| | | * @param id ä¸»é® |
| | | */ |
| | | @SaCheckPermission("system:session:query") |
| | | @GetMapping("/{id}") |
| | | public R<ChatSessionVo> getInfo(@NotNull(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long id) { |
| | | return R.ok(chatSessionService.queryById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢ä¼è¯ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:session:add") |
| | | @Log(title = "ä¼è¯ç®¡ç", businessType = BusinessType.INSERT) |
| | | @RepeatSubmit() |
| | | @PostMapping() |
| | | public R<Void> add(@Validated(AddGroup.class) @RequestBody ChatSessionBo bo) { |
| | | return toAjax(chatSessionService.insertByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹ä¼è¯ç®¡ç |
| | | */ |
| | | @SaCheckPermission("system:session:edit") |
| | | @Log(title = "ä¼è¯ç®¡ç", businessType = BusinessType.UPDATE) |
| | | @RepeatSubmit() |
| | | @PutMapping() |
| | | public R<Void> edit(@Validated(EditGroup.class) @RequestBody ChatSessionBo bo) { |
| | | return toAjax(chatSessionService.updateByBo(bo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤ä¼è¯ç®¡ç |
| | | * |
| | | * @param ids 主é®ä¸² |
| | | */ |
| | | @SaCheckPermission("system:session:remove") |
| | | @Log(title = "ä¼è¯ç®¡ç", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public R<Void> remove(@NotEmpty(message = "主é®ä¸è½ä¸ºç©º") |
| | | @PathVariable Long[] ids) { |
| | | return toAjax(chatSessionService.deleteWithValidByIds(List.of(ids), true)); |
| | | } |
| | | } |