个人中心

hehai
mzh820631607 4 years ago
parent b4d53f2f5b
commit 3656bab2c8
  1. 34
      src/main/java/com/msdw/tms/controller/UserController.java
  2. 3
      src/main/java/com/msdw/tms/dao/UserDao.java
  3. 2
      src/main/java/com/msdw/tms/dao/UserInfoDao.java
  4. 9
      src/main/java/com/msdw/tms/entity/UserPersonalFileEntity.java
  5. 8
      src/main/java/com/msdw/tms/entity/vo/UserProsonalEntityVo.java
  6. 2
      src/main/java/com/msdw/tms/service/UserInfoService.java
  7. 6
      src/main/java/com/msdw/tms/service/UserService.java
  8. 7
      src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java
  9. 5
      src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java
  10. 8
      src/main/resources/mapper/tms/UserDao.xml
  11. 41
      src/main/resources/mapper/tms/UserInfoDao.xml

@ -3,9 +3,13 @@ package com.msdw.tms.controller;
import com.msdw.tms.api.UserControllerApi; import com.msdw.tms.api.UserControllerApi;
import com.msdw.tms.common.utils.PageUtils; 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.PersonalFileEntity;
import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.UserPersonalFileEntity;
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.entity.vo.UserProsonalEntityVo;
import com.msdw.tms.service.UserInfoService;
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;
@ -22,6 +26,8 @@ public class UserController implements UserControllerApi {
@Autowired @Autowired
private UserService userService; private UserService userService;
@Autowired
private UserInfoService userInfoService;
/** /**
* 列表 * 列表
@ -71,15 +77,33 @@ public class UserController implements UserControllerApi {
@Transactional @Transactional
@PutMapping("/update") @PutMapping("/update")
public R update(@RequestBody UserProsonalEntityVo vo){ public R update(@RequestBody UserProsonalEntityVo vo){
List<UserEntityVo> userEntityVoList = vo.getUserEntityVoList(); List<UserPersonalFileEntity> entityList = vo.getPersonalFileEntities();
UserEntity userInfo = vo.getUserEntity(); UserInfoEntity userInfo = vo.getUserInfoEntity();
userService.updateById(userInfo);
for (int i = 0;i<userEntityVoList.size();i++){ userInfoService.updateUserInfoById(userInfo);
UserEntityVo personalFile = userEntityVoList.get(i); // userInfoService.updateById(userInfo);
for (int i = 0;i<entityList.size();i++){
UserPersonalFileEntity personalFile = entityList.get(i);
userService.updateUserPersonal(personalFile); userService.updateUserPersonal(personalFile);
} }
return R.ok(); return R.ok();
} }
// /**
// * 修改
// */
// @Override
// @Transactional
// @PutMapping("/update")
// public R update(@RequestBody UserProsonalEntityVo vo){
// 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();
// }
/** /**
* 删除 * 删除

@ -2,6 +2,7 @@ package com.msdw.tms.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.UserPersonalFileEntity;
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.entity.vo.UserProsonalEntityVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -13,7 +14,7 @@ public interface UserDao extends BaseMapper<UserEntity> {
UserEntityVo getByUserId(UserEntity userEntity); UserEntityVo getByUserId(UserEntity userEntity);
void updateUserPersonal(UserEntityVo vo); void updateUserPersonal(UserPersonalFileEntity vo);
List<UserProsonalEntityVo> queryPersonalFile(Integer userid); List<UserProsonalEntityVo> queryPersonalFile(Integer userid);
List<UserProsonalEntityVo> queryUserInfo(Integer userid); List<UserProsonalEntityVo> queryUserInfo(Integer userid);

@ -11,4 +11,6 @@ import org.apache.ibatis.annotations.Mapper;
public interface UserInfoDao extends BaseMapper<UserInfoEntity> { public interface UserInfoDao extends BaseMapper<UserInfoEntity> {
Boolean add(UserInfoEntity userEntity); Boolean add(UserInfoEntity userEntity);
void userInfupdateUserInfoById(UserInfoEntity entity);
} }

@ -1,4 +1,4 @@
package com.msdw.tms.entity.vo; package com.msdw.tms.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable;
@Accessors(chain = true) @Accessors(chain = true)
@Data @Data
@TableName("hr_personal_file") @TableName("hr_personal_file")
public class personalFile { public class UserPersonalFileEntity implements Serializable {
private static final long serialVersionUID = 1L;
//个人档案 //个人档案
@TableId(type = IdType.AUTO) @TableId(type = IdType.AUTO)
private Integer personalFileId; private Integer personalFileId;
@ -36,3 +39,5 @@ public class personalFile {
//修改时间 //修改时间
private String updatetime; private String updatetime;
} }

@ -1,12 +1,20 @@
package com.msdw.tms.entity.vo; package com.msdw.tms.entity.vo;
import cn.hutool.system.UserInfo;
import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.UserPersonalFileEntity;
import lombok.Data; import lombok.Data;
import java.util.List; import java.util.List;
@Data @Data
public class UserProsonalEntityVo { public class UserProsonalEntityVo {
private List<UserPersonalFileEntity> personalFileEntities;
private UserInfoEntity userInfoEntity;
private UserEntity userEntity; private UserEntity userEntity;
//测试用
private List<UserEntityVo> userEntityVoList; private List<UserEntityVo> userEntityVoList;
} }

@ -12,4 +12,6 @@ public interface UserInfoService extends IService<UserInfoEntity> {
PageUtils queryPage(Map<String, Object> params); PageUtils queryPage(Map<String, Object> params);
R add(UserInfoEntity userInfoEntity); R add(UserInfoEntity userInfoEntity);
void updateUserInfoById(UserInfoEntity entity);
} }

@ -3,11 +3,12 @@ package com.msdw.tms.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.UserPersonalFileEntity;
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.entity.vo.UserProsonalEntityVo;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public interface UserService extends IService<UserEntity> { public interface UserService extends IService<UserEntity> {
@ -16,7 +17,8 @@ public interface UserService extends IService<UserEntity> {
UserEntityVo queryUserId(Integer userId); UserEntityVo queryUserId(Integer userId);
void updateUserPersonal(UserEntityVo personalFile);
void updateUserPersonal(UserPersonalFileEntity personalFile);
HashMap<String,UserProsonalEntityVo> queryUserInfo(Integer id); HashMap<String,UserProsonalEntityVo> queryUserInfo(Integer id);
} }

@ -12,6 +12,7 @@ import com.msdw.tms.entity.response.CommonCode;
import com.msdw.tms.entity.response.ResponseResult; import com.msdw.tms.entity.response.ResponseResult;
import com.msdw.tms.entity.response.ResultCode; import com.msdw.tms.entity.response.ResultCode;
import com.msdw.tms.service.UserInfoService; import com.msdw.tms.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashMap; import java.util.HashMap;
@ -19,6 +20,8 @@ import java.util.Map;
@Service("userInfoService") @Service("userInfoService")
public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity> implements UserInfoService { public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity> implements UserInfoService {
@Autowired
private UserInfoDao userInfoDao;
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
@ -45,4 +48,8 @@ public R add(UserInfoEntity userInfoEntity) {
return r; return r;
} }
} }
@Override
public void updateUserInfoById(UserInfoEntity entity){
userInfoDao.userInfupdateUserInfoById(entity);
}
} }

@ -8,6 +8,8 @@ import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.Query; import com.msdw.tms.common.utils.Query;
import com.msdw.tms.dao.UserDao; import com.msdw.tms.dao.UserDao;
import com.msdw.tms.entity.UserEntity; import com.msdw.tms.entity.UserEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.UserPersonalFileEntity;
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.entity.vo.UserProsonalEntityVo;
import com.msdw.tms.service.UserService; import com.msdw.tms.service.UserService;
@ -43,8 +45,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements
return vo; return vo;
} }
@Override @Override
public void updateUserPersonal(UserEntityVo personalFile) { public void updateUserPersonal(UserPersonalFileEntity personalFile) {
userMapper.updateUserPersonal(personalFile); userMapper.updateUserPersonal(personalFile);
} }

@ -4,7 +4,7 @@
<mapper namespace="com.msdw.tms.dao.UserDao"> <mapper namespace="com.msdw.tms.dao.UserDao">
<select id="queryUserInfo" resultType="hashMap"> <select id="queryUserInfo" parameterType="com.msdw.tms.entity.UserInfoEntity" resultType="hashMap">
SELECT SELECT
u.userId, u.userId,
userName, userName,
@ -41,7 +41,7 @@
AND s.isdel = 0 AND s.isdel = 0
</select> </select>
<select id="queryPersonalFile" parameterType="com.msdw.tms.entity.UserEntity" resultType="com.msdw.tms.entity.vo.UserEntityVo"> <select id="queryPersonalFile" parameterType="com.msdw.tms.entity.PersonalFileEntity" resultType="hashMap">
SELECT SELECT
per.personalFileId, per.personalFileId,
per.schoolId, per.schoolId,
@ -62,7 +62,7 @@
school s school s
WHERE WHERE
per.schoolId = s.schoolId per.schoolId = s.schoolId
AND per.userId = #{userid} AND per.userId = #{userId}
AND s.isdel = 0 AND s.isdel = 0
</select> </select>
@ -81,7 +81,7 @@
per.professionalClassName = #{professionalClassName}, per.professionalClassName = #{professionalClassName},
per.updatetime = NOW() per.updatetime = NOW()
WHERE WHERE
per.userId = #{userid} per.userId = #{userId}
AND AND
per.personalFileId = #{personalFileId} per.personalFileId = #{personalFileId}

@ -11,4 +11,45 @@
#{userName}, #{uniqueIdentificationAccount}, #{provinceId}, #{userName}, #{uniqueIdentificationAccount}, #{provinceId},
#{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId}) #{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId})
</insert> </insert>
<update id="userInfupdateUserInfoById" parameterType="com.msdw.tms.entity.UserInfoEntity">
update hr_user_info
<set>
<if test="account!= null and account != '' ">
account = #{account},
</if>
<if test="countries!= null and countries != '' ">
countries = #{countries},
</if>
<if test="cityId!= null">
cityId = #{cityId},
</if>
<if test="dateBirth != null">
dateBirth = #{dateBirth},
</if>
<if test="documenttype != null">
documenttype = #{documenttype},
</if>
<if test="educationDegree != null">
educationDegree = #{educationDegree},
</if>
<if test="IDNumber != null">
IDNumber = #{IDNumber},
</if>
<if test="provinceId != null">
provinceId = #{provinceId},
</if>
<if test="sex != null">
sex = #{sex},
</if>
<if test="userName != null">
userName = #{userName},
</if>
<if test="schoolId != null">
schoolId = #{schoolId},
</if>
</set>
WHERE userId = #{userId};
</update>
</mapper> </mapper>
Loading…
Cancel
Save