Commit 12d6437e authored by mlchun's avatar mlchun

1.用户个人信息更新,添加家属信息

parent b9619d0b
package io.hmit.modules.serviceOrder.dao; package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao; import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity; import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 老人与家属的关联表 * 老人与家属的关联表
* *
......
...@@ -37,8 +37,8 @@ public class UserController { ...@@ -37,8 +37,8 @@ public class UserController {
@Login @Login
@GetMapping("myinfo") @GetMapping("myinfo")
@ApiOperation("信息") @ApiOperation("信息")
public Result<UserEntity> get(@ApiIgnore @LoginUser UserEntity user){ public Result<UserInfoDTO> get(@ApiIgnore @LoginUser UserEntity user){
user.setPassword(null); UserInfoDTO userDetails = userService.getUserDetails(user.getId());
return new Result<UserEntity>().ok(user); return new Result<UserInfoDTO>().ok(userDetails);
} }
} }
package io.hmit.modules.serviceOrder.dao; package io.hmit.modules.serviceOrder.dao;
import io.hmit.common.dao.BaseDao; import io.hmit.common.dao.BaseDao;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity; import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* 老人与家属的关联表 * 老人与家属的关联表
* *
...@@ -13,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -13,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface PensionOldFamilyDao extends BaseDao<PensionOldFamilyEntity> { public interface PensionOldFamilyDao extends BaseDao<PensionOldFamilyEntity> {
List<PensionOldFamilyDTO> findByOldId(Long oldId);
} }
\ No newline at end of file
...@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService; ...@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO; import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity; import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity;
import java.util.List;
/** /**
* 老人与家属的关联表 * 老人与家属的关联表
* *
...@@ -12,4 +14,6 @@ import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity; ...@@ -12,4 +14,6 @@ import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity;
*/ */
public interface PensionOldFamilyService extends CrudService<PensionOldFamilyEntity, PensionOldFamilyDTO> { public interface PensionOldFamilyService extends CrudService<PensionOldFamilyEntity, PensionOldFamilyDTO> {
List<PensionOldFamilyDTO> findByOldId(Long oldId);
} }
\ No newline at end of file
...@@ -7,8 +7,10 @@ import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO; ...@@ -7,8 +7,10 @@ import io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO;
import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity; import io.hmit.modules.serviceOrder.entity.PensionOldFamilyEntity;
import io.hmit.modules.serviceOrder.service.PensionOldFamilyService; import io.hmit.modules.serviceOrder.service.PensionOldFamilyService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -30,5 +32,11 @@ public class PensionOldFamilyServiceImpl extends CrudServiceImpl<PensionOldFamil ...@@ -30,5 +32,11 @@ public class PensionOldFamilyServiceImpl extends CrudServiceImpl<PensionOldFamil
return wrapper; return wrapper;
} }
@Autowired
private PensionOldFamilyDao pensionOldFamilyDao;
@Override
public List<PensionOldFamilyDTO> findByOldId(Long oldId) {
return pensionOldFamilyDao.findByOldId(oldId);
}
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package io.hmit.service; ...@@ -3,6 +3,7 @@ package io.hmit.service;
import io.hmit.common.page.PageData; import io.hmit.common.page.PageData;
import io.hmit.common.service.BaseService; import io.hmit.common.service.BaseService;
import io.hmit.dto.LoginDTO; import io.hmit.dto.LoginDTO;
import io.hmit.dto.UserInfoDTO;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionOrderDTO; import io.hmit.modules.serviceOrder.dto.PensionOrderDTO;
...@@ -21,6 +22,8 @@ public interface UserService extends BaseService<UserEntity> { ...@@ -21,6 +22,8 @@ public interface UserService extends BaseService<UserEntity> {
UserEntity getUserByUserId(Long userId); UserEntity getUserByUserId(Long userId);
UserInfoDTO getUserDetails(Long userId);
/** /**
* 用户登录 * 用户登录
* *
......
...@@ -6,11 +6,14 @@ import io.hmit.common.exception.ErrorCode; ...@@ -6,11 +6,14 @@ import io.hmit.common.exception.ErrorCode;
import io.hmit.common.exception.HmitException; import io.hmit.common.exception.HmitException;
import io.hmit.common.page.PageData; import io.hmit.common.page.PageData;
import io.hmit.common.service.impl.BaseServiceImpl; import io.hmit.common.service.impl.BaseServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.common.validator.AssertUtils; import io.hmit.common.validator.AssertUtils;
import io.hmit.dao.UserDao; import io.hmit.dao.UserDao;
import io.hmit.dto.LoginDTO; import io.hmit.dto.LoginDTO;
import io.hmit.dto.UserInfoDTO;
import io.hmit.entity.TokenEntity; import io.hmit.entity.TokenEntity;
import io.hmit.entity.UserEntity; import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.service.PensionOldFamilyService;
import io.hmit.service.TokenService; import io.hmit.service.TokenService;
import io.hmit.service.UserService; import io.hmit.service.UserService;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
...@@ -31,6 +34,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -31,6 +34,9 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
@Autowired @Autowired
private UserDao userDao; private UserDao userDao;
@Autowired
private PensionOldFamilyService pensionOldFamilyService;
@Override @Override
public UserEntity getByMobile(String mobile) { public UserEntity getByMobile(String mobile) {
return baseDao.getUserByMobile(mobile); return baseDao.getUserByMobile(mobile);
...@@ -46,6 +52,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem ...@@ -46,6 +52,14 @@ public class UserServiceImpl extends BaseServiceImpl<UserDao, UserEntity> implem
return baseDao.getUserByUserId(userId); return baseDao.getUserByUserId(userId);
} }
@Override
public UserInfoDTO getUserDetails(Long userId) {
UserEntity user = userDao.getUserByUserId(userId);
UserInfoDTO userInfoDTO = ConvertUtils.sourceToTarget(user, UserInfoDTO.class);
userInfoDTO.setPensionOldFamilyDTOList(pensionOldFamilyService.findByOldId(userId));
return userInfoDTO;
}
@Override @Override
public Map<String, Object> login(LoginDTO dto) { public Map<String, Object> login(LoginDTO dto) {
UserEntity user = getByMobile(dto.getMobile()); UserEntity user = getByMobile(dto.getMobile());
......
...@@ -16,5 +16,9 @@ ...@@ -16,5 +16,9 @@
<result property="updateDate" column="update_date"/> <result property="updateDate" column="update_date"/>
</resultMap> </resultMap>
<select id="findByOldId" resultType="io.hmit.modules.serviceOrder.dto.PensionOldFamilyDTO">
select * from pension_old_family
where old_id = #{oldId}
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment