|
@@ -2,14 +2,21 @@ package com.ruoyi.web.controller.api;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
+import com.ruoyi.app.domain.TbAppUser;
|
|
|
import com.ruoyi.app.domain.TbMyPublish;
|
|
|
+import com.ruoyi.app.domain.TbPublishComment;
|
|
|
+import com.ruoyi.app.domain.TbPublishImg;
|
|
|
+import com.ruoyi.app.service.ITbAppUserService;
|
|
|
+import com.ruoyi.app.service.ITbPublishImgService;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.aspectj.weaver.loadtime.Aj;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -42,10 +49,15 @@ public class TbMyPublishController extends BaseController {
|
|
|
|
|
|
private final ITbMyPublishService iTbMyPublishService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ITbPublishImgService publishImgService;
|
|
|
+ @Autowired
|
|
|
+ private ITbAppUserService appUserService;
|
|
|
+
|
|
|
/**
|
|
|
- * 查询我的近况(我的发)列表
|
|
|
+ * 查询我的近况 列表
|
|
|
*/
|
|
|
- @ApiOperation("查询我的近况(我的发)列表")
|
|
|
+ @ApiOperation("查询我的发表列表")
|
|
|
@PreAuthorize("@ss.hasPermi('app:publish:list')")
|
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(TbMyPublish tbMyPublish)
|
|
@@ -56,52 +68,19 @@ public class TbMyPublishController extends BaseController {
|
|
|
lqw.eq(TbMyPublish::getAppUserId ,tbMyPublish.getAppUserId());
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(tbMyPublish.getContents())){
|
|
|
- lqw.eq(TbMyPublish::getContents ,tbMyPublish.getContents());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl1())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl1 ,tbMyPublish.getPicurl1());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl2())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl2 ,tbMyPublish.getPicurl2());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl3())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl3 ,tbMyPublish.getPicurl3());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl4())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl4 ,tbMyPublish.getPicurl4());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl5())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl5 ,tbMyPublish.getPicurl5());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl6())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl6 ,tbMyPublish.getPicurl6());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl7())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl7 ,tbMyPublish.getPicurl7());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl8())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl8 ,tbMyPublish.getPicurl8());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(tbMyPublish.getPicurl9())){
|
|
|
- lqw.eq(TbMyPublish::getPicurl9 ,tbMyPublish.getPicurl9());
|
|
|
+ lqw.like(TbMyPublish::getContents ,tbMyPublish.getContents());
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(tbMyPublish.getMessage())){
|
|
|
lqw.eq(TbMyPublish::getMessage ,tbMyPublish.getMessage());
|
|
|
}
|
|
|
- if (tbMyPublish.getMessageUserId() != null){
|
|
|
- lqw.eq(TbMyPublish::getMessageUserId ,tbMyPublish.getMessageUserId());
|
|
|
- }
|
|
|
- if (tbMyPublish.getThumbs() != null){
|
|
|
- lqw.eq(TbMyPublish::getThumbs ,tbMyPublish.getThumbs());
|
|
|
- }
|
|
|
List<TbMyPublish> list = iTbMyPublishService.list(lqw);
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 导出我的近况(我的发)列表
|
|
|
+ * 导出我的近况 列表
|
|
|
*/
|
|
|
- @ApiOperation("导出我的近况(我的发)列表")
|
|
|
+ @ApiOperation("导出我的近况 列表")
|
|
|
@PreAuthorize("@ss.hasPermi('app:publish:export')" )
|
|
|
@Log(title = "我的近况(我的发)" , businessType = BusinessType.EXPORT)
|
|
|
@GetMapping("/export" )
|
|
@@ -113,19 +92,34 @@ public class TbMyPublishController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取我的近况(我的发)详细信息
|
|
|
+ * 获取我的近况详细信息
|
|
|
*/
|
|
|
- @ApiOperation("获取我的近况(我的发)详细信息")
|
|
|
+ @ApiOperation("获取我的近况 详细信息")
|
|
|
@PreAuthorize("@ss.hasPermi('app:publish:query')" )
|
|
|
@GetMapping(value = "/{id}" )
|
|
|
public AjaxResult getInfo(@PathVariable("id" ) Long id) {
|
|
|
- return AjaxResult.success(iTbMyPublishService.getById(id));
|
|
|
+ TbMyPublish publish = iTbMyPublishService.getById(id);
|
|
|
+ if (publish != null) {
|
|
|
+ List<TbPublishImg> publishImgs = publishImgService.list(new LambdaQueryWrapper<TbPublishImg>()
|
|
|
+ .in(TbPublishImg::getPublishId, id)
|
|
|
+ );
|
|
|
+ int thumbs = iTbMyPublishService.getThumbs(id);
|
|
|
+ int comments = iTbMyPublishService.getComments(id);
|
|
|
+ if (publish.getMessageUserId() != null) {
|
|
|
+ TbAppUser user = appUserService.getById(publish.getMessageUserId());
|
|
|
+ publish.setMessageUser(user.getNickName());
|
|
|
+ }
|
|
|
+ publish.setImgList(publishImgs);
|
|
|
+ publish.setThumbs(thumbs);
|
|
|
+ publish.setComments(comments);
|
|
|
+ }
|
|
|
+ return AjaxResult.success(publish);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 新增我的近况(我的发)
|
|
|
+ * 新增我的近况
|
|
|
*/
|
|
|
- @ApiOperation("新增我的近况(我的发)")
|
|
|
+ @ApiOperation("新增我的近况 ")
|
|
|
@PreAuthorize("@ss.hasPermi('app:publish:add')" )
|
|
|
@Log(title = "我的近况(我的发)" , businessType = BusinessType.INSERT)
|
|
|
@PostMapping
|
|
@@ -134,9 +128,9 @@ public class TbMyPublishController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 修改我的近况(我的发)
|
|
|
+ * 修改我的近况
|
|
|
*/
|
|
|
- @ApiOperation("修改我的近况(我的发)")
|
|
|
+ @ApiOperation("修改我的近况 ")
|
|
|
@PreAuthorize("@ss.hasPermi('app:publish:edit')" )
|
|
|
@Log(title = "我的近况(我的发)" , businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
@@ -147,11 +141,35 @@ public class TbMyPublishController extends BaseController {
|
|
|
/**
|
|
|
* 删除我的近况(我的发)
|
|
|
*/
|
|
|
- @ApiOperation("删除我的近况(我的发)")
|
|
|
+ @ApiOperation("删除我的近况 ")
|
|
|
@PreAuthorize("@ss.hasPermi('app:publish:remove')" )
|
|
|
@Log(title = "我的近况(我的发)" , businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}" )
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
return toAjax(iTbMyPublishService.removeByIds(Arrays.asList(ids)) ? 1 : 0);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取我的近况 评论列表
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation("获取我的近况 评论列表")
|
|
|
+ @GetMapping(value = "/listComment/{id}" )
|
|
|
+ public TableDataInfo listComment(@PathVariable("id" ) Long id) {
|
|
|
+ startPage();
|
|
|
+ List<TbPublishComment> list = iTbMyPublishService.listComment(id);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("删除一条评论")
|
|
|
+ @GetMapping(value = "/delComment/{id}" )
|
|
|
+ public AjaxResult delComment(@PathVariable("id" ) Long id) {
|
|
|
+ if (iTbMyPublishService.delComment(id)) {
|
|
|
+ return AjaxResult.success("删除成功");
|
|
|
+ }
|
|
|
+ return AjaxResult.error("删除失败");
|
|
|
+ }
|
|
|
}
|