From 3656bab2c8e797223378b754630183cca5d4af5e Mon Sep 17 00:00:00 2001 From: mzh820631607 Date: Mon, 28 Sep 2020 16:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../msdw/tms/controller/UserController.java | 34 ++++++++++++--- src/main/java/com/msdw/tms/dao/UserDao.java | 3 +- .../java/com/msdw/tms/dao/UserInfoDao.java | 2 + ...lFile.java => UserPersonalFileEntity.java} | 9 +++- .../tms/entity/vo/UserProsonalEntityVo.java | 8 ++++ .../com/msdw/tms/service/UserInfoService.java | 2 + .../com/msdw/tms/service/UserService.java | 6 ++- .../tms/service/impl/UserInfoServiceImpl.java | 7 ++++ .../tms/service/impl/UserServiceImpl.java | 5 ++- src/main/resources/mapper/tms/UserDao.xml | 8 ++-- src/main/resources/mapper/tms/UserInfoDao.xml | 41 +++++++++++++++++++ 11 files changed, 110 insertions(+), 15 deletions(-) rename src/main/java/com/msdw/tms/entity/{vo/personalFile.java => UserPersonalFileEntity.java} (84%) diff --git a/src/main/java/com/msdw/tms/controller/UserController.java b/src/main/java/com/msdw/tms/controller/UserController.java index 294263a..e141e57 100644 --- a/src/main/java/com/msdw/tms/controller/UserController.java +++ b/src/main/java/com/msdw/tms/controller/UserController.java @@ -3,9 +3,13 @@ package com.msdw.tms.controller; import com.msdw.tms.api.UserControllerApi; import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.R; +import com.msdw.tms.entity.PersonalFileEntity; 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.UserProsonalEntityVo; +import com.msdw.tms.service.UserInfoService; import com.msdw.tms.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; @@ -22,6 +26,8 @@ public class UserController implements UserControllerApi { @Autowired private UserService userService; + @Autowired + private UserInfoService userInfoService; /** * 列表 @@ -71,15 +77,33 @@ public class UserController implements UserControllerApi { @Transactional @PutMapping("/update") public R update(@RequestBody UserProsonalEntityVo vo){ - List userEntityVoList = vo.getUserEntityVoList(); - UserEntity userInfo = vo.getUserEntity(); - userService.updateById(userInfo); - for (int i = 0;i entityList = vo.getPersonalFileEntities(); + UserInfoEntity userInfo = vo.getUserInfoEntity(); + + userInfoService.updateUserInfoById(userInfo); +// userInfoService.updateById(userInfo); + for (int i = 0;i userEntityVoList = vo.getUserEntityVoList(); +// UserEntity userInfo = vo.getUserEntity(); +// userService.updateById(userInfo); +// for (int i = 0;i { UserEntityVo getByUserId(UserEntity userEntity); - void updateUserPersonal(UserEntityVo vo); + void updateUserPersonal(UserPersonalFileEntity vo); List queryPersonalFile(Integer userid); List queryUserInfo(Integer userid); diff --git a/src/main/java/com/msdw/tms/dao/UserInfoDao.java b/src/main/java/com/msdw/tms/dao/UserInfoDao.java index 4241002..d7be78b 100644 --- a/src/main/java/com/msdw/tms/dao/UserInfoDao.java +++ b/src/main/java/com/msdw/tms/dao/UserInfoDao.java @@ -11,4 +11,6 @@ import org.apache.ibatis.annotations.Mapper; public interface UserInfoDao extends BaseMapper { Boolean add(UserInfoEntity userEntity); + + void userInfupdateUserInfoById(UserInfoEntity entity); } diff --git a/src/main/java/com/msdw/tms/entity/vo/personalFile.java b/src/main/java/com/msdw/tms/entity/UserPersonalFileEntity.java similarity index 84% rename from src/main/java/com/msdw/tms/entity/vo/personalFile.java rename to src/main/java/com/msdw/tms/entity/UserPersonalFileEntity.java index 196eac4..9c1bfb2 100644 --- a/src/main/java/com/msdw/tms/entity/vo/personalFile.java +++ b/src/main/java/com/msdw/tms/entity/UserPersonalFileEntity.java @@ -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.TableId; @@ -6,10 +6,13 @@ import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serializable; + @Accessors(chain = true) @Data @TableName("hr_personal_file") -public class personalFile { +public class UserPersonalFileEntity implements Serializable { + private static final long serialVersionUID = 1L; //个人档案 @TableId(type = IdType.AUTO) private Integer personalFileId; @@ -36,3 +39,5 @@ public class personalFile { //修改时间 private String updatetime; } + + diff --git a/src/main/java/com/msdw/tms/entity/vo/UserProsonalEntityVo.java b/src/main/java/com/msdw/tms/entity/vo/UserProsonalEntityVo.java index 2579d87..89a3ed5 100644 --- a/src/main/java/com/msdw/tms/entity/vo/UserProsonalEntityVo.java +++ b/src/main/java/com/msdw/tms/entity/vo/UserProsonalEntityVo.java @@ -1,12 +1,20 @@ package com.msdw.tms.entity.vo; +import cn.hutool.system.UserInfo; import com.msdw.tms.entity.UserEntity; +import com.msdw.tms.entity.UserInfoEntity; +import com.msdw.tms.entity.UserPersonalFileEntity; import lombok.Data; import java.util.List; @Data public class UserProsonalEntityVo { + + private List personalFileEntities; + private UserInfoEntity userInfoEntity; + private UserEntity userEntity; + //测试用 private List userEntityVoList; } diff --git a/src/main/java/com/msdw/tms/service/UserInfoService.java b/src/main/java/com/msdw/tms/service/UserInfoService.java index 82f52f0..d8f4acd 100644 --- a/src/main/java/com/msdw/tms/service/UserInfoService.java +++ b/src/main/java/com/msdw/tms/service/UserInfoService.java @@ -12,4 +12,6 @@ public interface UserInfoService extends IService { PageUtils queryPage(Map params); R add(UserInfoEntity userInfoEntity); + + void updateUserInfoById(UserInfoEntity entity); } diff --git a/src/main/java/com/msdw/tms/service/UserService.java b/src/main/java/com/msdw/tms/service/UserService.java index 1f1541e..a286562 100644 --- a/src/main/java/com/msdw/tms/service/UserService.java +++ b/src/main/java/com/msdw/tms/service/UserService.java @@ -3,11 +3,12 @@ package com.msdw.tms.service; import com.baomidou.mybatisplus.extension.service.IService; import com.msdw.tms.common.utils.PageUtils; 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.UserProsonalEntityVo; import java.util.HashMap; -import java.util.List; import java.util.Map; public interface UserService extends IService { @@ -16,7 +17,8 @@ public interface UserService extends IService { UserEntityVo queryUserId(Integer userId); - void updateUserPersonal(UserEntityVo personalFile); + + void updateUserPersonal(UserPersonalFileEntity personalFile); HashMap queryUserInfo(Integer id); } diff --git a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java index 45616bf..5b39367 100644 --- a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java @@ -12,6 +12,7 @@ import com.msdw.tms.entity.response.CommonCode; import com.msdw.tms.entity.response.ResponseResult; import com.msdw.tms.entity.response.ResultCode; import com.msdw.tms.service.UserInfoService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.HashMap; @@ -19,6 +20,8 @@ import java.util.Map; @Service("userInfoService") public class UserInfoServiceImpl extends ServiceImpl implements UserInfoService { + @Autowired + private UserInfoDao userInfoDao; @Override public PageUtils queryPage(Map params) { @@ -45,4 +48,8 @@ public R add(UserInfoEntity userInfoEntity) { return r; } } + @Override + public void updateUserInfoById(UserInfoEntity entity){ + userInfoDao.userInfupdateUserInfoById(entity); + } } diff --git a/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java index 92385ca..cd2a2cc 100644 --- a/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/UserServiceImpl.java @@ -8,6 +8,8 @@ import com.msdw.tms.common.utils.PageUtils; import com.msdw.tms.common.utils.Query; import com.msdw.tms.dao.UserDao; 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.UserProsonalEntityVo; import com.msdw.tms.service.UserService; @@ -43,8 +45,9 @@ public class UserServiceImpl extends ServiceImpl implements return vo; } + @Override - public void updateUserPersonal(UserEntityVo personalFile) { + public void updateUserPersonal(UserPersonalFileEntity personalFile) { userMapper.updateUserPersonal(personalFile); } diff --git a/src/main/resources/mapper/tms/UserDao.xml b/src/main/resources/mapper/tms/UserDao.xml index 01a0fbe..dded3a0 100644 --- a/src/main/resources/mapper/tms/UserDao.xml +++ b/src/main/resources/mapper/tms/UserDao.xml @@ -4,7 +4,7 @@ - SELECT u.userId, userName, @@ -41,7 +41,7 @@ AND s.isdel = 0 - SELECT per.personalFileId, per.schoolId, @@ -62,7 +62,7 @@ school s WHERE per.schoolId = s.schoolId - AND per.userId = #{userid} + AND per.userId = #{userId} AND s.isdel = 0 @@ -81,7 +81,7 @@ per.professionalClassName = #{professionalClassName}, per.updatetime = NOW() WHERE - per.userId = #{userid} + per.userId = #{userId} AND per.personalFileId = #{personalFileId} diff --git a/src/main/resources/mapper/tms/UserInfoDao.xml b/src/main/resources/mapper/tms/UserInfoDao.xml index 4297025..c181464 100644 --- a/src/main/resources/mapper/tms/UserInfoDao.xml +++ b/src/main/resources/mapper/tms/UserInfoDao.xml @@ -11,4 +11,45 @@ #{userName}, #{uniqueIdentificationAccount}, #{provinceId}, #{cityId}, #{schoolId},#{phone}, #{account},#{password},#{roleId}) + + + update hr_user_info + + + account = #{account}, + + + countries = #{countries}, + + + cityId = #{cityId}, + + + dateBirth = #{dateBirth}, + + + documenttype = #{documenttype}, + + + educationDegree = #{educationDegree}, + + + IDNumber = #{IDNumber}, + + + provinceId = #{provinceId}, + + + sex = #{sex}, + + + userName = #{userName}, + + + schoolId = #{schoolId}, + + + WHERE userId = #{userId}; + + \ No newline at end of file