|
@@ -3,10 +3,9 @@ package com.qmth.ops.biz.service;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.qmth.boot.core.ai.model.llm.LlmAppType;
|
|
|
+import com.qmth.boot.core.exception.ParameterException;
|
|
|
import com.qmth.ops.biz.dao.LlmPromptTemplateDao;
|
|
|
import com.qmth.ops.biz.domain.LlmPromptTemplate;
|
|
|
-import org.springframework.cache.annotation.CachePut;
|
|
|
-import org.springframework.cache.annotation.Cacheable;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -18,6 +17,9 @@ public class LlmPromptTemplateService {
|
|
|
|
|
|
private static final String CACHE_NAME = "llm_prompt_template";
|
|
|
|
|
|
+ @Resource
|
|
|
+ private LlmOrgConfigService llmOrgConfigService;
|
|
|
+
|
|
|
@Resource
|
|
|
private LlmPromptTemplateDao llmPromptTemplateDao;
|
|
|
|
|
@@ -48,5 +50,17 @@ public class LlmPromptTemplateService {
|
|
|
.eq(LlmPromptTemplate::getId, template.getId()));
|
|
|
}
|
|
|
|
|
|
+ @Transactional
|
|
|
+ //@CacheEvict(value = CACHE_NAME, key = "#template.id", unless = "#template==null")
|
|
|
+ public void delete(LlmPromptTemplate template) {
|
|
|
+ if (template == null) {
|
|
|
+ throw new ParameterException("提示词模版ID不存在");
|
|
|
+ }
|
|
|
+ if (llmOrgConfigService.countByPromptTemplate(template) > 0) {
|
|
|
+ throw new ParameterException("提示词模版有关联机构,不能删除");
|
|
|
+ }
|
|
|
+ llmPromptTemplateDao.deleteById(template.getId());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|