Quellcode durchsuchen

修改根据用户名或姓名查询人员列表接口;
修改上级部门置空后,部门全路径没有正确更新的问题;

lixing vor 4 Jahren
Ursprung
Commit
28d32239fb

+ 3 - 0
fm-person/src/main/java/com/persagy/fm/department/service/impl/DepartmentServiceImpl.java

@@ -270,6 +270,9 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
                 fullPathAfterChange = getDepFullPathWhenParentIdChange(
                         nameAfterChange, parentIdAfterChange);
             }
+        } else if ("".equals(parentIdAfterChange)) {
+            // 如果是将上级部门置空
+            fullPathAfterChange = nameAfterChange;
         }
 
         return fullPathAfterChange;

+ 0 - 20
fm-person/src/main/java/com/persagy/fm/person/dao/PersonMapper.java

@@ -40,26 +40,6 @@ public interface PersonMapper extends BaseMapper<Person> {
     int queryCount(PageQueryPersonDTO pageQueryPersonDTO);
 
     /**
-     * 根据人员姓名或用户名查询人员列表
-     *
-     * @param pageQueryPersonDTO 分页查询条件
-     * @return 人员列表
-     * @author lixing
-     * @version V1.0 2021/4/14 5:53 下午
-     */
-    List<Person> queryPersonListByNameOrUserName(PageQueryPersonByNameOrUserNameDTO pageQueryPersonDTO);
-
-    /**
-     * 根据人员姓名或用户名查询人员数量
-     *
-     * @param pageQueryPersonDTO 分页查询条件
-     * @return 人员列表
-     * @author lixing
-     * @version V1.0 2021/4/14 5:53 下午
-     */
-    int queryCountByNameOrUserName(PageQueryPersonByNameOrUserNameDTO pageQueryPersonDTO);
-
-    /**
      * 快速查询人员姓名
      *
      * @param nameQuickSearchDTO 快速查询人员姓名入参

+ 8 - 3
fm-person/src/main/java/com/persagy/fm/person/service/impl/PersonServiceImpl.java

@@ -12,6 +12,7 @@ import com.persagy.fm.common.model.vo.SimpleObjVO;
 import com.persagy.fm.common.utils.ListUtil;
 import com.persagy.fm.department.model.vo.DepSimpleObjVO;
 import com.persagy.fm.department.service.IDepartmentService;
+import com.persagy.fm.depproject.model.DepProject;
 import com.persagy.fm.person.dao.PersonMapper;
 import com.persagy.fm.person.model.ConvertPersonTool;
 import com.persagy.fm.person.model.Person;
@@ -1289,10 +1290,14 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
 
     @Override
     public IPage<ResponsePersonListItemVO> pageQueryByNameOrUserName(PageQueryPersonByNameOrUserNameDTO pageQueryPersonDTO) {
-        List<Person> people = personMapper.queryPersonListByNameOrUserName(pageQueryPersonDTO);
-        int total = personMapper.queryCountByNameOrUserName(pageQueryPersonDTO);
+        QueryWrapper<Person> queryWrapper = getDefaultPersonQueryWrapper();
+        queryWrapper.like(Person.PROP_USERNAME, pageQueryPersonDTO.getName()).or(
+                wrapper -> wrapper.like(Person.PROP_NAME, pageQueryPersonDTO.getName())
+        );
+        IPage<Person> pageParam = new Page<>(pageQueryPersonDTO.getPage(), pageQueryPersonDTO.getSize(),true);
+        IPage<Person> result = getBaseMapper().selectPage(pageParam, queryWrapper);
 
-        return packagePageResult(people, total);
+        return packagePageResult(result.getRecords(), Integer.parseInt(String.valueOf(result.getTotal())));
     }
 
     @Override

+ 0 - 19
fm-person/src/main/resources/mapper/PersonMapper.xml

@@ -79,25 +79,6 @@
         p.name_pinyin
     </sql>
 
-    <select id="queryPersonListByNameOrUserName"
-            parameterType="com.persagy.fm.person.model.dto.PageQueryPersonByNameOrUserNameDTO"
-            resultType="com.persagy.fm.person.model.Person">
-        <include refid="selectPersonInfo"/>
-        <include refid="queryPersonByNameOrUsernameExpression"/>
-        <include refid="orderBy"/>
-        limit #{startIndex}, #{size}
-    </select>
-
-    <select id="queryCountByNameOrUserName"
-            parameterType="com.persagy.fm.person.model.dto.PageQueryPersonByNameOrUserNameDTO"
-            resultType="int">
-        select count(*) total
-        from person p,
-        work_resume w
-        <include refid="queryPersonByNameOrUsernameExpression"/>
-    </select>
-
-
     <select id="queryPersonList" parameterType="com.persagy.fm.person.model.dto.PageQueryPersonDTO"
             resultType="com.persagy.fm.person.model.Person">
         <include refid="selectPersonInfo"/>