45 lines
1.4 KiB
Java
Raw Normal View History

2025-09-22 09:47:31 +08:00
package com.cdzy.activity.service.impl;
2025-09-22 10:33:24 +08:00
import com.cdzy.activity.model.vo.UserVo;
2025-09-22 10:48:51 +08:00
import com.mybatisflex.core.query.QueryWrapper;
2025-09-22 09:47:31 +08:00
import com.mybatisflex.spring.service.impl.ServiceImpl;
import com.cdzy.activity.model.User;
import com.cdzy.activity.mapper.UserMapper;
import com.cdzy.activity.service.UserService;
2025-09-22 10:48:51 +08:00
import jakarta.annotation.Resource;
2025-09-22 09:47:31 +08:00
import org.springframework.stereotype.Service;
/**
2025-09-22 10:48:51 +08:00
* 服务层实现
2025-09-22 09:47:31 +08:00
*
* @author attiya
* @since 2025-09-19
*/
@Service
2025-09-22 10:48:51 +08:00
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
@Resource
private UserMapper userMapper;
2025-09-22 09:47:31 +08:00
2025-09-22 10:33:24 +08:00
@Override
public void saveUser(UserVo user) {
2025-09-22 10:48:51 +08:00
QueryWrapper queryWrapper = QueryWrapper
.create()
.eq(User::getWxOpenId, user.getWxOpenId());
User entity = userMapper.selectOneByQuery(queryWrapper);
if (entity == null) {
throw new RuntimeException("用户登陆信息错误");
}
entity.setName(user.getName());
entity.setPhone(user.getPhone());
entity.setGender(user.getGender());
entity.setAddress(user.getAddress());
entity.setAge(user.getAge());
entity.setChronicDiseasesHistory(user.getChronicDiseasesHistory());
entity.setChronicDisease(user.getChronicDisease());
entity.setHeath(user.getHeath());
entity.setIsFilled(2);
2025-09-22 17:03:04 +08:00
userMapper.update(entity);
2025-09-22 10:33:24 +08:00
}
2025-09-22 09:47:31 +08:00
}