Commit 30e590b6 authored by liwei's avatar liwei

新增了发表留言和分页查询留言

parent f3d301ae
......@@ -11,9 +11,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.media.Schema;
import org.rcisoft.business.memInfo.entity.MemFollowDTO;
import org.rcisoft.business.memInfo.entity.MemInfo;
import org.rcisoft.business.memInfo.entity.MemLikeDTO;
import org.rcisoft.business.memInfo.entity.*;
import org.rcisoft.business.memInfo.service.MemInfoService;
import org.rcisoft.core.anno.CyEncryptSm4Anno;
import org.rcisoft.core.anno.CyOpeLogAnno;
......@@ -22,6 +20,7 @@ import org.rcisoft.core.constant.CyMessCons;
import org.rcisoft.core.controller.CyPaginationController;
import org.rcisoft.core.exception.CyServiceException;
import org.rcisoft.core.model.CyGridModel;
import org.rcisoft.core.model.CyPageInfo;
import org.rcisoft.core.model.CyPersistModel;
import org.rcisoft.core.operlog.enums.CyLogTypeEnum;
import org.rcisoft.core.result.CyResult;
......@@ -30,6 +29,7 @@ import org.rcisoft.core.service.CyFileStorageService;
import org.rcisoft.core.util.CyResultGenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -345,4 +345,33 @@ public class AppMemInfoController extends CyPaginationController<MemInfo> {
}
return getGridModelResponse();
}
/**
* 用户详情/我的-留言
*/
@PreAuthorize("@cyPerm.hasPerm('mem:leaveMessage:add')")
@CyOpeLogAnno(title = "system-会员表管理-留言", businessType = CyLogTypeEnum.INSERT)
@Operation(summary="留言", description="留言")
@PostMapping(value = "/memInfo/leaveMessage")
// @CyEncryptSm4Anno
public CyResult leaveMessage(@Valid @RequestBody UserLeaveMessageDTO dto, BindingResult bindingResult) {
CyPersistModel data = memInfoServiceImpl.leaveMessage(dto);
return CyResultGenUtil.builder(data,
CyMessCons.MESSAGE_ALERT_SUCCESS,
CyMessCons.MESSAGE_ALERT_ERROR,
dto);
}
/**
* 分页查询留言列表
*/
@CyOpeLogAnno(title = "system-会员表管理-查询留言表", businessType = CyLogTypeEnum.QUERY)
@Operation(summary="分页查询留言列表", description="分页查询留言列表")
@GetMapping(value = "/memInfo/leaveMessageList")
// @CyEncryptSm4Anno
public CyGridModel leaveMessageByPagination(UserLeaveMessageDTO dto) {
IPage<MemInfo> userLeaveMessage = memInfoServiceImpl.leaveMessageByPagination(getPaginationUtility(), dto);
return getGridModelResponse();
}
}
......@@ -162,5 +162,15 @@ public interface MemInfoRepository extends CyBaseMapper<MemInfo> {
* 查询我喜欢的 喜欢我的 互相喜欢的数量
*/
MemInfo selectUserFollowCount(Integer userId);
/**
* 留言
*/
int leaveMessage(UserLeaveMessageDTO dto);
/**
* 分页查询留言
*/
IPage<MemInfo> leaveMessageByPagination(CyPageInfo cyPageInfo,@Param("entity") UserLeaveMessageDTO dto);
}
......@@ -567,5 +567,24 @@ public class MemInfo extends CyIdIncreEntity<MemInfo> {
*/
@TableField(exist = false)
private String queryType;
/**
* 目标id
*/
@TableField(exist = false)
private Integer targetId;
/**
* 留言内容
*/
@TableField(exist = false)
private String leaveMessageContent;
/**
* 留言删除状态
* 0未删除,1本人已删除,2对方已删除,3双方都删除了
*/
@TableField(exist = false)
private String delStatus;
}
......@@ -13,5 +13,4 @@ public class UserLeaveMessageDTO {
private String content;
//删除类型 0未删除,1本人已删除,2对方已删除,3双方都删除了
private String delStatus;
}
......@@ -100,4 +100,16 @@ public interface MemInfoService {
CyPersistModel addLike(MemLikeDTO likeDTO);
IPage<MemInfo> findRankByPagination(CyPageInfo<MemInfo> paginationUtility, MemInfo memInfo);
/**
* 留言
* @param dto
* @return
*/
CyPersistModel leaveMessage(UserLeaveMessageDTO dto);
/**
* 分页查询留言列表
*/
IPage<MemInfo> leaveMessageByPagination(CyPageInfo<MemInfo> paginationUtility, UserLeaveMessageDTO dto);
}
......@@ -675,4 +675,31 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
}
log.info("用户点赞数据定时任务执行中...");
}
/**
* 留言
* @param dto
* @return
*/
@Override
public CyPersistModel leaveMessage(UserLeaveMessageDTO dto) {
dto.setDelStatus("0");
dto.setUserId(Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
int line = memInfoRepository.leaveMessage(dto);
return new CyPersistModel(line);
}
/**
* 分页查询留言列表
*
* @param paginationUtility
* @param dto
*/
@Override
public IPage<MemInfo> leaveMessageByPagination(CyPageInfo<MemInfo> paginationUtility, UserLeaveMessageDTO dto) {
dto.setUserId(Integer.valueOf(CyUserUtil.getAuthenBusinessId()));
IPage<MemInfo> userLeaveMessageIPage = memInfoRepository.leaveMessageByPagination(paginationUtility, dto);
return userLeaveMessageIPage;
}
}
......@@ -611,4 +611,28 @@
where 1=1
and user_id = #{entity.targetId}
</insert>
<insert id="leaveMessage">
insert into opm_user_leave_message (target_id,create_by,create_date,update_by,update_date,content,del_status)
values(#{targetId},#{userId},NOW(),#{userId},NOW(),#{content},#{delStatus})
</insert>
<select id="leaveMessageByPagination" resultType="org.rcisoft.business.memInfo.entity.MemInfo">
SELECT
oulm.business_id,
oulm.content as leaveMessageContent,
oulm.del_status,
oulm.create_date,
oulm.create_by as userId,
oulm.target_id,
mi.avatar,
mi.mem_nick_name
FROM opm_user_leave_message oulm
LEFT JOIN mem_info mi ON mi.user_id = oulm.create_by
WHERE oulm.create_by = #{entity.userId}
AND oulm.create_date = (
SELECT MAX(oulm2.create_date)
FROM opm_user_leave_message oulm2
WHERE oulm2.target_id = oulm.target_id
AND oulm2.create_by = #{entity.userId}
)
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment