add 文章详情加项目截图展示
This commit is contained in:
@@ -9,12 +9,15 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
|||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
import com.ruoyi.common.enums.BusinessType;
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.office.domain.TtFile;
|
||||||
|
import com.ruoyi.office.service.ITtFileService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -25,20 +28,21 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/app/article")
|
@RequestMapping("/app/article")
|
||||||
public class AppBlogArticleController extends BaseController
|
public class AppBlogArticleController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAppBlogArticleService appBlogArticleService;
|
private IAppBlogArticleService appBlogArticleService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AppBlogArticleMapper appBlogArticleMapper;
|
private AppBlogArticleMapper appBlogArticleMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ITtFileService fileService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询文章列表
|
* 查询文章列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(AppBlogArticle appBlogArticle)
|
public TableDataInfo list(AppBlogArticle appBlogArticle) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<AppBlogArticle> list = appBlogArticleService.selectAppBlogArticleList(appBlogArticle);
|
List<AppBlogArticle> list = appBlogArticleService.selectAppBlogArticleList(appBlogArticle);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
@@ -50,8 +54,7 @@ public class AppBlogArticleController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('app:article:export')")
|
@PreAuthorize("@ss.hasPermi('app:article:export')")
|
||||||
@Log(title = "文章", businessType = BusinessType.EXPORT)
|
@Log(title = "文章", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, AppBlogArticle appBlogArticle)
|
public void export(HttpServletResponse response, AppBlogArticle appBlogArticle) {
|
||||||
{
|
|
||||||
List<AppBlogArticle> list = appBlogArticleService.selectAppBlogArticleList(appBlogArticle);
|
List<AppBlogArticle> list = appBlogArticleService.selectAppBlogArticleList(appBlogArticle);
|
||||||
ExcelUtil<AppBlogArticle> util = new ExcelUtil<AppBlogArticle>(AppBlogArticle.class);
|
ExcelUtil<AppBlogArticle> util = new ExcelUtil<AppBlogArticle>(AppBlogArticle.class);
|
||||||
util.exportExcel(response, list, "文章数据");
|
util.exportExcel(response, list, "文章数据");
|
||||||
@@ -62,14 +65,20 @@ public class AppBlogArticleController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('app:article:query')")
|
@PreAuthorize("@ss.hasPermi('app:article:query')")
|
||||||
@GetMapping(value = "/{id}")
|
@GetMapping(value = "/{id}")
|
||||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||||
{
|
|
||||||
return success(appBlogArticleService.selectAppBlogArticleById(id));
|
return success(appBlogArticleService.selectAppBlogArticleById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(value = "/app/{id}")
|
@GetMapping(value = "/app/{id}")
|
||||||
public AjaxResult appGetInfo(@PathVariable("id") Long id)
|
public AjaxResult appGetInfo(@PathVariable("id") Long id) {
|
||||||
{
|
AppBlogArticle appBlogArticle = appBlogArticleService.selectAppBlogArticleById(id);
|
||||||
return success(appBlogArticleService.selectAppBlogArticleById(id));
|
List<String> list = new ArrayList<>();
|
||||||
|
List<TtFile> picList = fileService.selectTtFileByCodeName(appBlogArticle.getTitle());
|
||||||
|
for (TtFile ttFile : picList) {
|
||||||
|
list.add(ttFile.getFileUrl());
|
||||||
|
}
|
||||||
|
appBlogArticle.setPicList(list);
|
||||||
|
return success(appBlogArticle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,8 +87,7 @@ public class AppBlogArticleController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('app:article:add')")
|
@PreAuthorize("@ss.hasPermi('app:article:add')")
|
||||||
@Log(title = "文章", businessType = BusinessType.INSERT)
|
@Log(title = "文章", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody AppBlogArticle appBlogArticle)
|
public AjaxResult add(@RequestBody AppBlogArticle appBlogArticle) {
|
||||||
{
|
|
||||||
return toAjax(appBlogArticleService.insertAppBlogArticle(appBlogArticle));
|
return toAjax(appBlogArticleService.insertAppBlogArticle(appBlogArticle));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,25 +97,24 @@ public class AppBlogArticleController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('app:article:edit')")
|
@PreAuthorize("@ss.hasPermi('app:article:edit')")
|
||||||
@Log(title = "文章", businessType = BusinessType.UPDATE)
|
@Log(title = "文章", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody AppBlogArticle appBlogArticle)
|
public AjaxResult edit(@RequestBody AppBlogArticle appBlogArticle) {
|
||||||
{
|
|
||||||
return toAjax(appBlogArticleService.updateAppBlogArticle(appBlogArticle));
|
return toAjax(appBlogArticleService.updateAppBlogArticle(appBlogArticle));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 点赞+1
|
* 点赞+1
|
||||||
*/
|
*/
|
||||||
@PutMapping("/app/zan")
|
@PutMapping("/app/zan")
|
||||||
public AjaxResult zan(@RequestBody AppBlogArticle appBlogArticle)
|
public AjaxResult zan(@RequestBody AppBlogArticle appBlogArticle) {
|
||||||
{
|
return toAjax(appBlogArticleMapper.zan(appBlogArticle.getId()));
|
||||||
return toAjax( appBlogArticleMapper.zan(appBlogArticle.getId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 游览+1
|
* 游览+1
|
||||||
*/
|
*/
|
||||||
@PutMapping("/app/lookAddNumber")
|
@PutMapping("/app/lookAddNumber")
|
||||||
public AjaxResult lookAddNumber(@RequestBody AppBlogArticle appBlogArticle)
|
public AjaxResult lookAddNumber(@RequestBody AppBlogArticle appBlogArticle) {
|
||||||
{
|
return toAjax(appBlogArticleMapper.lookAddNumber(appBlogArticle.getId()));
|
||||||
return toAjax( appBlogArticleMapper.lookAddNumber(appBlogArticle.getId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -115,9 +122,8 @@ public class AppBlogArticleController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('app:article:remove')")
|
@PreAuthorize("@ss.hasPermi('app: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(appBlogArticleService.deleteAppBlogArticleByIds(ids));
|
return toAjax(appBlogArticleService.deleteAppBlogArticleByIds(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,12 @@ public interface TtFileMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTtFileByFileIds(Long[] fileIds);
|
public int deleteTtFileByFileIds(Long[] fileIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 codeName 查询文件管理列表
|
||||||
|
*
|
||||||
|
* @param codeName codeName
|
||||||
|
* @return 文件管理集合
|
||||||
|
*/
|
||||||
|
public List<TtFile> selectTtFileByCodeName(String codeName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,12 @@ public interface ITtFileService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteTtFileByFileId(Long fileId);
|
public int deleteTtFileByFileId(Long fileId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 codeName 查询文件管理列表
|
||||||
|
*
|
||||||
|
* @param codeName codeName
|
||||||
|
* @return 文件管理集合
|
||||||
|
*/
|
||||||
|
public List<TtFile> selectTtFileByCodeName(String codeName);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -119,4 +119,15 @@ public class TtFileServiceImpl implements ITtFileService {
|
|||||||
return ttFileMapper.deleteTtFileByFileId(fileId);
|
return ttFileMapper.deleteTtFileByFileId(fileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 codeName 查询文件管理列表
|
||||||
|
*
|
||||||
|
* @param codeName codeName
|
||||||
|
* @return 文件管理集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<TtFile> selectTtFileByCodeName(String codeName) {
|
||||||
|
return ttFileMapper.selectTtFileByCodeName(codeName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||||||
import com.ruoyi.common.annotation.Excel;
|
import com.ruoyi.common.annotation.Excel;
|
||||||
import com.ruoyi.common.core.domain.BaseEntity;
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文章对象 app_blog_article
|
* 文章对象 app_blog_article
|
||||||
*
|
*
|
||||||
@@ -75,6 +77,8 @@ public class AppBlogArticle extends BaseEntity
|
|||||||
@Excel(name = "权重")
|
@Excel(name = "权重")
|
||||||
private Long weight;
|
private Long weight;
|
||||||
|
|
||||||
|
private List<String> picList;
|
||||||
|
|
||||||
public String getOrderType() {
|
public String getOrderType() {
|
||||||
return orderType;
|
return orderType;
|
||||||
}
|
}
|
||||||
@@ -217,6 +221,14 @@ public class AppBlogArticle extends BaseEntity
|
|||||||
return delFlag;
|
return delFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<String> getPicList() {
|
||||||
|
return picList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPicList(List<String> picList) {
|
||||||
|
this.picList = picList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
|||||||
Reference in New Issue
Block a user