Browse Source

修改 编辑微信小程序用户 接口

tags/V1.6.0^2
wanghaoran 1 year ago
parent
commit
125d78b723
1 changed files with 12 additions and 21 deletions
  1. +12
    -21
      tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSceneryServiceImpl.java

+ 12
- 21
tuoheng-api/src/main/java/com/tuoheng/api/service/impl/WestreamSceneryServiceImpl.java View File

@@ -115,31 +115,22 @@ public class WestreamSceneryServiceImpl extends BaseServiceImpl<WestreamSceneryM

@Override
public JsonResult editInfo(WestreamUser entity) {
//新增
if (StringUtils.isNull(entity.getId())) {
if (StringUtils.isEmpty(entity.getOpenid())) {
return JsonResult.error("openid为空");
}
// 添加
Integer count = westreamUserMapper.selectCount(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getOpenid, entity.getOpenid())
.eq(WestreamUser::getMark, 1));
if (count > 0) {
return JsonResult.error("用户已存在");
}
if (StringUtils.isEmpty(entity.getOpenid())) {
return JsonResult.error("openid为空");
}
WestreamUser westreamUser = westreamUserMapper.selectOne(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getOpenid, entity.getOpenid())
.eq(WestreamUser::getMark, 1));
if(ObjectUtil.isNull(westreamUser)){
//新增
entity.setHeartbeatTime(new Date());
westreamUserMapper.insert(entity);
} else {
}else {
// 编辑
Integer count = westreamUserMapper.selectCount(new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getOpenid, entity.getOpenid())
.ne(WestreamUser::getId, entity.getId())
.eq(WestreamUser::getMark, 1));
if (count > 0) {
return JsonResult.error("用户已存在");
}
entity.setHeartbeatTime(new Date());
westreamUserMapper.updateById(entity);
westreamUserMapper.update(entity,new LambdaQueryWrapper<WestreamUser>()
.eq(WestreamUser::getOpenid,entity.getOpenid())
.eq(WestreamUser::getMark, 1));
}
return JsonResult.success();
}

Loading…
Cancel
Save