|
@@ -1,7 +1,7 @@
|
|
|
package com.usky.dxtop.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-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.service.impl.ServiceImpl;
|
|
|
import com.usky.dxtop.mapper.MsgLogMapper;
|
|
@@ -51,15 +51,11 @@ public class MsgLogServiceImpl extends ServiceImpl<MsgLogMapper, MsgLog> impleme
|
|
|
public void addOrUpdate(MsgLog msgLog) {
|
|
|
msgLog.setId(System.currentTimeMillis());
|
|
|
msgLog.setCreateTime(new Date());
|
|
|
- LambdaQueryWrapper<MsgLog> queryWrapper = Wrappers.lambdaQuery();
|
|
|
- queryWrapper.eq(MsgLog::getBusinessId,msgLog.getBusinessId());
|
|
|
- MsgLog msg = this.getOne(queryWrapper);
|
|
|
- if (null == msg){
|
|
|
- this.save(msgLog);
|
|
|
- }else {
|
|
|
- msgLog.setId(msg.getId());
|
|
|
- this.updateById(msgLog);
|
|
|
- }
|
|
|
+ LambdaUpdateWrapper<MsgLog> updateWrapper = Wrappers.lambdaUpdate();
|
|
|
+ updateWrapper.set(MsgLog::getId,msgLog.getId());
|
|
|
+ updateWrapper.eq(MsgLog::getBusinessId,msgLog.getBusinessId());
|
|
|
+ this.saveOrUpdate(msgLog,updateWrapper);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|