|
@@ -3,6 +3,7 @@ package cn.com.ty.lift.ud.chat.service.impl;
|
|
|
import cn.com.ty.lift.ud.chat.mapper.UserNicknameForAnotherMapper;
|
|
|
import cn.com.ty.lift.ud.chat.mapper.entity.UserNicknameForAnother;
|
|
|
import cn.com.ty.lift.ud.chat.service.IUserNicknameForAnotherService;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -12,4 +13,16 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
@Service
|
|
|
@Transactional
|
|
|
public class UserNicknameForAnotherServiceImpl extends ServiceImpl<UserNicknameForAnotherMapper, UserNicknameForAnother> implements IUserNicknameForAnotherService {
|
|
|
+ @Override
|
|
|
+ public boolean save(UserNicknameForAnother entity) {
|
|
|
+ QueryWrapper<UserNicknameForAnother> query = new QueryWrapper<UserNicknameForAnother>()
|
|
|
+ .eq("user_id", entity.getUserId())
|
|
|
+ .eq("target_user_id", entity.getTargetUserId());
|
|
|
+ int exists = super.count(query);
|
|
|
+ if (exists > 0){
|
|
|
+ return super.update(entity,query);
|
|
|
+ }else{
|
|
|
+ return super.save(entity);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|