个人中心更新资料

hehai
mzh820631607 4 years ago
parent 94ed79ddc9
commit 3bbaabd871
  1. 3
      src/main/java/com/msdw/tms/api/UserControllerApi.java
  2. 17
      src/main/java/com/msdw/tms/controller/UserController.java
  3. 2
      src/main/java/com/msdw/tms/dao/UserDao.java
  4. 6
      src/main/java/com/msdw/tms/entity/vo/UserEntityVo.java
  5. 12
      src/main/java/com/msdw/tms/entity/vo/UserProsonalEntityVo.java
  6. 1
      src/main/java/com/msdw/tms/service/UserService.java
  7. 9
      src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java
  8. 21
      src/main/resources/mapper/tms/UserDao.xml

@ -3,6 +3,7 @@ package com.msdw.tms.api;
import com.msdw.tms.common.utils.R; import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.entity.vo.UserEntityVo;
import com.msdw.tms.entity.vo.UserProsonalEntityVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -13,7 +14,7 @@ public interface UserControllerApi {
R userInfo(Integer id); R userInfo(Integer id);
@ApiOperation(value = "个人中心信息修改",notes = "个人中心信息修改") @ApiOperation(value = "个人中心信息修改",notes = "个人中心信息修改")
R update(UserEntity userEntity); R update(UserProsonalEntityVo userProsonalEntityVo);
@ApiOperation(value = "更新密码",notes = "更新密码") @ApiOperation(value = "更新密码",notes = "更新密码")
R examinePassword(UserEntityVo entity); R examinePassword(UserEntityVo entity);

@ -7,12 +7,14 @@ import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.R; import com.msdw.tms.common.utils.R;
import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.entity.vo.UserEntityVo;
import com.msdw.tms.entity.vo.UserProsonalEntityVo;
import com.msdw.tms.service.UserService; import com.msdw.tms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
@RestController @RestController
@ -40,6 +42,7 @@ public class UserController implements UserControllerApi {
public R info(@PathVariable("id") Long id){ public R info(@PathVariable("id") Long id){
UserEntity userEntity = userService.getById(id); UserEntity userEntity = userService.getById(id);
// userService.queryUserInfo();
return R.ok().put("growthChangeHistory", userEntity); return R.ok().put("growthChangeHistory", userEntity);
} }
@ -64,10 +67,16 @@ public class UserController implements UserControllerApi {
* 修改 * 修改
*/ */
@Override @Override
@Transactional
@PutMapping("/update") @PutMapping("/update")
public R update(@RequestBody UserEntity userEntity){ public R update(@RequestBody UserProsonalEntityVo vo){
userService.updateById(userEntity); List<UserEntityVo> userEntityVoList = vo.getUserEntityVoList();
UserEntity userInfo = vo.getUserEntity();
userService.updateById(userInfo);
for (int i = 0;i<userEntityVoList.size();i++){
UserEntityVo personalFile = userEntityVoList.get(i);
userService.updateUserPersonal(personalFile);
}
return R.ok(); return R.ok();
} }
@ -82,7 +91,7 @@ public class UserController implements UserControllerApi {
} }
/** /**
* 校验密码 * 校验并更新密码
* @param entity 封装用户id和输入的原密码和新密码 * @param entity 封装用户id和输入的原密码和新密码
* @return R 响应的状态信息 * @return R 响应的状态信息
*/ */

@ -10,4 +10,6 @@ import org.apache.ibatis.annotations.Mapper;
public interface UserDao extends BaseMapper<UserEntity> { public interface UserDao extends BaseMapper<UserEntity> {
UserEntityVo getByUserId(UserEntity userEntity); UserEntityVo getByUserId(UserEntity userEntity);
void updateUserPersonal(UserEntityVo vo);
} }

@ -13,6 +13,8 @@ public class UserEntityVo extends UserEntity implements Serializable {
private String searchContent; private String searchContent;
//学校名称 //学校名称
private String schoolName; private String schoolName;
//
private Integer schoolId;
//省份名称 //省份名称
private String provinceName; private String provinceName;
//城市名称 //城市名称
@ -45,6 +47,10 @@ public class UserEntityVo extends UserEntity implements Serializable {
private Integer personalCareerId; private Integer personalCareerId;
//个人档案学校名称 //个人档案学校名称
private String professionalSchoolName; private String professionalSchoolName;
//个人档案主键
private Integer personalFileId;
//绑定用户ID
private Integer userId;
} }

@ -0,0 +1,12 @@
package com.msdw.tms.entity.vo;
import com.msdw.tms.entity.UserEntity;
import lombok.Data;
import java.util.List;
@Data
public class UserProsonalEntityVo {
private UserEntity userEntity;
private List<UserEntityVo> userEntityVoList;
}

@ -13,4 +13,5 @@ public interface UserService extends IService<UserEntity> {
UserEntityVo queryUserId(Integer userId); UserEntityVo queryUserId(Integer userId);
void updateUserPersonal(UserEntityVo personalFile);
} }

@ -10,13 +10,15 @@ import com.msdw.tms.dao.UserDao;
import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.vo.UserEntityVo; import com.msdw.tms.entity.vo.UserEntityVo;
import com.msdw.tms.service.UserService; import com.msdw.tms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
@Service("userService") @Service("userService")
public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService { public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {
@Autowired
private UserDao userMapper;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
@ -36,4 +38,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
UserEntityVo vo = userDao.getByUserId(userEntity); UserEntityVo vo = userDao.getByUserId(userEntity);
return vo; return vo;
} }
@Override
public void updateUserPersonal(UserEntityVo personalFile) {
userMapper.updateUserPersonal(personalFile);
}
} }

@ -46,4 +46,25 @@
AND c.isdel = #{isdel} AND c.isdel = #{isdel}
AND s.isdel = #{isdel} AND s.isdel = #{isdel}
</select> </select>
<update id="updateUserPersonal" parameterType="com.msdw.tms.entity.vo.UserProsonalEntityVo">
UPDATE
hr_personal_file per
SET
per.personalCareerId = #{personalCareerId},
per.schoolId = #{schoolId},
per.schoolName = #{schoolName},
per.disciplineId = #{disciplineId},
per.disciplineName = #{disciplineName},
per.professionalId = #{professionalId},
per.professionalName = #{professionalName},
per.professionalClassId = #{professionalClassId},
per.professionalClassName = #{professionalClassName},
per.updatetime = NOW()
WHERE
per.userId = #{userId}
AND
per.personalFileId = #{personalFileId}
</update>
</mapper> </mapper>
Loading…
Cancel
Save