user4 hace 5 años
padre
commit
2db8370df7

+ 7 - 1
src/main/java/com/jeeplus/modules/sys/dao/UserDao.java

@@ -223,5 +223,11 @@ public interface UserDao extends CrudDao<User> {
 
     int insertRole(WorkStaffBasicInfo workStaffBasicInfo);
     int updateRole(WorkStaffBasicInfo workStaffBasicInfo);
-    int updateUserName(User user);
+
+	/**
+	 * 修改的属性,同步到sys_user
+	 * @param user
+	 * @return
+	 */
+	int updateUser(User user);
 }

+ 7 - 2
src/main/java/com/jeeplus/modules/sys/service/UserService.java

@@ -401,7 +401,12 @@ public class UserService extends BaseController {
         userDao.updateRole(workStaffBasicInfo);
     }
 
-    public void updateUserName(User user){
-        userDao.updateUserName(user);
+
+    /**
+     * 更新sys_user 的not null属性
+     * @param user
+     */
+    public void updateUser(User user){
+        userDao.updateUser(user);
     }
 }

+ 7 - 5
src/main/java/com/jeeplus/modules/workstaff/service/WorkStaffBasicInfoService.java

@@ -179,13 +179,15 @@ public class WorkStaffBasicInfoService extends CrudService<WorkStaffBasicInfoDao
         User user = new User();
         user.setId(workStaffBasicInfo.getUserId());
         user.setName(workStaffBasicInfo.getName());
-        if (userService.get(user.getId())!=null){
-            userService.updateUserName(user);
-        }
-
-        if(roleService.getRoleIdByUserId(user.getId())==null){
+        user.setMobile(workStaffBasicInfo.getMobile());
+        user.setLoginName(workStaffBasicInfo.getMobile());
+        user.setComId(workStaffBasicInfo.getCompany().getId());
+        user.setCompany(workStaffBasicInfo.getCompany());
+        user.setOffice(workStaffBasicInfo.getOffice());
+        if(workStaffBasicInfo.getIsNewRecord()){
             userService.insertRole(workStaffBasicInfo);
         }else{
+            userService.updateUser(user);
             userService.updateRole(workStaffBasicInfo);
         }
 

+ 49 - 3
src/main/resources/mappings/modules/sys/UserDao.xml

@@ -1057,9 +1057,55 @@
     <update id="updateUserCompanyId">
         UPDATE sys_user SET  com_id = '1',company_id = '1',office_id='5' WHERE company_id=#{companyId}
     </update>
-	<update id="updateUserName" parameterType="User" >
-		update sys_user
-		set name = #{name}
+
+	<update id="updateUser">
+		update  sys_user
+		<set>
+			<if test="loginName != null and loginName != ''">
+				loginName = #{loginName},
+			</if>
+			<if test="passwordRemake != null and passwordRemake != ''">
+				passwordRemake = #{passwordRemake},
+			</if>
+			<if test="name != null and name != ''">
+				name = #{name},
+			</if>
+			<if test="sex != null and sex != ''">
+				sex = #{sex},
+			</if>
+			<if test="email != null and email != ''">
+				email = #{email},
+			</if>
+			<if test="phone != null and phone != ''">
+				phone = #{phone},
+			</if>
+			<if test="mobile != null and mobile != ''">
+				mobile = #{mobile},
+			</if>
+			<if test="userType != null and userType != ''">
+				userType = #{userType},
+			</if>
+			<if test="remarks != null and remarks != ''">
+				remarks = #{remarks},
+			</if>
+			<if test="delFlag != null and delFlag != ''">
+				del_Flag = #{delFlag},
+			</if>
+			<if test="photo != null and photo != ''">
+				photo = #{photo},
+			</if>
+			<if test="comId != null and comId != ''">
+				com_id = #{comId},
+			</if>
+			<if test="company.id != null and company.id != ''">
+				company_id = #{company.id},
+			</if>
+			<if test="office.id != null and office.id != ''">
+				office_id = #{office.id}
+			</if>
+		</set>
 		where id = #{id}
 	</update>
+
+
 </mapper>

+ 1 - 1
src/main/webapp/webpage/modules/workstaff/workStaffBasicDetailModifyDirectly.jsp

@@ -1812,7 +1812,7 @@
     function delRow(obj, prefix){
         var delFlag = $(prefix+"_delFlag");
         delFlag.val("1");
-        $(obj).parent().parent().remove();
+        $(obj).parent().parent().hide();
     }
 
 </script>