feat: 图片、文件筛选
parent
f5f2693e8e
commit
e34ce61003
|
@ -62,6 +62,24 @@ public class PublishController {
|
||||||
return publishService.publish(publishRes);
|
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")
|
@PostMapping("list")
|
||||||
@ApiOperation(value = "获取问题列表")
|
@ApiOperation(value = "获取提问列表")
|
||||||
public TableDataInfo list(@RequestBody @Valid QuestionPageRes questionPageRes) {
|
public TableDataInfo list(@RequestBody @Valid QuestionPageRes questionPageRes) {
|
||||||
|
|
||||||
return questionService.list(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.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.mcwl.common.core.domain.BaseEntity;
|
import com.mcwl.common.core.domain.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@ -39,6 +40,16 @@ public class Publish extends BaseEntity {
|
||||||
*/
|
*/
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布图片
|
||||||
|
*/
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布文件
|
||||||
|
*/
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布人
|
* 发布人
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -32,6 +32,17 @@ public class PublishRes {
|
||||||
@NotBlank(message = "内容不能为空")
|
@NotBlank(message = "内容不能为空")
|
||||||
@ApiModelProperty(value = "内容", required = true)
|
@ApiModelProperty(value = "内容", required = true)
|
||||||
private String content;
|
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;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布、提问信息
|
* 发布信息
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ApiModel(description = "发布信息")
|
@ApiModel(description = "发布信息")
|
||||||
|
@ -56,6 +56,18 @@ public class PublishVo {
|
||||||
@ApiModelProperty(value = "内容")
|
@ApiModelProperty(value = "内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布图片
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "发布图片")
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布文件
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "发布文件")
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布时间 - 定时发布
|
* 发布时间 - 定时发布
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.mcwl.communityCenter.domain.vo;
|
package com.mcwl.communityCenter.domain.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
@ -8,64 +10,77 @@ import javax.validation.constraints.NotNull;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ApiModel(description = "问题信息")
|
||||||
public class QuestionVo {
|
public class QuestionVo {
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社区id
|
* 社区id
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "社区id")
|
||||||
private Long communityId;
|
private Long communityId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问用户id
|
* 提问用户id
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问用户id")
|
||||||
private Long questionUserId;
|
private Long questionUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问用户名
|
* 提问用户名
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问用户名")
|
||||||
private String questionUserName;
|
private String questionUserName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问用户头像
|
* 提问用户头像
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问用户头像")
|
||||||
private String questionUserAvatar;
|
private String questionUserAvatar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问内容
|
* 提问内容
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问内容")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问图片
|
* 提问图片
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问图片")
|
||||||
private String questionUrl;
|
private String questionUrl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提问时间
|
* 提问时间
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "提问时间")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 答复用户id
|
* 答复用户id
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "答复用户id")
|
||||||
private Long replyUserId;
|
private Long replyUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 回复内容
|
* 回复内容
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "回复内容")
|
||||||
private String reply;
|
private String reply;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 回复时间
|
* 回复时间
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "回复时间")
|
||||||
private Date replyTime;
|
private Date replyTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否匿名
|
* 是否匿名
|
||||||
*/
|
*/
|
||||||
|
@ApiModelProperty(value = "是否匿名")
|
||||||
private Integer isAnonymous;
|
private Integer isAnonymous;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.springframework.security.core.parameters.P;
|
import org.springframework.security.core.parameters.P;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface PublishMapper extends BaseMapper<Publish> {
|
public interface PublishMapper extends BaseMapper<Publish> {
|
||||||
|
|
||||||
|
@ -22,4 +24,19 @@ public interface PublishMapper extends BaseMapper<Publish> {
|
||||||
Long tenantId,
|
Long tenantId,
|
||||||
@Param("communityId")
|
@Param("communityId")
|
||||||
Long 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,
|
Long tenantId,
|
||||||
@Param("communityId")
|
@Param("communityId")
|
||||||
Long 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.dto.PublishRes;
|
||||||
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
import com.mcwl.communityCenter.domain.vo.PublishVo;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -25,4 +26,8 @@ public interface PublishService extends IService<Publish> {
|
||||||
AjaxResult publish(PublishRes publishRes);
|
AjaxResult publish(PublishRes publishRes);
|
||||||
|
|
||||||
TableDataInfo getPublishList(PublishPageRes publishPageRes);
|
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.dto.QuestionRes;
|
||||||
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
import com.mcwl.communityCenter.domain.vo.QuestionVo;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
public interface QuestionService extends IService<Question> {
|
public interface QuestionService extends IService<Question> {
|
||||||
|
@ -30,4 +31,6 @@ public interface QuestionService extends IService<Question> {
|
||||||
* @param questionReplyRes 回复信息
|
* @param questionReplyRes 回复信息
|
||||||
*/
|
*/
|
||||||
AjaxResult reply(QuestionReplyRes questionReplyRes);
|
AjaxResult reply(QuestionReplyRes questionReplyRes);
|
||||||
|
|
||||||
|
TableDataInfo listImage(@Valid QuestionPageRes questionPageRes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,15 +98,7 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
||||||
@Override
|
@Override
|
||||||
public TableDataInfo getPublishList(PublishPageRes publishPageRes) {
|
public TableDataInfo getPublishList(PublishPageRes publishPageRes) {
|
||||||
|
|
||||||
Page<Publish> page = new Page<>(publishPageRes.getPageNum(), publishPageRes.getPageSize());
|
Page<Publish> page = this.initPage(publishPageRes);
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
// 根据租户id和社区id查询分页数据
|
// 根据租户id和社区id查询分页数据
|
||||||
baseMapper.selectByTenantIdAndCommunityIdPage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
|
baseMapper.selectByTenantIdAndCommunityIdPage(page, publishPageRes.getTenantId(), publishPageRes.getCommunityId());
|
||||||
|
@ -133,4 +125,77 @@ public class PublishServiceImpl extends ServiceImpl<PublishMapper, Publish> impl
|
||||||
tableDataInfo.setMsg("查询成功");
|
tableDataInfo.setMsg("查询成功");
|
||||||
return tableDataInfo;
|
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
|
@Override
|
||||||
public TableDataInfo list(QuestionPageRes questionPageRes) {
|
public TableDataInfo list(QuestionPageRes questionPageRes) {
|
||||||
|
|
||||||
Page<Question> page = new Page<>(questionPageRes.getPageNum(), questionPageRes.getPageSize());
|
Page<Question> page = initPage(questionPageRes);
|
||||||
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);
|
|
||||||
|
|
||||||
baseMapper.list(page, questionPageRes.getTenantId(), questionPageRes.getCommunityId(), questionPageRes.getStatus());
|
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">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.mcwl.communityCenter.mapper.PublishMapper">
|
<mapper namespace="com.mcwl.communityCenter.mapper.PublishMapper">
|
||||||
<select id="selectByTenantIdAndCommunityIdPage" resultType="com.mcwl.communityCenter.domain.Publish">
|
<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
|
from cc_publish
|
||||||
where tenant_id = #{tenantId}
|
where tenant_id = #{tenantId}
|
||||||
and community_id = #{communityId}
|
and community_id = #{communityId}
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByIdAndTenantIdAndCommunityId" resultType="com.mcwl.communityCenter.domain.Publish">
|
<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
|
from cc_publish
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
and tenant_id = #{tenantId}
|
and tenant_id = #{tenantId}
|
||||||
and community_id = #{communityId}
|
and community_id = #{communityId}
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
</select>
|
</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>
|
</mapper>
|
|
@ -23,4 +23,15 @@
|
||||||
and community_id = #{communityId}
|
and community_id = #{communityId}
|
||||||
and del_flag = '0'
|
and del_flag = '0'
|
||||||
</select>
|
</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>
|
</mapper>
|
Loading…
Reference in New Issue