2024.5.15 纪念馆新后台
This commit is contained in:
parent
bdc336f8f9
commit
10b079283c
|
@ -84,7 +84,7 @@ public class CommonController
|
||||||
String url = serverConfig.getUrl() + fileName;
|
String url = serverConfig.getUrl() + fileName;
|
||||||
AjaxResult ajax = AjaxResult.success();
|
AjaxResult ajax = AjaxResult.success();
|
||||||
ajax.put("url", url);
|
ajax.put("url", url);
|
||||||
ajax.put("fileName", fileName);
|
ajax.put("fileName", url);
|
||||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||||
ajax.put("originalFilename", file.getOriginalFilename());
|
ajax.put("originalFilename", file.getOriginalFilename());
|
||||||
return ajax;
|
return ajax;
|
||||||
|
|
|
@ -33,8 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/article")
|
@RequestMapping("/system/article")
|
||||||
public class CmsArticleController extends BaseController
|
public class CmsArticleController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ICmsArticleService cmsArticleService;
|
private ICmsArticleService cmsArticleService;
|
||||||
|
|
||||||
|
@ -46,8 +45,7 @@ public class CmsArticleController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:article:list')")
|
@PreAuthorize("@ss.hasPermi('system:article:list')")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(CmsArticle cmsArticle)
|
public TableDataInfo list(CmsArticle cmsArticle) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<CmsArticle> list = cmsArticleService.selectCmsArticleList(cmsArticle);
|
List<CmsArticle> list = cmsArticleService.selectCmsArticleList(cmsArticle);
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
@ -67,8 +65,7 @@ public class CmsArticleController extends BaseController
|
||||||
@PreAuthorize("@ss.hasPermi('system:article:export')")
|
@PreAuthorize("@ss.hasPermi('system:article:export')")
|
||||||
@Log(title = "文章管理", businessType = BusinessType.EXPORT)
|
@Log(title = "文章管理", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, CmsArticle cmsArticle)
|
public void export(HttpServletResponse response, CmsArticle cmsArticle) {
|
||||||
{
|
|
||||||
List<CmsArticle> list = cmsArticleService.selectCmsArticleList(cmsArticle);
|
List<CmsArticle> list = cmsArticleService.selectCmsArticleList(cmsArticle);
|
||||||
ExcelUtil<CmsArticle> util = new ExcelUtil<CmsArticle>(CmsArticle.class);
|
ExcelUtil<CmsArticle> util = new ExcelUtil<CmsArticle>(CmsArticle.class);
|
||||||
util.exportExcel(response, list, "文章管理数据");
|
util.exportExcel(response, list, "文章管理数据");
|
||||||
|
@ -79,8 +76,7 @@ public class CmsArticleController extends BaseController
|
||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('system:article:query')")
|
@PreAuthorize("@ss.hasPermi('system:article:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
{
|
|
||||||
return success(cmsArticleService.selectCmsArticleById(id));
|
return success(cmsArticleService.selectCmsArticleById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +86,14 @@ public class CmsArticleController extends BaseController
|
||||||
@PreAuthorize("@ss.hasPermi('system:article:add')")
|
@PreAuthorize("@ss.hasPermi('system:article:add')")
|
||||||
@Log(title = "文章管理", businessType = BusinessType.INSERT)
|
@Log(title = "文章管理", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody CmsArticle cmsArticle)
|
public AjaxResult add(@RequestBody CmsArticle cmsArticle) {
|
||||||
{
|
|
||||||
String content = new String(Base64.decode(cmsArticle.getContent()));
|
String content = new String(Base64.decode(cmsArticle.getContent()));
|
||||||
|
if (content.contains("/dev-api")) {
|
||||||
|
content = content.replace("/dev-api", "");
|
||||||
|
}
|
||||||
|
if (content.contains("/prod-api")) {
|
||||||
|
content = content.replace("/prod-api", "");
|
||||||
|
}
|
||||||
cmsArticle.setContent(content);
|
cmsArticle.setContent(content);
|
||||||
return toAjax(cmsArticleService.insertCmsArticle(cmsArticle));
|
return toAjax(cmsArticleService.insertCmsArticle(cmsArticle));
|
||||||
}
|
}
|
||||||
|
@ -103,9 +104,14 @@ public class CmsArticleController extends BaseController
|
||||||
@PreAuthorize("@ss.hasPermi('system:article:edit')")
|
@PreAuthorize("@ss.hasPermi('system:article:edit')")
|
||||||
@Log(title = "文章管理", businessType = BusinessType.UPDATE)
|
@Log(title = "文章管理", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody CmsArticle cmsArticle)
|
public AjaxResult edit(@RequestBody CmsArticle cmsArticle) {
|
||||||
{
|
|
||||||
String content = new String(Base64.decode(cmsArticle.getContent()));
|
String content = new String(Base64.decode(cmsArticle.getContent()));
|
||||||
|
if (content.contains("/dev-api")) {
|
||||||
|
content = content.replace("/dev-api", "");
|
||||||
|
}
|
||||||
|
if (content.contains("/prod-api")) {
|
||||||
|
content = content.replace("/prod-api", "");
|
||||||
|
}
|
||||||
cmsArticle.setContent(content);
|
cmsArticle.setContent(content);
|
||||||
return toAjax(cmsArticleService.updateCmsArticle(cmsArticle));
|
return toAjax(cmsArticleService.updateCmsArticle(cmsArticle));
|
||||||
}
|
}
|
||||||
|
@ -116,8 +122,7 @@ public class CmsArticleController extends BaseController
|
||||||
@PreAuthorize("@ss.hasPermi('system:article:remove')")
|
@PreAuthorize("@ss.hasPermi('system:article:remove')")
|
||||||
@Log(title = "文章管理", businessType = BusinessType.DELETE)
|
@Log(title = "文章管理", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{ids}")
|
@DeleteMapping("/{ids}")
|
||||||
public AjaxResult remove(@PathVariable Long[] ids)
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||||
{
|
|
||||||
return toAjax(cmsArticleService.deleteCmsArticleByIds(ids));
|
return toAjax(cmsArticleService.deleteCmsArticleByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue