This commit is contained in:
王鹏
2026-08-28 13:15:47 +08:00
parent a1a806f266
commit 21eb026789
6 changed files with 133 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
package com.ruoyi.office.controller;
import java.io.IOException;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -19,6 +20,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.office.domain.TtCode;
import com.ruoyi.office.service.ITtCodeService;
import com.ruoyi.office.service.IWebsiteArticleSyncService;
import com.ruoyi.office.service.TtScreenshotArchiveService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
@@ -35,6 +38,12 @@ public class TtCodeController extends BaseController
@Autowired
private ITtCodeService ttCodeService;
@Autowired
private IWebsiteArticleSyncService websiteArticleSyncService;
@Autowired
private TtScreenshotArchiveService screenshotArchiveService;
/**
* 查询源码管理列表
*/
@@ -60,6 +69,17 @@ public class TtCodeController extends BaseController
util.exportExcel(response, list, "源码管理数据");
}
/**
* 下载所选源码项目在文件管理中关联的全部截图。
*/
@PreAuthorize("@ss.hasPermi('office:code:export')")
@Log(title = "下载项目截图", businessType = BusinessType.EXPORT)
@GetMapping("/screenshots/{codeId}/download")
public void downloadScreenshots(@PathVariable Long codeId, HttpServletResponse response) throws IOException
{
screenshotArchiveService.download(codeId, response);
}
/**
* 获取源码管理详细信息
*/
@@ -113,4 +133,17 @@ public class TtCodeController extends BaseController
String msg = ttCodeService.transToArticle1(codeId, templateId);
return success(msg);
}
/**
* 将“复制网站文案”同步为网站Markdown文章。
*/
@PreAuthorize("@ss.hasPermi('office:code:edit')")
@Log(title = "同步网站", businessType = BusinessType.UPDATE)
@PostMapping("/syncWebsite/{codeId}")
public AjaxResult syncWebsite(@PathVariable Long codeId) {
com.ruoyi.office.domain.WebsiteArticleSyncResult result =
websiteArticleSyncService.syncWebsite(codeId);
String message = result.isCreated() ? "同步网站成功,已创建文章" : "同步网站成功,已更新文章";
return AjaxResult.success(message, result);
}
}

View File

@@ -75,6 +75,9 @@ public class TtCodeServiceImpl implements ITtCodeService {
@Override
public TtCode selectTtCodeByCodeId(Long codeId) {
TtCode ttCode = ttCodeMapper.selectTtCodeByCodeId(codeId);
if (ttCode == null) {
return null;
}
TtFile file = new TtFile();
file.setCodeName(ttCode.getCodeName());
ttCode.setFileList(fileMapper.selectTtFileList(file));

View File

@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectTtFileByCodeName" parameterType="String" resultMap="TtFileResult">
<include refid="selectTtFileVo"/>
where code_name = #{codeName}
order by file_id asc
</select>
<insert id="insertTtFile" parameterType="TtFile" useGeneratedKeys="true" keyProperty="fileId">