2024.5.15 纪念馆新后台
This commit is contained in:
parent
bdc336f8f9
commit
10b079283c
|
@ -23,7 +23,7 @@ import com.ruoyi.framework.config.ServerConfig;
|
|||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@RestController
|
||||
|
@ -39,7 +39,7 @@ public class CommonController
|
|||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
|
@ -84,7 +84,7 @@ public class CommonController
|
|||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("url", url);
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("fileName", url);
|
||||
ajax.put("newFileName", FileUtils.getName(fileName));
|
||||
ajax.put("originalFilename", file.getOriginalFilename());
|
||||
return ajax;
|
||||
|
|
|
@ -33,8 +33,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
|||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/article")
|
||||
public class CmsArticleController extends BaseController
|
||||
{
|
||||
public class CmsArticleController extends BaseController {
|
||||
@Autowired
|
||||
private ICmsArticleService cmsArticleService;
|
||||
|
||||
|
@ -46,15 +45,14 @@ public class CmsArticleController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:article:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(CmsArticle cmsArticle)
|
||||
{
|
||||
public TableDataInfo list(CmsArticle cmsArticle) {
|
||||
startPage();
|
||||
List<CmsArticle> list = cmsArticleService.selectCmsArticleList(cmsArticle);
|
||||
for (int i = 0;i<list.size();i++){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CmsCategory category = categoryService.selectCmsCategoryByCategoryId(Long.valueOf(list.get(i).getCategoryId()));
|
||||
if(category != null){
|
||||
if (category != null) {
|
||||
list.get(i).setCategoryName(category.getCategoryName());
|
||||
}else {
|
||||
} else {
|
||||
list.get(i).setCategoryName(null);
|
||||
}
|
||||
}
|
||||
|
@ -67,8 +65,7 @@ public class CmsArticleController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('system:article:export')")
|
||||
@Log(title = "文章管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CmsArticle cmsArticle)
|
||||
{
|
||||
public void export(HttpServletResponse response, CmsArticle cmsArticle) {
|
||||
List<CmsArticle> list = cmsArticleService.selectCmsArticleList(cmsArticle);
|
||||
ExcelUtil<CmsArticle> util = new ExcelUtil<CmsArticle>(CmsArticle.class);
|
||||
util.exportExcel(response, list, "文章管理数据");
|
||||
|
@ -79,8 +76,7 @@ public class CmsArticleController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:article:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(cmsArticleService.selectCmsArticleById(id));
|
||||
}
|
||||
|
||||
|
@ -90,9 +86,14 @@ public class CmsArticleController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('system:article:add')")
|
||||
@Log(title = "文章管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody CmsArticle cmsArticle)
|
||||
{
|
||||
public AjaxResult add(@RequestBody CmsArticle cmsArticle) {
|
||||
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);
|
||||
return toAjax(cmsArticleService.insertCmsArticle(cmsArticle));
|
||||
}
|
||||
|
@ -103,9 +104,14 @@ public class CmsArticleController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('system:article:edit')")
|
||||
@Log(title = "文章管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody CmsArticle cmsArticle)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody CmsArticle cmsArticle) {
|
||||
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);
|
||||
return toAjax(cmsArticleService.updateCmsArticle(cmsArticle));
|
||||
}
|
||||
|
@ -115,9 +121,8 @@ public class CmsArticleController extends BaseController
|
|||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:article:remove')")
|
||||
@Log(title = "文章管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(cmsArticleService.deleteCmsArticleByIds(ids));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue