Merge branch 'feature/community-center' into preview
commit
f77029ead8
|
@ -62,6 +62,24 @@ public class PublishController {
|
|||
return publishService.publish(publishRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发布图片列表
|
||||
*/
|
||||
@ApiOperation(value = "获取发布图片列表")
|
||||
@PostMapping("publishImage")
|
||||
public TableDataInfo publishImage(@RequestBody @Valid PublishPageRes publishPageRes) {
|
||||
return publishService.publishImage(publishPageRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发布文件列表
|
||||
*/
|
||||
@ApiOperation(value = "获取发布文件列表")
|
||||
@PostMapping("publishFile")
|
||||
public TableDataInfo publishFile(@RequestBody @Valid PublishPageRes publishPageRes) {
|
||||
return publishService.publishFile(publishPageRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
|
|
|
@ -44,15 +44,25 @@ public class QuestionController {
|
|||
|
||||
|
||||
/**
|
||||
* 获取问题列表
|
||||
* 获取提问列表
|
||||
*/
|
||||
@PostMapping("list")
|
||||
@ApiOperation(value = "获取问题列表")
|
||||
@ApiOperation(value = "获取提问列表")
|
||||
public TableDataInfo list(@RequestBody @Valid QuestionPageRes questionPageRes) {
|
||||
|
||||
return questionService.list(questionPageRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取提问图片列表
|
||||
*/
|
||||
@PostMapping("listImage")
|
||||
@ApiOperation(value = "获取提问图片列表")
|
||||
public TableDataInfo listImage(@RequestBody @Valid QuestionPageRes questionPageRes) {
|
||||
|
||||
return questionService.listImage(questionPageRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取问题详情
|
||||
*/
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.mcwl.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
@ -39,6 +40,16 @@ public class Publish extends BaseEntity {
|
|||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 发布图片
|
||||
*/
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 发布文件
|
||||
*/
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 发布人
|
||||
*/
|
||||
|
|
|
@ -32,6 +32,17 @@ public class PublishRes {
|
|||
@NotBlank(message = "内容不能为空")
|
||||
@ApiModelProperty(value = "内容", required = true)
|
||||
private String content;
|
||||
/**
|
||||
* 发布图片
|
||||
*/
|
||||
@ApiModelProperty(value = "发布图片")
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 发布文件
|
||||
*/
|
||||
@ApiModelProperty(value = "发布文件")
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 发布时间 - 定时发布
|
||||
|
|
|
@ -8,7 +8,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 发布、提问信息
|
||||
* 发布信息
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(description = "发布信息")
|
||||
|
@ -56,6 +56,18 @@ public class PublishVo {
|
|||
@ApiModelProperty(value = "内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 发布图片
|
||||
*/
|
||||
@ApiModelProperty(value = "发布图片")
|
||||
private String imageUrl;
|
||||
|
||||
/**
|
||||
* 发布文件
|
||||
*/
|
||||
@ApiModelProperty(value = "发布文件")
|
||||
private String fileUrl;
|
||||
|
||||
/**
|
||||
* 发布时间 - 定时发布
|
||||
*/
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.mcwl.communityCenter.domain.vo;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
@ -8,64 +10,77 @@ import javax.validation.constraints.NotNull;
|
|||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@ApiModel(description = "问题信息")
|
||||
public class QuestionVo {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 社区id
|
||||
*/
|
||||
@ApiModelProperty(value = "社区id")
|
||||
private Long communityId;
|
||||
|
||||
/**
|
||||
* 提问用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "提问用户id")
|
||||
private Long questionUserId;
|
||||
|
||||
/**
|
||||
* 提问用户名
|
||||
*/
|
||||
@ApiModelProperty(value = "提问用户名")
|
||||
private String questionUserName;
|
||||
|
||||
/**
|
||||
* 提问用户头像
|
||||
*/
|
||||
@ApiModelProperty(value = "提问用户头像")
|
||||
private String questionUserAvatar;
|
||||
|
||||
/**
|
||||
* 提问内容
|
||||
*/
|
||||
@ApiModelProperty(value = "提问内容")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 提问图片
|
||||
*/
|
||||
@ApiModelProperty(value = "提问图片")
|
||||
private String questionUrl;
|
||||
|
||||
/**
|
||||
* 提问时间
|
||||
*/
|
||||
@ApiModelProperty(value = "提问时间")
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 答复用户id
|
||||
*/
|
||||
@ApiModelProperty(value = "答复用户id")
|
||||
private Long replyUserId;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
@ApiModelProperty(value = "回复内容")
|
||||
private String reply;
|
||||
|
||||
/**
|
||||
* 回复时间
|
||||
*/
|
||||
@ApiModelProperty(value = "回复时间")
|
||||
private Date replyTime;
|
||||
|
||||
/**
|
||||
* 是否匿名
|
||||
*/
|
||||
@ApiModelProperty(value = "是否匿名")
|
||||
private Integer isAnonymous;
|
||||
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.security.core.parameters.P;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Mapper
|
||||
public interface PublishMapper extends BaseMapper<Publish> {
|
||||
|
||||
|
@ -22,4 +24,19 @@ public interface PublishMapper extends BaseMapper<Publish> {
|
|||
Long tenantId,
|
||||
@Param("communityId")
|
||||
Long communityId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
Page<Publish> selectByTenantIdAndCommunityIdAndNotNullImagePage(Page<Publish> page,
|
||||
@Param("tenantId")
|
||||
Long tenantId,
|
||||
@Param("communityId")
|
||||
Long communityId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
Page<Publish> selectByTenantIdAndCommunityIdAndNotNullFilePage(Page<Publish> page,
|
||||
@Param("tenantId")
|
||||
Long tenantId,
|
||||
@Param("communityId")
|
||||
Long communityId);
|
||||
|
||||
}
|
||||
|
|
|
@ -30,4 +30,15 @@ public interface QuestionMapper extends BaseMapper<Question> {
|
|||
Long tenantId,
|
||||
@Param("communityId")
|
||||
Long communityId);
|
||||
|
||||
@InterceptorIgnore(tenantLine = "true")
|
||||
Page<Question> listImage(Page<Question> page,
|
||||
@NotNull(message = "租户不能为空")
|
||||
@Param("tenantId")
|
||||
Long tenantId,
|
||||
@NotNull(message = "社区不能为空")
|
||||
@Param("communityId")
|
||||
Long communityId,
|
||||
@Param("status")
|
||||
Integer status);
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.mcwl.communityCenter.domain.dto.PublishPageRes;
|
|||
import com.mcwl.communityCenter.domain.dto.PublishRes;
|
||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -25,4 +26,8 @@ public interface PublishService extends IService<Publish> {
|
|||
AjaxResult publish(PublishRes publishRes);
|
||||
|
||||
TableDataInfo getPublishList(PublishPageRes publishPageRes);
|
||||
|
||||
TableDataInfo publishImage(@Valid PublishPageRes publishPageRes);
|
||||
|
||||
TableDataInfo publishFile(@Valid PublishPageRes publishPageRes);
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import com.mcwl.communityCenter.domain.dto.QuestionReplyRes;
|
|||
import com.mcwl.communityCenter.domain.dto.QuestionRes;
|
||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
public interface QuestionService extends IService<Question> {
|
||||
|
@ -30,4 +31,6 @@ public interface QuestionService extends IService<Question> {
|
|||
* @param questionReplyRes 回复信息
|
||||
*/
|
||||
AjaxResult reply(QuestionReplyRes questionReplyRes);
|
||||
|
||||
TableDataInfo listImage(@Valid QuestionPageRes questionPageRes);
|
||||
}
|
||||
|
|
|
@ -98,15 +98,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
@Override
|
||||
public TableDataInfo getPublishList(PublishPageRes publishPageRes) {
|
||||
|
||||
Page<Publish> page = new Page<>(publishPageRes.getPageNum(), publishPageRes.getPageSize());
|
||||
|
||||
if (StringUtils.isBlank(publishPageRes.getOrderByColumn())) {
|
||||
publishPageRes.setOrderByColumn("create_time");
|
||||
}
|
||||
boolean isAsc = Objects.equals(publishPageRes.getIsAsc(), "asc");
|
||||
OrderItem orderItem = new OrderItem(publishPageRes.getOrderByColumn(), isAsc);
|
||||
|
||||
page.addOrder(orderItem);
|
||||
Page<Publish> page = this.initPage(publishPageRes);
|
||||
|
||||
// 根据租户id和社区id查询分页数据
|
||||
baseMapper.selectByTenantIdAndCommunityIdPage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
|
||||
|
@ -133,4 +125,77 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
|||
tableDataInfo.setMsg("查询成功");
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo publishImage(PublishPageRes publishPageRes) {
|
||||
|
||||
Page<Publish> page = this.initPage(publishPageRes);
|
||||
|
||||
// 根据租户id和社区id和fileUrl不为空查询分页数据
|
||||
baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
|
||||
|
||||
List<Publish> publishList = page.getRecords();
|
||||
List<PublishVo> publishVoList = new ArrayList<>();
|
||||
for (Publish publish : publishList) {
|
||||
PublishVo publishVo = new PublishVo();
|
||||
BeanUtil.copyProperties(publish, publishVo);
|
||||
Long userId = publish.getUserId();
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
publishVo.setUserName(sysUser.getUserName());
|
||||
publishVo.setAvatar(sysUser.getAvatar());
|
||||
publishVoList.add(publishVo);
|
||||
}
|
||||
|
||||
|
||||
// 封装返回
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setRows(publishVoList);
|
||||
tableDataInfo.setTotal(page.getTotal());
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo publishFile(PublishPageRes publishPageRes) {
|
||||
Page<Publish> page = this.initPage(publishPageRes);
|
||||
|
||||
// 根据租户id和社区id和imageUrl不为空查询分页数据
|
||||
baseMapper.selectByTenantIdAndCommunityIdAndNotNullFilePage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
|
||||
|
||||
List<Publish> publishList = page.getRecords();
|
||||
List<PublishVo> publishVoList = new ArrayList<>();
|
||||
for (Publish publish : publishList) {
|
||||
PublishVo publishVo = new PublishVo();
|
||||
BeanUtil.copyProperties(publish, publishVo);
|
||||
Long userId = publish.getUserId();
|
||||
SysUser sysUser = sysUserService.selectUserById(userId);
|
||||
publishVo.setUserName(sysUser.getUserName());
|
||||
publishVo.setAvatar(sysUser.getAvatar());
|
||||
publishVoList.add(publishVo);
|
||||
}
|
||||
|
||||
|
||||
// 封装返回
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setRows(publishVoList);
|
||||
tableDataInfo.setTotal(page.getTotal());
|
||||
tableDataInfo.setCode(HttpStatus.SUCCESS);
|
||||
tableDataInfo.setMsg("查询成功");
|
||||
return tableDataInfo;
|
||||
}
|
||||
|
||||
private Page<Publish> initPage(PublishPageRes publishPageRes) {
|
||||
Page<Publish> page = new Page<>(publishPageRes.getPageNum(), publishPageRes.getPageSize());
|
||||
|
||||
if (StringUtils.isBlank(publishPageRes.getOrderByColumn())) {
|
||||
publishPageRes.setOrderByColumn("create_time");
|
||||
}
|
||||
boolean isAsc = Objects.equals(publishPageRes.getIsAsc(), "asc");
|
||||
OrderItem orderItem = new OrderItem(publishPageRes.getOrderByColumn(), isAsc);
|
||||
|
||||
page.addOrder(orderItem);
|
||||
|
||||
return page;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,14 +103,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|||
@Override
|
||||
public TableDataInfo list(QuestionPageRes questionPageRes) {
|
||||
|
||||
Page<Question> page = new Page<>(questionPageRes.getPageNum(), questionPageRes.getPageSize());
|
||||
OrderItem orderItem = new OrderItem();
|
||||
if (StringUtils.isBlank(questionPageRes.getOrderByColumn())) {
|
||||
questionPageRes.setOrderByColumn("create_time");
|
||||
}
|
||||
orderItem.setColumn(questionPageRes.getOrderByColumn());
|
||||
orderItem.setAsc(Objects.equals(questionPageRes.getIsAsc(), "asc"));
|
||||
page.addOrder(orderItem);
|
||||
Page<Question> page = initPage(questionPageRes);
|
||||
|
||||
baseMapper.list(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
|
||||
|
||||
|
@ -191,5 +184,49 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo listImage(QuestionPageRes questionPageRes) {
|
||||
|
||||
Page<Question> page = initPage(questionPageRes);
|
||||
|
||||
baseMapper.listImage(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
|
||||
|
||||
// 获取分页数据
|
||||
List<Question> questionList = page.getRecords();
|
||||
// Question数据转为QuestionVo
|
||||
List<QuestionVo> questionVoList = new ArrayList<>();
|
||||
for (Question question : questionList) {
|
||||
QuestionVo questionVo = new QuestionVo();
|
||||
BeanUtil.copyProperties(question, questionVo);
|
||||
Long questionUserId = question.getQuestionUserId();
|
||||
SysUser sysUser = sysUserService.selectUserById(questionUserId);
|
||||
questionVo.setQuestionUserName(sysUser.getUserName());
|
||||
questionVo.setQuestionUserAvatar(sysUser.getAvatar());
|
||||
questionVoList.add(questionVo);
|
||||
|
||||
}
|
||||
|
||||
// 封装分页信息
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(HttpStatus.SUCCESS);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(questionVoList);
|
||||
rspData.setTotal(page.getTotal());
|
||||
|
||||
return rspData;
|
||||
}
|
||||
|
||||
private Page<Question> initPage(QuestionPageRes questionPageRes) {
|
||||
Page<Question> page = new Page<>(questionPageRes.getPageNum(), questionPageRes.getPageSize());
|
||||
OrderItem orderItem = new OrderItem();
|
||||
if (StringUtils.isBlank(questionPageRes.getOrderByColumn())) {
|
||||
questionPageRes.setOrderByColumn("create_time");
|
||||
}
|
||||
orderItem.setColumn(questionPageRes.getOrderByColumn());
|
||||
orderItem.setAsc(Objects.equals(questionPageRes.getIsAsc(), "asc"));
|
||||
page.addOrder(orderItem);
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,18 +4,84 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mcwl.communityCenter.mapper.PublishMapper">
|
||||
<select id="selectByTenantIdAndCommunityIdPage" resultType="com.mcwl.communityCenter.domain.Publish">
|
||||
select id, tenant_id, community_id, user_id, content, publish_time, like_num, comment_num, status, create_by, create_time
|
||||
select id,
|
||||
tenant_id,
|
||||
community_id,
|
||||
user_id,
|
||||
content,
|
||||
image_url,
|
||||
file_url,
|
||||
publish_time,
|
||||
like_num,
|
||||
comment_num,
|
||||
status,
|
||||
create_by,
|
||||
create_time
|
||||
from cc_publish
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
<select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Publish">
|
||||
select id, tenant_id, community_id, user_id, content, publish_time, like_num, comment_num, status, create_by, create_time
|
||||
select id,
|
||||
tenant_id,
|
||||
community_id,
|
||||
user_id,
|
||||
content,
|
||||
image_url,
|
||||
file_url,
|
||||
publish_time,
|
||||
like_num,
|
||||
comment_num,
|
||||
status,
|
||||
create_by,
|
||||
create_time
|
||||
from cc_publish
|
||||
where id = #{id}
|
||||
and tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
<select id="selectByTenantIdAndCommunityIdAndNotNullImagePage"
|
||||
resultType="com.mcwl.communityCenter.domain.Publish">
|
||||
select id,
|
||||
tenant_id,
|
||||
community_id,
|
||||
user_id,
|
||||
content,
|
||||
image_url,
|
||||
file_url,
|
||||
publish_time,
|
||||
like_num,
|
||||
comment_num,
|
||||
status,
|
||||
create_by,
|
||||
create_time
|
||||
from cc_publish
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and del_flag = '0'
|
||||
and image_url is not null
|
||||
</select>
|
||||
<select id="selectByTenantIdAndCommunityIdAndNotNullFilePage"
|
||||
resultType="com.mcwl.communityCenter.domain.Publish">
|
||||
select id,
|
||||
tenant_id,
|
||||
community_id,
|
||||
user_id,
|
||||
content,
|
||||
image_url,
|
||||
file_url,
|
||||
publish_time,
|
||||
like_num,
|
||||
comment_num,
|
||||
status,
|
||||
create_by,
|
||||
create_time
|
||||
from cc_publish
|
||||
where tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
and del_flag = '0'
|
||||
and file_url is not null
|
||||
</select>
|
||||
</mapper>
|
|
@ -23,4 +23,15 @@
|
|||
and community_id = #{communityId}
|
||||
and del_flag = '0'
|
||||
</select>
|
||||
<select id="listImage" resultType="com.mcwl.communityCenter.domain.Question">
|
||||
select id, tenant_id, community_id, question_user_id, content,question_url, reply,reply_time,is_anonymous,status
|
||||
from cc_question
|
||||
where del_flag = '0'
|
||||
and tenant_id = #{tenantId}
|
||||
and community_id = #{communityId}
|
||||
<if test="status != null">
|
||||
and status= #{status}
|
||||
</if>
|
||||
and question_url is not null
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue