feat(system): 新增消息通知功能

- 添加消息通知相关枚举、实体类、服务接口和实现类
- 实现用户消息、系统公告等功能接口
- 新增消息通知相关的数据库表和映射文件
- 优化用户信息查询接口,支持批量查询
feature/comment
yang 2025-01-10 19:04:28 +08:00
parent 1eeec91626
commit bce9420d55
25 changed files with 596 additions and 16 deletions

View File

@ -18,7 +18,6 @@ import org.springframework.context.annotation.Bean;
* @author mcwl
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableConfigurationProperties(AliConfig.class)
public class McWlApplication
{
public static void main(String[] args)

View File

@ -5,8 +5,11 @@ import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.common.utils.oss.OssUtil;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelImageCommentLike;
import com.mcwl.resource.domain.ModelImageLike;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
import com.mcwl.resource.domain.dto.ModelImageRes;
import com.mcwl.resource.service.ModelImageCommentLikeService;
import com.mcwl.resource.service.ModelImageLikeService;
import com.mcwl.resource.service.ModelImageService;
import lombok.RequiredArgsConstructor;
@ -25,6 +28,8 @@ public class ModelImageController {
private final ModelImageLikeService modelImageLikeService;
private final ModelImageCommentLikeService modelImageCommentLikeService;
/**
*
@ -42,24 +47,39 @@ public class ModelImageController {
*/
@PostMapping("/publish")
public AjaxResult publish(@RequestBody ModelImageRes modelImageRes) {
ModelImage modelImage = new ModelImage();
BeanUtil.copyProperties(modelImageRes, modelImage);
modelImage.setCreateBy(SecurityUtils.getUsername());
modelImage.setUpdateBy(SecurityUtils.getUsername());
modelImage.setUpdateTime(new Date());
modelImage.setStatus(3);
modelImageService.save(modelImage);
modelImageService.publish(modelImageRes);
return AjaxResult.success();
}
/**
* /
*/
@GetMapping("/like/{imageId}")
@GetMapping("/imageLike/{imageId}")
public AjaxResult like(@PathVariable Long imageId) {
modelImageLikeService.like(imageId);
return AjaxResult.success();
}
/**
*
*/
@PostMapping("/comment")
public AjaxResult comment(@RequestBody ModelImageCommentRes modelImageCommentRes) {
modelImageService.comment(modelImageCommentRes);
return AjaxResult.success();
}
/**
* /
*/
@GetMapping("/commentLike/{commentId}")
public AjaxResult commentLike(@PathVariable Long commentId) {
modelImageCommentLikeService.like(commentId);
return AjaxResult.error();
}
}

View File

@ -0,0 +1,57 @@
package com.mcwl.web.controller.system;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.system.domain.vo.AdviceVo;
import com.mcwl.system.service.ISysAdviceService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("system/advice")
@RequiredArgsConstructor
public class SysAdviceController {
private final ISysAdviceService sysAdviceService;
/**
*
*/
@GetMapping("getUserNewMsg")
public AjaxResult getUserNewMsg() {
List<AdviceVo> adviceVo = sysAdviceService.getUserNewMsg();
return AjaxResult.success(adviceVo);
}
/**
*
*/
@GetMapping("getUserSystemNotice")
public AjaxResult getUserSystemNotice() {
List<AdviceVo> adviceVo = sysAdviceService.getUserSystemNotice();
return AjaxResult.success(adviceVo);
}
/**
*
*/
@GetMapping("getUserAllMsg")
public AjaxResult getUserAllMsg() {
List<AdviceVo> adviceVo = sysAdviceService.getUserAllMsg();
return AjaxResult.success(adviceVo);
}
/**
*
*/
@GetMapping("getAllMsg")
public AjaxResult getAllMsg() {
List<AdviceVo> adviceVo = sysAdviceService.getAllMsg();
return AjaxResult.success(adviceVo);
}
}

View File

@ -1,8 +1,14 @@
package com.mcwl.memberCenter.consumer;
import com.mcwl.common.constant.QueueConstants;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.memberCenter.domain.Member;
import com.mcwl.memberCenter.service.MemberService;
import com.mcwl.system.domain.SysAdvice;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysAdviceService;
import com.mcwl.system.service.ISysUserService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import lombok.RequiredArgsConstructor;
@ -11,6 +17,7 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Date;
/**
*
@ -20,16 +27,27 @@ import java.io.IOException;
@RequiredArgsConstructor
public class EmptyPointsRemindConsumer {
private final MemberService memberService;
private final ISysAdviceService sysAdviceService;
private final ISysUserService sysUserService;
/**
*
*/
@RabbitListener(queues = QueueConstants.EMPTY_POINTS_REMIND_QUEUE, ackMode = "MANUAL")
public void emptyPointsRemind(Member Member, Channel channel, Message message) {
public void emptyPointsRemind(Member member, Channel channel, Message message) {
try {
// TODO 发送短信提醒用户积分即将清零
log.info("获取到积分清零提醒的数据:{}", Member);
SysUser sysUser = sysUserService.selectUserByUserName("admin");
SysAdvice sysAdvice = new SysAdvice();
sysAdvice.setSenderId(sysUser.getUserId());
sysAdvice.setReceiverId(member.getUserId());
sysAdvice.setType(AdviceEnum.NEW_MESSAGE_REMIND);
sysAdvice.setTitle("积分清零提醒");
sysAdvice.setContent("您的积分即将清零,请及时消费");
sysAdvice.setCreateBy(sysUser.getUserName());
sysAdvice.setUpdateBy(sysUser.getUserName());
sysAdvice.setUpdateTime(new Date());
sysAdviceService.save(sysAdvice);
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
} catch (Exception e) {
log.error("处理积分清零提醒消息时出错: {}", e.getMessage(), e);

View File

@ -1,7 +1,12 @@
package com.mcwl.memberCenter.consumer;
import com.mcwl.common.constant.QueueConstants;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.memberCenter.domain.Member;
import com.mcwl.system.domain.SysAdvice;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.service.ISysAdviceService;
import com.mcwl.system.service.ISysUserService;
import com.rabbitmq.client.Channel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -19,6 +24,9 @@ import java.io.IOException;
@RequiredArgsConstructor
public class MemberBillingConsumer {
private final ISysAdviceService sysAdviceService;
private final ISysUserService sysUserService;
/**
*
@ -27,7 +35,14 @@ public class MemberBillingConsumer {
public void memberBillingQueue(Member member, Channel channel, Message message) {
try {
// TODO 发送短信提醒用户会员账单如果支付成功更新last_payment_date并重新计算end_datestart_date + 1个月
log.info("获取到会员账单的数据:{}", member);
SysUser sysUser = sysUserService.selectUserByUserName("admin");
SysAdvice sysAdvice = new SysAdvice();
sysAdvice.setSenderId(sysUser.getUserId());
sysAdvice.setReceiverId(member.getUserId());
sysAdvice.setType(AdviceEnum.NEW_MESSAGE_REMIND);
sysAdvice.setTitle("会员账单");
sysAdvice.setContent("您的会员即将到期,请及时支付");
sysAdviceService.save(sysAdvice);
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
} catch (Exception e) {
log.error("处理会员账单消息时出错: {}", e.getMessage(), e);

View File

@ -2,13 +2,17 @@ package com.mcwl.memberCenter.task;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mcwl.common.constant.QueueConstants;
import com.mcwl.common.core.domain.entity.SysUser;
import com.mcwl.memberCenter.domain.Member;
import com.mcwl.memberCenter.enums.MemberEnum;
import com.mcwl.memberCenter.service.MemberService;
import com.mcwl.system.service.ISysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -19,6 +23,8 @@ public class UserMemberTask {
private final MemberService memberService;
private final ISysUserService sysUserService;
private final RabbitTemplate rabbitTemplate;
@ -41,14 +47,23 @@ public class UserMemberTask {
/**
*
*/
@Transactional
public void emptyPointsTsk() {
List<Member> memberList = memberService.getUseUserMember();
List<Long> userIdList = new ArrayList<>();
List<SysUser> sysUserList = new ArrayList<>();
if (memberList == null || memberList.isEmpty()) {
return;
}
for (Member member : memberList) {
member.setPoints(0.0);
member.setUpdateTime(new Date());
userIdList.add(member.getUserId());
}
sysUserList = sysUserService.listByIds(userIdList);
for (SysUser sysUser : sysUserList) {
sysUser.setFreePoints(0.0);
sysUserService.updateUser(sysUser);
}
memberService.updateBatchById(memberList);
}

View File

@ -2,18 +2,21 @@ package com.mcwl.pay.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
@Data
@ConfigurationProperties(prefix = "mall.mgt.aliPayConfig")
@Configuration
@Component
public class AliConfig {
@Value("${mall.mgt.aliPayConfig.appId}")
private String appId;
@Value("${mall.mgt.aliPayConfig.privateKey}")
private String privateKey;
@Value("${mall.mgt.aliPayConfig.publicKey}")
private String publicKey;
@Value("${mall.mgt.aliPayConfig.gatewayUrl}")
private String gatewayUrl;
}

View File

@ -24,6 +24,9 @@ public class ModelImageCommentLike extends BaseEntity {
*/
private Long userId;
/**
* id
*/
private Long modelImageCommentId;

View File

@ -0,0 +1,27 @@
package com.mcwl.resource.domain.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
public class ModelImageCommentRes {
/**
* id
*/
@NotNull(message = "图片id不能为空")
private Long modelImageId;
/**
*
*/
@NotBlank(message = "评论内容不能为空")
private String content;
/**
* id
*/
private Long parentId;
}

View File

@ -7,4 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ModelImageCommentLikeMapper extends BaseMapper<ModelImageCommentLike> {
ModelImageCommentLike getLikeImageComment(Long userId, Long commentId);
}

View File

@ -3,7 +3,9 @@ package com.mcwl.resource.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.resource.domain.ModelImageComment;
import com.mcwl.resource.domain.ModelImageCommentLike;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
public interface ModelImageCommentLikeService extends IService<ModelImageCommentLike> {
void like(Long commentId);
}

View File

@ -5,8 +5,22 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
import com.mcwl.resource.domain.dto.ModelImageRes;
import com.mcwl.resource.domain.vo.MallProductVo;
public interface ModelImageService extends IService<ModelImage> {
/**
*
* @param modelImageRes
*/
void publish(ModelImageRes modelImageRes);
/**
*
* @param modelImageCommentRes
*/
void comment(ModelImageCommentRes modelImageCommentRes);
}

View File

@ -1,15 +1,66 @@
package com.mcwl.resource.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.exception.ServiceException;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelImageComment;
import com.mcwl.resource.domain.ModelImageCommentLike;
import com.mcwl.resource.domain.ModelImageLike;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
import com.mcwl.resource.mapper.ModelImageCommentLikeMapper;
import com.mcwl.resource.mapper.ModelImageCommentMapper;
import com.mcwl.resource.service.ModelImageCommentLikeService;
import com.mcwl.resource.service.ModelImageCommentService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.Objects;
@Service
@RequiredArgsConstructor
public class ModelImageCommentLikeServiceImpl extends ServiceImpl<ModelImageCommentLikeMapper, ModelImageCommentLike> implements ModelImageCommentLikeService {
private final ModelImageCommentMapper modelImageCommentMapper;
@Override
@Transactional
public void like(Long commentId) {
ModelImageComment modelImageComment = modelImageCommentMapper.selectById(commentId);
if (Objects.isNull(modelImageComment)) {
throw new ServiceException("该评论不存在");
}
Long userId = SecurityUtils.getUserId();
ModelImageCommentLike modelImageCommentLike = baseMapper.getLikeImageComment(userId, commentId);
if (Objects.nonNull(modelImageCommentLike)) {
if (Objects.equals(modelImageCommentLike.getDelFlag(), "0")) {
modelImageCommentLike.setDelFlag("1");
modelImageComment.setLikeNum(modelImageComment.getLikeNum() - 1);
} else {
modelImageCommentLike.setDelFlag("0");
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
}
// 更新点赞记录
baseMapper.updateById(modelImageCommentLike);
// 更新图片评论点赞数
modelImageCommentMapper.updateById(modelImageComment);
return;
}
// 添加点赞记录
modelImageCommentLike = new ModelImageCommentLike();
modelImageCommentLike.setUserId(userId);
modelImageCommentLike.setModelImageCommentId(commentId);
modelImageCommentLike.setCreateBy(SecurityUtils.getUsername());
modelImageCommentLike.setUpdateBy(SecurityUtils.getUsername());
modelImageCommentLike.setUpdateTime(new Date());
baseMapper.insert(modelImageCommentLike);
// 更新图片点赞数
modelImageComment.setLikeNum(modelImageComment.getLikeNum() + 1);
modelImageCommentMapper.updateById(modelImageComment);
}
}

View File

@ -1,25 +1,70 @@
package com.mcwl.resource.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.core.domain.AjaxResult;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.resource.domain.MallProductLike;
import com.mcwl.resource.domain.ModelImage;
import com.mcwl.resource.domain.ModelImageComment;
import com.mcwl.resource.domain.ModelProduct;
import com.mcwl.resource.domain.dto.ModelImageCommentRes;
import com.mcwl.resource.domain.dto.ModelImageRes;
import com.mcwl.resource.domain.vo.MallProductVo;
import com.mcwl.resource.mapper.MallProductLikeMapper;
import com.mcwl.resource.mapper.ModelImageCommentMapper;
import com.mcwl.resource.mapper.ModelImageMapper;
import com.mcwl.resource.service.MallProductLikeService;
import com.mcwl.resource.service.MallProductService;
import com.mcwl.resource.service.ModelImageCommentService;
import com.mcwl.resource.service.ModelImageService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Service
@RequiredArgsConstructor
public class ModelImageServiceImpl extends ServiceImpl<ModelImageMapper, ModelImage> implements ModelImageService {
private final ModelImageCommentMapper modelImageCommentMapper;
private final ModelImageMapper modelImageMapper;
@Override
public void comment(ModelImageCommentRes modelImageCommentRes) {
Long parentId = modelImageCommentRes.getParentId();
ModelImageComment mic = modelImageCommentMapper.selectById(parentId);
if (Objects.nonNull(parentId) && Objects.isNull(mic)) {
return;
}
ModelImageComment modelImageComment = new ModelImageComment();
BeanUtil.copyProperties(modelImageCommentRes, modelImageComment);
modelImageComment.setUserId(SecurityUtils.getUserId());
modelImageComment.setCreateBy(SecurityUtils.getUsername());
modelImageComment.setUpdateBy(SecurityUtils.getUsername());
modelImageComment.setUpdateTime(new Date());
modelImageCommentMapper.insert(modelImageComment);
}
@Override
public void publish(ModelImageRes modelImageRes) {
ModelImage modelImage = new ModelImage();
BeanUtil.copyProperties(modelImageRes, modelImage);
modelImage.setCreateBy(SecurityUtils.getUsername());
modelImage.setUpdateBy(SecurityUtils.getUsername());
modelImage.setUpdateTime(new Date());
modelImage.setStatus(3);
modelImageMapper.insert(modelImage);
}
}

View File

@ -0,0 +1,38 @@
<?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.mcwl.resource.mapper.ModelImageCommentLikeMapper">
<resultMap type="modelImageCommentLike" id="ModelImageCommentLikeResult">
<id property="id" column="id"/>
<result property="userId" column="user_id"/>
<result property="modelImageCommentId" column="model_image_comment_id"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="remark" column="remark"/>
</resultMap>
<sql id="selectModelImageCommentLikeVo">
select id,
user_id,
model_image_comment_id,
create_by,
create_time,
update_by,
update_time,
del_flag,
remark
from model_image_comment_like
</sql>
<select id="getLikeImageComment" resultMap="ModelImageCommentLikeResult">
<include refid="selectModelImageCommentLikeVo"/>
where user_id = #{userId}
and model_image_comment_id = #{imageId}
</select>
</mapper>

View File

@ -0,0 +1,54 @@
package com.mcwl.system.domain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mcwl.common.core.domain.BaseEntity;
import com.mcwl.system.domain.enums.AdviceEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_advice")
public class SysAdvice extends BaseEntity {
@TableId
private Long id;
/**
* id
*/
private Long senderId;
/**
* id
*/
private Long receiverId;
/**
*
*/
private AdviceEnum type;
/**
*
*/
private String title;
/**
*
*/
private String content;
/**
* 0 1
*/
private String isRead;
}

View File

@ -0,0 +1,58 @@
package com.mcwl.system.domain.enums;
import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*/
@Getter
@AllArgsConstructor
public enum AdviceEnum {
/**
*
*/
NEW_MESSAGE_REMIND("newMessageRemind", "新消息提醒"),
/**
*
*/
SYSTEM_NOTICE("systemNotice", "系统公告"),
/**
*
*/
EMAIL_REMIND("emailRemind", "邮件提醒"),
/**
*
*/
SMS_REMIND("smsRemind", "短信提醒"),
/**
*
*/
PUSH_REMIND("pushRemind", "推送提醒"),
/**
*
*/
LIKE_REMIND("likeRemind", "点赞提醒"),
/**
*
*/
COMMENT_REMIND("commentRemind", "评论提醒"),
/**
*
*/
PRIVATE_MESSAGE_REMIND("privateMessageRemind", "私信提醒");
private final String name;
@EnumValue
private final String value;
}

View File

@ -0,0 +1,29 @@
package com.mcwl.system.domain.vo;
import com.mcwl.system.domain.enums.AdviceEnum;
import lombok.Data;
@Data
public class AdviceVo {
/**
*
*/
private AdviceEnum type;
/**
*
*/
private String title;
/**
*
*/
private String content;
/**
* 0 1
*/
private String isRead;
}

View File

@ -0,0 +1,16 @@
package com.mcwl.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mcwl.system.domain.SysAdvice;
import com.mcwl.system.domain.SysConfig;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
*
*/
@Mapper
public interface SysAdviceMapper extends BaseMapper<SysAdvice> {
}

View File

@ -136,4 +136,6 @@ public interface SysUserMapper
SysUser selectByIdCard(@Param("idCard") String idCard);
List<SysUser> listByIds(List<Long> userIdList);
}

View File

@ -0,0 +1,24 @@
package com.mcwl.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mcwl.system.domain.SysAdvice;
import com.mcwl.system.domain.SysConfig;
import com.mcwl.system.domain.vo.AdviceVo;
import java.util.List;
/**
*
*
* @author mcwl
*/
public interface ISysAdviceService extends IService<SysAdvice> {
List<AdviceVo> getUserNewMsg();
List<AdviceVo> getUserSystemNotice();
List<AdviceVo> getUserAllMsg();
List<AdviceVo> getAllMsg();
}

View File

@ -215,4 +215,7 @@ public interface ISysUserService
SysUser selectUserInfoById(Long userId);
AjaxResult updateIdCard(SysUser sysUser);
List<SysUser> listByIds(List<Long> userIdList);
}

View File

@ -0,0 +1,70 @@
package com.mcwl.system.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mcwl.common.utils.SecurityUtils;
import com.mcwl.system.domain.SysAdvice;
import com.mcwl.system.domain.SysUserThirdAccount;
import com.mcwl.system.domain.enums.AdviceEnum;
import com.mcwl.system.domain.vo.AdviceVo;
import com.mcwl.system.mapper.SysAdviceMapper;
import com.mcwl.system.service.ISysAdviceService;
import com.mcwl.system.service.IWXService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
import java.util.List;
/**
*
*/
@Service
public class SysAdviceServiceImpl extends ServiceImpl<SysAdviceMapper, SysAdvice> implements ISysAdviceService {
@Override
public List<AdviceVo> getUserNewMsg() {
Long userId = SecurityUtils.getUserId();
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
.eq(SysAdvice::getReceiverId, userId)
.eq(SysAdvice::getType, AdviceEnum.NEW_MESSAGE_REMIND));
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
}
@Override
public List<AdviceVo> getUserSystemNotice() {
Long userId = SecurityUtils.getUserId();
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
.eq(SysAdvice::getReceiverId, userId)
.eq(SysAdvice::getType, AdviceEnum.SYSTEM_NOTICE));
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
}
@Override
public List<AdviceVo> getUserAllMsg() {
Long userId = SecurityUtils.getUserId();
List<SysAdvice> sysAdvices = baseMapper.selectList(lambdaQuery()
.eq(SysAdvice::getReceiverId, userId));
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
}
@Override
public List<AdviceVo> getAllMsg() {
List<SysAdvice> sysAdvices = baseMapper.selectList(null);
return BeanUtil.copyToList(sysAdvices, AdviceVo.class);
}
}

View File

@ -649,6 +649,12 @@ public class SysUserServiceImpl implements ISysUserService
return AjaxResult.success("实名认证成功");
}
@Override
public List<SysUser> listByIds(List<Long> userIdList) {
return userMapper.listByIds(userIdList);
}
/**
*
* @param length

View File

@ -156,6 +156,16 @@
select * from sys_user where id_card = #{idCard}
</select>
<select id="listByIds" resultMap="SysUserResult">
<include refid="selectUserVo"/>
where u.user_id in
<foreach collection="list" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</select>
<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(
<if test="userId != null and userId != 0">user_id,</if>