优化
This commit is contained in:
		| @ -1,9 +1,9 @@ | ||||
| package com.ruoyi.bgt.service.impl; | ||||
|  | ||||
| import cn.hutool.core.bean.BeanUtil; | ||||
| import cn.hutool.core.collection.CollUtil; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.ruoyi.bgt.bo.BgtMessageQueryBo; | ||||
| @ -47,7 +47,6 @@ import java.util.Map; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| import static com.ruoyi.common.constants.BgtMessageConstant.*; | ||||
| import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.OPERATION_ALREADY; | ||||
| import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.OPERATION_NEED; | ||||
|  | ||||
| /** | ||||
| @ -268,17 +267,14 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt | ||||
| 	@Override | ||||
| 	@Async | ||||
| 	public void operation(String senderType,Long senderId,String recipientType,Long recipientId,Long tableId,String tableName) { | ||||
| 		LambdaQueryWrapper<BgtMessage> wrapper = new LambdaQueryWrapper<>(); | ||||
| 		LambdaUpdateWrapper<BgtMessage> wrapper = new LambdaUpdateWrapper<>(); | ||||
| 		wrapper.eq(BgtMessage::getRecipientId, recipientId); | ||||
| 		wrapper.eq(BgtMessage::getRecipientType, recipientType); | ||||
| 		wrapper.eq(BgtMessage::getSenderId, senderId); | ||||
| 		wrapper.eq(BgtMessage::getSenderType, senderType); | ||||
| 		wrapper.eq(BgtMessage::getTableId, tableId); | ||||
| 		wrapper.eq(BgtMessage::getTableName, tableName); | ||||
| 		List<BgtMessage> list = list(wrapper); | ||||
| 		if (CollUtil.isNotEmpty(list)) { | ||||
| 			lambdaUpdate().in(BgtMessage::getId, list.stream().map(BgtMessage::getId).collect(Collectors.toList())) | ||||
| 				.set(BgtMessage::getIsOperation, OPERATION_ALREADY).update(); | ||||
| 		} | ||||
| 		wrapper.set(BgtMessage::getIsOperation, OPERATION_NEED); | ||||
| 		update(wrapper); | ||||
| 	} | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 zt
					zt