Commit 12d6437e authored by mlchun's avatar mlchun

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

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