Browse Source

1.人员信息添加bug修复。

zhengqiang 5 years ago
parent
commit
6315b6aa34

+ 13 - 13
common/src/main/resources/mapper/base/CompanyPosition.xml

@@ -28,18 +28,18 @@
 	    (id_,company_id,position1_name,position2_name,position3_name,position4_name,position5_name,create_by,create_time,update_by,update_time,del_flag)
 		values
 		(
-#{id,jdbcType=VARCHAR}
-,#{companyId,jdbcType=VARCHAR}
-,#{position1Name,jdbcType=VARCHAR}
-,#{position2Name,jdbcType=VARCHAR}
-,#{position3Name,jdbcType=VARCHAR}
-,#{position4Name,jdbcType=VARCHAR}
-,#{position5Name,jdbcType=VARCHAR}
-,#{createBy,jdbcType=VARCHAR}
-,#{createTime,jdbcType= TIMESTAMP }
-,#{updateBy,jdbcType=VARCHAR}
-,#{updateTime,jdbcType= TIMESTAMP }
-,#{delFlag,jdbcType= NUMERIC }
+			#{id,jdbcType=VARCHAR}
+			,#{companyId,jdbcType=VARCHAR}
+			,#{position1Name,jdbcType=VARCHAR}
+			,#{position2Name,jdbcType=VARCHAR}
+			,#{position3Name,jdbcType=VARCHAR}
+			,#{position4Name,jdbcType=VARCHAR}
+			,#{position5Name,jdbcType=VARCHAR}
+			,#{createBy,jdbcType=VARCHAR}
+			,#{createTime,jdbcType= TIMESTAMP }
+			,#{updateBy,jdbcType=VARCHAR}
+			,#{updateTime,jdbcType= TIMESTAMP }
+			,#{delFlag,jdbcType= NUMERIC }
 		)
 	]]>
 	</insert>
@@ -101,7 +101,7 @@
 		<where>
 			del_flag = 0
 			<if test="searchParams.companyId != null">
-				and company_id like #{searchParams.companyId}
+				and company_id = #{searchParams.companyId}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

+ 3 - 0
web/src/main/java/com/jpsoft/smart/modules/base/controller/CompanyInfoController.java

@@ -225,7 +225,9 @@ public class CompanyInfoController {
             searchParams1.put("companyId",destCompany.getId());
             List<Sort> sortList1 = new ArrayList<>();
             sortList1.add(new Sort("id_","asc"));
+
             Page<CompanyPosition> page1 = companyPositionService.pageSearch(searchParams1,1,1,false,sortList1);
+
             if(page1.size() > 0) {
                 companyPosition = page1.get(0);
                 companyPosition.setPosition1Name(companyInfoDTO.getPosition1Name());
@@ -238,6 +240,7 @@ public class CompanyInfoController {
                 companyPositionService.update(companyPosition);
                 affectCount++;
             }
+
             map.put("companyPosition",companyPosition);
 
 //            //更新设备人脸库

+ 19 - 14
web/src/main/java/com/jpsoft/smart/modules/base/controller/PersonInfoController.java

@@ -133,20 +133,25 @@ public class PersonInfoController {
 
             if (affectCount > 0) {
                 String personCompany = personInfo.getPersonCompany();
-                String[] pcs = personCompany.split(",");
-                PersonCompany classPersonCompany = null;
-                //查找新创建用户ID
-                personInfo = personInfoService.findByNameAndPhone(personInfo.getName(), personInfo.getPhone());
-                for(String pc : pcs){
-                    //添加
-                    classPersonCompany = new PersonCompany();
-                    classPersonCompany.setId(UUID.randomUUID().toString());
-                    classPersonCompany.setCompanyId(pc);
-                    classPersonCompany.setPersonId(personInfo.getId());
-                    classPersonCompany.setDelFlag(false);
-                    classPersonCompany.setCreateBy(subject);
-                    classPersonCompany.setCreateTime(new Date());
-                    personCompanyService.insert(classPersonCompany);
+
+                if(StringUtils.isNotEmpty(personCompany)) {
+                    String[] pcs = personCompany.split(",");
+                    PersonCompany classPersonCompany = null;
+
+                    //查找新创建用户ID
+                    personInfo = personInfoService.findByNameAndPhone(personInfo.getName(), personInfo.getPhone());
+
+                    for (String pc : pcs) {
+                        //添加
+                        classPersonCompany = new PersonCompany();
+                        classPersonCompany.setId(UUID.randomUUID().toString());
+                        classPersonCompany.setCompanyId(pc);
+                        classPersonCompany.setPersonId(personInfo.getId());
+                        classPersonCompany.setDelFlag(false);
+                        classPersonCompany.setCreateBy(subject);
+                        classPersonCompany.setCreateTime(new Date());
+                        personCompanyService.insert(classPersonCompany);
+                    }
                 }
 
                 msgResult.setResult(true);