modal 增加删除

This commit is contained in:
cherishsince 2024-04-25 15:15:33 +08:00
parent faade05528
commit f85c89a405
3 changed files with 22 additions and 0 deletions

View File

@ -59,4 +59,10 @@ public class AiChatModalController {
return CommonResult.success(null);
}
@Operation(summary = "ai模型 - 删除")
@DeleteMapping("/modal/{id}")
public CommonResult delete(@PathVariable Long id) {
aiChatModalService.delete(id);
return CommonResult.success(null);
}
}

View File

@ -36,4 +36,12 @@ public interface AiChatModalService {
* @param req
*/
void update(Long id, AiChatModalAddReq req);
/**
* ai modal - 删除
*
* @param id
*/
void delete(Long id);
}

View File

@ -72,6 +72,14 @@ public class AiChatModalServiceImpl implements AiChatModalService {
aiChatModalMapper.updateById(updateChatModalDO);
}
@Override
public void delete(Long id) {
// 检查 modal 是否存在
validateChatModalExists(id);
// 删除 delete
aiChatModalMapper.deleteById(id);
}
private void validateChatModalExists(Long id) {
AiChatModalDO aiChatModalDO = aiChatModalMapper.selectById(id);
if (aiChatModalDO == null) {