Browse Source
# Conflicts: # epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RoleDao.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/RoleService.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RoleServiceImpl.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java # epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.javamaster
63 changed files with 2713 additions and 506 deletions
@ -0,0 +1,65 @@ |
|||
package com.epmet.resi.group.constant; |
|||
|
|||
/** |
|||
* @Description |
|||
* @IntefaceName TopicConstant |
|||
* @Author wangc |
|||
* @date 2020.03.31 17:18 |
|||
*/ |
|||
public interface TopicConstant { |
|||
|
|||
/** |
|||
* 话题最大字数 |
|||
* */ |
|||
int MAX_NUMBER_OF_CONTENT = 3000; |
|||
|
|||
/** |
|||
* 评论最大字数 |
|||
* */ |
|||
int MAX_NUMBER_OF_COMMENT = 300; |
|||
|
|||
/** |
|||
* 发布话题 |
|||
* */ |
|||
String PUBLISHMENT = "discussing"; |
|||
|
|||
/** |
|||
* 取消屏蔽 |
|||
* */ |
|||
String CANCEL_HIDDEN = "hidden_cancelled"; |
|||
|
|||
/** |
|||
* 关闭话题 |
|||
* */ |
|||
String CLOSED = "closed"; |
|||
|
|||
/** |
|||
* 屏蔽话题 |
|||
* */ |
|||
String HIDDEN = "hidden"; |
|||
|
|||
/** |
|||
* 本人发布 |
|||
* */ |
|||
String PUBLISHED_BY_MYSELF = "me"; |
|||
|
|||
/** |
|||
* 他人发布 |
|||
* */ |
|||
String PUBLISHED_BY_OTHER = "other"; |
|||
|
|||
/** |
|||
* 构造queryWrapper 话题Id列名 |
|||
* */ |
|||
String TOPIC_ID = "TOPIC_ID"; |
|||
|
|||
/** |
|||
* 构造queryWrapper 创建日期列名 |
|||
* */ |
|||
String CREATED_DATE = "CREATED_DATE"; |
|||
|
|||
/** |
|||
* 构造queryWrapper 逻辑删除标识列名 |
|||
* */ |
|||
String DEL_FLAG = "DEL_FLAG"; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.epmet.resi.group.dto.comment.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiQueryCommentFormDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 17:14 |
|||
*/ |
|||
@Data |
|||
public class ResiQueryCommentFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 组Id |
|||
* */ |
|||
@NotBlank(message = "话题Id不能为空") |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 请求页码 |
|||
* */ |
|||
@Min(1) |
|||
private int pageNo; |
|||
|
|||
/** |
|||
* 每页多少条数据 |
|||
* */ |
|||
private int pageSize = 20; |
|||
} |
@ -0,0 +1,52 @@ |
|||
package com.epmet.resi.group.dto.comment.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiCommentResultDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 17:07 |
|||
*/ |
|||
@Data |
|||
public class ResiCommentResultDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 评论Id |
|||
* */ |
|||
private String commentId; |
|||
|
|||
/** |
|||
* 评论内容 |
|||
* */ |
|||
private String commentContent; |
|||
|
|||
/** |
|||
* 评论者头像 |
|||
* */ |
|||
private String commentUserHeadPhoto; |
|||
|
|||
/** |
|||
* 评论者姓名 |
|||
* */ |
|||
private String commentUserName; |
|||
|
|||
/** |
|||
* 用户Id 评论者Id |
|||
* */ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 评论时间 yyyy-MM-dd HH:mm:ss |
|||
* */ |
|||
private String commentTime; |
|||
|
|||
/** |
|||
* 评论状态 |
|||
* */ |
|||
private String commentStatus; |
|||
} |
@ -0,0 +1,96 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.resi.group.dto.topic; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
import lombok.Data; |
|||
|
|||
|
|||
/** |
|||
* 话题附件表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
@Data |
|||
public class ResiTopicAttachmentDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 话题Id,关联resi_topic的id |
|||
*/ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 附件名(uuid随机生成) |
|||
*/ |
|||
private String attachmentName; |
|||
|
|||
/** |
|||
* 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) |
|||
*/ |
|||
private String attachmentFormat; |
|||
|
|||
/** |
|||
* 附件类型((图片 - figure、 视频 - video、 语音 - voice、 文档 - doc)) |
|||
*/ |
|||
private String attachmentType; |
|||
|
|||
/** |
|||
* 附件地址 |
|||
*/ |
|||
private String attachmentUrl; |
|||
|
|||
/** |
|||
* 删除标记 0:未删除,1:已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.epmet.resi.group.dto.topic.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiPublishCommentFormDTO |
|||
* @Author wangc |
|||
* @date 2020.03.31 17:32 |
|||
*/ |
|||
@Data |
|||
public class ResiPublishCommentFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@NotBlank(message = "话题Id不能为空") |
|||
private String topicId; |
|||
|
|||
@NotBlank(message = "评论内容不能为空") |
|||
private String commentContent; |
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.resi.group.dto.topic.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiTopicOperationFormDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 15:32 |
|||
*/ |
|||
@Data |
|||
public class ResiTopicOperationFormDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 话题Id |
|||
*/ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 屏蔽原因 |
|||
*/ |
|||
private String operateReason; |
|||
|
|||
|
|||
|
|||
} |
@ -0,0 +1,46 @@ |
|||
package com.epmet.resi.group.dto.topic.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.Min; |
|||
import javax.validation.constraints.NotBlank; |
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiTopicPageFormDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 10:09 |
|||
*/ |
|||
@Data |
|||
public class ResiTopicPageFormDTO implements Serializable{ |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 组Id |
|||
* */ |
|||
@NotBlank(message = "组Id不能为空") |
|||
private String groupId; |
|||
|
|||
/** |
|||
* 请求页码 |
|||
* */ |
|||
@Min(value = 1) |
|||
private int pageNo; |
|||
|
|||
/** |
|||
* 每页多少条数据 |
|||
* */ |
|||
private int pageSize = 20; |
|||
|
|||
/** |
|||
* 搜索时可以带状态的查询,也可以不带 |
|||
* */ |
|||
private String status; |
|||
|
|||
/** |
|||
* 用户Id |
|||
* */ |
|||
private String userId; |
|||
} |
@ -0,0 +1,49 @@ |
|||
package com.epmet.resi.group.dto.topic.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiTopicDetailResultDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 16:03 |
|||
*/ |
|||
@Data |
|||
public class ResiTopicDetailResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 话题Id |
|||
* */ |
|||
private String topicId; |
|||
|
|||
|
|||
/** |
|||
* 发布人名称 |
|||
* */ |
|||
private String releaseUserName; |
|||
|
|||
/** |
|||
* 发布人头像 |
|||
* */ |
|||
private String releaseUserHeadPhoto; |
|||
|
|||
/** |
|||
* 发布时间 yyyy-MM-dd HH:mm:ss |
|||
* */ |
|||
private String releaseTime; |
|||
|
|||
/** |
|||
* 话题内容 |
|||
* */ |
|||
private String topicContent; |
|||
|
|||
/** |
|||
* 图片访问地址 |
|||
* */ |
|||
private List<String> topicImgs; |
|||
|
|||
} |
@ -0,0 +1,67 @@ |
|||
package com.epmet.resi.group.dto.topic.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 查看历史话题返回对象 |
|||
* @ClassName ResiTopicInfoResultDTO |
|||
* @Author wangc |
|||
* @date 2020.04.01 08:46 |
|||
*/ |
|||
@Data |
|||
public class ResiTopicInfoResultDTO implements Serializable{ |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 话题Id |
|||
* */ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 用户Id 话题发布人 |
|||
* */ |
|||
private String userId; |
|||
|
|||
/** |
|||
* 发布人名称 |
|||
* */ |
|||
private String releaseUserName; |
|||
|
|||
/** |
|||
* 发布人头像 |
|||
* */ |
|||
private String releaseUserHeadPhoto; |
|||
|
|||
/** |
|||
* 发布时间 yyyy-MM-dd HH:mm:ss |
|||
* */ |
|||
private String releaseTime; |
|||
|
|||
/** |
|||
* 话题内容 |
|||
* */ |
|||
private String topicContent; |
|||
|
|||
/** |
|||
* 话题状态 讨论中 已关闭 |
|||
* */ |
|||
private String status; |
|||
|
|||
/** |
|||
* 网格名称 |
|||
* */ |
|||
private String gridName; |
|||
|
|||
/** |
|||
* 是否本人 me other |
|||
* */ |
|||
private String releaseUserFlag; |
|||
|
|||
/** |
|||
* 第一张图片 |
|||
* */ |
|||
private String firstPhoto; |
|||
} |
@ -0,0 +1,57 @@ |
|||
package com.epmet.modules.comment.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.modules.topic.service.ResiTopicCommentService; |
|||
import com.epmet.resi.group.dto.comment.form.ResiQueryCommentFormDTO; |
|||
import com.epmet.resi.group.dto.comment.result.ResiCommentResultDTO; |
|||
import com.epmet.resi.group.dto.topic.form.ResiPublishCommentFormDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiCommentController |
|||
* @Author wangc |
|||
* @date 2020.04.01 18:00 |
|||
*/ |
|||
@RequestMapping("comment") |
|||
@RestController |
|||
public class ResiCommentController { |
|||
|
|||
@Autowired |
|||
private ResiTopicCommentService commentService; |
|||
|
|||
/** |
|||
* @Description 对话题发表评论 |
|||
* @Param tokenDto |
|||
* @Param ResiPublishCommentFormDTO |
|||
* @return Result |
|||
* @Author wangc |
|||
* @Date 2020.04.01 18:06 |
|||
**/ |
|||
@RequestMapping("commenttopic") |
|||
public Result commentTopic(@LoginUser TokenDto tokenDto, ResiPublishCommentFormDTO publishCommentFormDTO){ |
|||
ValidatorUtils.validateEntity(publishCommentFormDTO); |
|||
return commentService.commentTopic(tokenDto,publishCommentFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* @Description 获取某个话题的评论列表 |
|||
* @Param tokenDto |
|||
* @Param ResiQueryCommentFormDTO |
|||
* @return Result<List<ResiCommentResultDTO>> |
|||
* @Author wangc |
|||
* @Date 2020.04.01 23:49 |
|||
**/ |
|||
@RequestMapping("getcommentlistoftopic") |
|||
public Result<List<ResiCommentResultDTO>> getCommentListOfTopic(@LoginUser TokenDto tokenDto, ResiQueryCommentFormDTO queryCommentFormDTO){ |
|||
ValidatorUtils.validateEntity(queryCommentFormDTO); |
|||
return commentService.getCommentList(tokenDto,queryCommentFormDTO); |
|||
} |
|||
} |
@ -0,0 +1,144 @@ |
|||
package com.epmet.modules.topic.controller; |
|||
|
|||
import com.epmet.commons.tools.annotation.LoginUser; |
|||
import com.epmet.commons.tools.security.dto.TokenDto; |
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.commons.tools.validator.ValidatorUtils; |
|||
import com.epmet.modules.topic.service.ResiTopicService; |
|||
import com.epmet.resi.group.dto.topic.form.ResiTopicOperationFormDTO; |
|||
import com.epmet.resi.group.dto.topic.form.ResiTopicPageFormDTO; |
|||
import com.epmet.resi.group.dto.topic.form.ResiTopicPublishFormDTO; |
|||
import com.epmet.resi.group.dto.topic.result.ResiTopicDetailResultDTO; |
|||
import com.epmet.resi.group.dto.topic.result.ResiTopicInfoResultDTO; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestParam; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ResiTopicController |
|||
* @Author wangc |
|||
* @date 2020.03.31 13:03 |
|||
*/ |
|||
|
|||
@RestController |
|||
@RequestMapping("topic") |
|||
public class ResiTopicController { |
|||
|
|||
@Autowired |
|||
ResiTopicService topicService; |
|||
|
|||
/** |
|||
* @Description 组内成员创建话题(身份校验 + 创建话题 + 增加话题记录) |
|||
* @Param TokenDto.class |
|||
* @Param ResiTopicPublishFormDTO.class |
|||
* @return Result |
|||
* @Author wangc |
|||
* @Date 2020.03.31 13:15 |
|||
**/ |
|||
@RequestMapping("createtopic") |
|||
public Result createTopic(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicPublishFormDTO topicPublishFormDTO){ |
|||
|
|||
ValidatorUtils.validateEntity(topicPublishFormDTO); |
|||
return topicService.createTopic(tokenDto,topicPublishFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* @Description 获取话题详情 |
|||
* @Param tokenDto |
|||
* @Param String |
|||
* @return Result<ResiTopicDetailResultDTO> |
|||
* @Author wangc |
|||
* @Date 2020.04.01 23:48 |
|||
**/ |
|||
@RequestMapping("gettopicdetail") |
|||
public Result<ResiTopicDetailResultDTO> getTopicDetail(@LoginUser TokenDto tokenDto, @RequestParam("topicId")String topicId ){ |
|||
return topicService.getTopicDetail(tokenDto,topicId); |
|||
} |
|||
|
|||
/** |
|||
* @Description 查看历史话题(分页,允许状态筛选) |
|||
* @Param tokenDto |
|||
* @Param ResiTopicPageFormDTO.class |
|||
* @return Result<List<ResiTopicInfoResultDTO>> |
|||
* @Author wangc |
|||
* @Date 2020.04.01 10:36 |
|||
**/ |
|||
@RequestMapping("getpasttopiclist") |
|||
public Result<List<ResiTopicInfoResultDTO>> getPastTopicList(@LoginUser TokenDto tokenDto, @RequestBody ResiTopicPageFormDTO topicPageFormDTO){ |
|||
ValidatorUtils.validateEntity(topicPageFormDTO); |
|||
return topicService.getPastTopicList(tokenDto,topicPageFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* @Description 查看组内最近十条话题 |
|||
* @Param tokenDto |
|||
* @Param groupId |
|||
* @return Result<List<ResiTopicInfoResultDTO>> |
|||
* @Author wangc |
|||
* @Date 2020.04.02 00:01 |
|||
**/ |
|||
@RequestMapping("getlatesttentopic") |
|||
Result<List<ResiTopicInfoResultDTO>> getLatestTenTopics(TokenDto tokenDto,String groupId){ |
|||
return topicService.getLatestTenTopics(tokenDto,groupId); |
|||
} |
|||
|
|||
/** |
|||
* @Description 屏蔽话题 |
|||
* @Param tokenDto |
|||
* @Param ResiTopicHiddenFormDTO.class |
|||
* @return Result |
|||
* @Author wangc |
|||
* @Date 2020.04.01 12:38 |
|||
**/ |
|||
@RequestMapping("hidetopic") |
|||
Result hideTopic(TokenDto tokenDto,ResiTopicOperationFormDTO hiddenFormDTO){ |
|||
ValidatorUtils.validateEntity(hiddenFormDTO); |
|||
return topicService.hideTopic(tokenDto,hiddenFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* @Description 屏蔽话题列表查询 |
|||
* @Param tokenDto |
|||
* @Param ResiTopicPageFormDTO.class |
|||
* @return List<ResiTopicInfoResultDTO> |
|||
* @Author wangc |
|||
* @Date 2020.04.01 16:45 |
|||
**/ |
|||
@RequestMapping("gethiddentopic") |
|||
Result<List<ResiTopicInfoResultDTO>> getHiddenTopic(TokenDto tokenDto,ResiTopicPageFormDTO topicPageFormDTO){ |
|||
ValidatorUtils.validateEntity(topicPageFormDTO); |
|||
return topicService.getHiddenTopics(tokenDto,topicPageFormDTO); |
|||
} |
|||
|
|||
/** |
|||
* @Description 批量取消屏蔽 |
|||
* @Param tokenDto |
|||
* @Param topicIds |
|||
* @return Result |
|||
* @Author wangc |
|||
* @Date 2020.04.01 14:17 |
|||
**/ |
|||
@RequestMapping("cancelhiddentopics") |
|||
Result cancelHiddenTopics(TokenDto tokenDto,List<String> topicIds){ |
|||
return topicService.cancelHiddenTopics(tokenDto,topicIds); |
|||
} |
|||
|
|||
/** |
|||
* @Description 关闭话题 |
|||
* @Param tokenDto |
|||
* @Param ResiTopicOperationFormDTO.class |
|||
* @return Result.class |
|||
* @Author wangc |
|||
* @Date 2020.04.01 15:37 |
|||
**/ |
|||
@RequestMapping("closetopic") |
|||
Result closeTopic(TokenDto tokenDto,ResiTopicOperationFormDTO closeFormDTO){ |
|||
ValidatorUtils.validateEntity(closeFormDTO); |
|||
return topicService.closeTopic(tokenDto,closeFormDTO); |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.topic.dao; |
|||
|
|||
|
|||
import com.epmet.commons.mybatis.dao.BaseDao; |
|||
import com.epmet.modules.topic.entity.ResiTopicAttachmentEntity; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* 话题附件表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
@Mapper |
|||
public interface ResiTopicAttachmentDao extends BaseDao<ResiTopicAttachmentEntity> { |
|||
|
|||
/** |
|||
* @Description 批量插入 |
|||
* @Param |
|||
* @return |
|||
* @Author wangc |
|||
* @Date 2020.04.01 13:39 |
|||
**/ |
|||
int insertBatch(List<ResiTopicAttachmentEntity> list); |
|||
|
|||
/** |
|||
* @Description 重写Insert方法,不需要传CreatedDate UpdatedBy UpdatedDate DelFlag Revision |
|||
* @Param attachmentEntity |
|||
* @return int 受影响的行数 |
|||
* @Author wangc |
|||
* @Date 2020.04.01 13:40 |
|||
**/ |
|||
|
|||
int insertOne(ResiTopicAttachmentEntity attachmentEntity); |
|||
} |
@ -0,0 +1,66 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.topic.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
|
|||
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; |
|||
import lombok.Data; |
|||
import lombok.EqualsAndHashCode; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* 话题附件表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
@Data |
|||
@EqualsAndHashCode(callSuper=false) |
|||
@TableName("resi_topic_attachment") |
|||
public class ResiTopicAttachmentEntity extends BaseEpmetEntity { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 话题Id,关联resi_topic的id |
|||
*/ |
|||
private String topicId; |
|||
|
|||
/** |
|||
* 附件名(uuid随机生成) |
|||
*/ |
|||
private String attachmentName; |
|||
|
|||
/** |
|||
* 文件格式(JPG、PNG、PDF、JPEG、BMP、MP4、WMA、M4A、MP3、DOC、DOCX、XLS) |
|||
*/ |
|||
private String attachmentFormat; |
|||
|
|||
/** |
|||
* 附件类型((图片 - figure、 视频 - video、 语音 - voice、 文档 - doc)) |
|||
*/ |
|||
private String attachmentType; |
|||
|
|||
/** |
|||
* 附件地址 |
|||
*/ |
|||
private String attachmentUrl; |
|||
|
|||
} |
@ -0,0 +1,96 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.topic.service; |
|||
|
|||
|
|||
import com.epmet.commons.mybatis.service.BaseService; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.modules.topic.entity.ResiTopicAttachmentEntity; |
|||
import com.epmet.resi.group.dto.topic.ResiTopicAttachmentDTO; |
|||
|
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 话题附件表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
public interface ResiTopicAttachmentService extends BaseService<ResiTopicAttachmentEntity> { |
|||
|
|||
/** |
|||
* 默认分页 |
|||
* |
|||
* @param params |
|||
* @return PageData<ResiTopicAttachmentDTO> |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
PageData<ResiTopicAttachmentDTO> page(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 默认查询 |
|||
* |
|||
* @param params |
|||
* @return java.util.List<ResiTopicAttachmentDTO> |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
List<ResiTopicAttachmentDTO> list(Map<String, Object> params); |
|||
|
|||
/** |
|||
* 单条查询 |
|||
* |
|||
* @param id |
|||
* @return ResiTopicAttachmentDTO |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
ResiTopicAttachmentDTO get(String id); |
|||
|
|||
/** |
|||
* 默认保存 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
void save(ResiTopicAttachmentDTO dto); |
|||
|
|||
/** |
|||
* 默认更新 |
|||
* |
|||
* @param dto |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
void update(ResiTopicAttachmentDTO dto); |
|||
|
|||
/** |
|||
* 批量删除 |
|||
* |
|||
* @param ids |
|||
* @return void |
|||
* @author generator |
|||
* @date 2020-03-31 |
|||
*/ |
|||
void delete(String[] ids); |
|||
} |
@ -0,0 +1,100 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* This program is free software: you can redistribute it and/or modify |
|||
* it under the terms of the GNU General Public License as published by |
|||
* the Free Software Foundation, either version 3 of the License, or |
|||
* (at your option) any later version. |
|||
* <p> |
|||
* This program is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
* GNU General Public License for more details. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
package com.epmet.modules.topic.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|||
import com.epmet.commons.tools.page.PageData; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.constant.FieldConstant; |
|||
import com.epmet.modules.topic.dao.ResiTopicAttachmentDao; |
|||
import com.epmet.modules.topic.entity.ResiTopicAttachmentEntity; |
|||
import com.epmet.modules.topic.service.ResiTopicAttachmentService; |
|||
import com.epmet.resi.group.dto.topic.ResiTopicAttachmentDTO; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 话题附件表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-03-31 |
|||
*/ |
|||
@Service |
|||
public class ResiTopicAttachmentServiceImpl extends BaseServiceImpl<ResiTopicAttachmentDao, ResiTopicAttachmentEntity> implements ResiTopicAttachmentService { |
|||
|
|||
|
|||
@Override |
|||
public PageData<ResiTopicAttachmentDTO> page(Map<String, Object> params) { |
|||
IPage<ResiTopicAttachmentEntity> page = baseDao.selectPage( |
|||
getPage(params, FieldConstant.CREATED_TIME, false), |
|||
getWrapper(params) |
|||
); |
|||
return getPageData(page, ResiTopicAttachmentDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
public List<ResiTopicAttachmentDTO> list(Map<String, Object> params) { |
|||
List<ResiTopicAttachmentEntity> entityList = baseDao.selectList(getWrapper(params)); |
|||
|
|||
return ConvertUtils.sourceToTarget(entityList, ResiTopicAttachmentDTO.class); |
|||
} |
|||
|
|||
private QueryWrapper<ResiTopicAttachmentEntity> getWrapper(Map<String, Object> params){ |
|||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|||
|
|||
QueryWrapper<ResiTopicAttachmentEntity> wrapper = new QueryWrapper<>(); |
|||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|||
|
|||
return wrapper; |
|||
} |
|||
|
|||
@Override |
|||
public ResiTopicAttachmentDTO get(String id) { |
|||
ResiTopicAttachmentEntity entity = baseDao.selectById(id); |
|||
return ConvertUtils.sourceToTarget(entity, ResiTopicAttachmentDTO.class); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void save(ResiTopicAttachmentDTO dto) { |
|||
ResiTopicAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ResiTopicAttachmentEntity.class); |
|||
insert(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void update(ResiTopicAttachmentDTO dto) { |
|||
ResiTopicAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ResiTopicAttachmentEntity.class); |
|||
updateById(entity); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public void delete(String[] ids) { |
|||
// 逻辑删除(@TableLogic 注解)
|
|||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|||
} |
|||
|
|||
} |
@ -0,0 +1,102 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
|
|||
<mapper namespace="com.epmet.modules.topic.dao.ResiTopicAttachmentDao"> |
|||
|
|||
<insert id="insertOne" useGeneratedKeys="true" keyColumn="id" keyProperty="id" parameterType="com.epmet.modules.topic.entity.ResiTopicAttachmentEntity"> |
|||
|
|||
<selectKey keyProperty="id" resultType="java.lang.String" order="BEFORE"> |
|||
select replace(uuid(),'-','') AS APPROVAL_ID |
|||
</selectKey> |
|||
|
|||
INSERT INTO resi_topic_attachment |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test ='null != topicId'> |
|||
topic_id, |
|||
</if> |
|||
<if test ='null != attachmentName'> |
|||
attachment_name, |
|||
</if> |
|||
<if test ='null != attachmentFormat'> |
|||
attachment_format, |
|||
</if> |
|||
<if test ='null != attachmentType'> |
|||
attachment_type, |
|||
</if> |
|||
<if test ='null != attachmentUrl'> |
|||
attachment_url, |
|||
</if> |
|||
<if test ='null != createdBy'> |
|||
created_by, |
|||
</if> |
|||
del_flag, |
|||
revision, |
|||
created_time, |
|||
updated_by, |
|||
updated_time |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test ='null != topicId'> |
|||
#{topicId}, |
|||
</if> |
|||
<if test ='null != attachmentName'> |
|||
#{attachmentName}, |
|||
</if> |
|||
<if test ='null != attachmentFormat'> |
|||
#{attachmentFormat}, |
|||
</if> |
|||
<if test ='null != attachmentType'> |
|||
#{attachmentType}, |
|||
</if> |
|||
<if test ='null != attachmentUrl'> |
|||
#{attachmentUrl}, |
|||
</if> |
|||
<if test ='null != createdBy'> |
|||
#{createdBy}, |
|||
</if> |
|||
'0', |
|||
'0', |
|||
now(), |
|||
'APP_USER', |
|||
now() |
|||
</trim> |
|||
</insert> |
|||
|
|||
<!-- 批量插入 --> |
|||
<insert id="insertBatch" parameterType="java.util.List"> |
|||
|
|||
insert into user |
|||
( |
|||
id, |
|||
topic_id, |
|||
attachment_name, |
|||
attachment_format, |
|||
attachment_type, |
|||
attachment_url, |
|||
del_flag, |
|||
revision, |
|||
created_by, |
|||
created_time, |
|||
updated_by, |
|||
updated_time |
|||
) values |
|||
<foreach collection="list" item="item" index="index" separator=","> |
|||
( |
|||
(SELECT REPLACE(UUID(), '-', '') AS id), |
|||
#{item.topicId}, |
|||
#{item.attachmentName}, |
|||
#{item.attachmentFormat}, |
|||
#{item.attachmentType}, |
|||
#{item.attachmentUrl}, |
|||
#{item.delFlag}, |
|||
#{item.revision}, |
|||
#{item.createdBy}, |
|||
#{item.createdTime}, |
|||
#{item.updatedBy}, |
|||
#{item.updatedTime} |
|||
) |
|||
</foreach> |
|||
</insert> |
|||
|
|||
|
|||
</mapper> |
Loading…
Reference in new issue