Browse Source

修改 organization/user/page

COMPANYCOMPUTER\10625 11 months ago
parent
commit
bba31e4294

+ 22 - 0
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -85,6 +85,7 @@ import com.xjrsoft.module.organization.vo.UserStudentInfoVo;
 import com.xjrsoft.module.organization.vo.UserStudentVo;
 import com.xjrsoft.module.organization.vo.UserVo;
 import com.xjrsoft.module.oss.factory.OssFactory;
+import com.xjrsoft.module.student.entity.BaseStudent;
 import com.xjrsoft.module.student.entity.BaseStudentSchoolRoll;
 import com.xjrsoft.module.student.entity.BaseStudentUser;
 import com.xjrsoft.module.student.service.IBaseStudentSchoolRollService;
@@ -231,6 +232,16 @@ public class UserController {
                     .leftJoin(DictionaryDetail.class, "d1", DictionaryDetail::getCode, BaseTeacher::getEmployWay)
                     .leftJoin(DictionaryDetail.class, "d2", DictionaryDetail::getCode, BaseTeacher::getEmployType)
                     .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId);
+
+            if(ObjectUtil.isNotNull(dto.getUserType())) {
+                if (dto.getUserType() == 2) {
+                    queryUser.eq(BaseTeacher::getIsNormal, 1);
+                }
+                if (dto.getUserType() == 3) {
+                    queryUser.leftJoin(BaseStudent.class, BaseStudent::getUserId, User::getId)
+                            .eq(BaseStudent::getIsNormal, 1);
+                }
+            }
             IPage<UserPageVo> page = userService.selectJoinListPage(ConventPage.getPage(dto), UserPageVo.class, queryUser);
             for (UserPageVo record : page.getRecords()) {
                 record.setGenderCn(GenderDictionaryEnum.getValue(record.getGender()));
@@ -283,6 +294,17 @@ public class UserController {
                             .leftJoin(DictionaryDetail.class, "d1", DictionaryDetail::getCode, BaseTeacher::getEmployWay)
                             .leftJoin(DictionaryDetail.class, "d2", DictionaryDetail::getCode, BaseTeacher::getEmployType)
                             .leftJoin(Role.class, Role::getId, UserRoleRelation::getRoleId);
+
+            if(ObjectUtil.isNotNull(dto.getUserType())) {
+                if (dto.getUserType() == 2) {
+                    queryUser.eq(BaseTeacher::getIsNormal, 1);
+                }
+                if (dto.getUserType() == 3) {
+                    queryUser.leftJoin(BaseStudent.class, BaseStudent::getUserId, User::getId)
+                            .eq(BaseStudent::getIsNormal, 1);
+                }
+            }
+
             IPage<UserPageVo> page = userService.selectJoinListPage(ConventPage.getPage(dto), UserPageVo.class,queryUser);
             for (UserPageVo record : page.getRecords()) {
                 record.setGenderCn(GenderDictionaryEnum.getValue(record.getGender()));

+ 9 - 0
src/main/resources/mapper/organization/UserMapper.xml

@@ -7,6 +7,12 @@
         SELECT DISTINCT t1.*,t3.name AS gender_cn FROM xjr_user t1
         INNER JOIN xjr_user_role_relation t2 ON t2.user_id = t1.id
         LEFT JOIN xjr_dictionary_detail t3 ON t1.gender = t3.code
+        <if test="dto.roleId != null and dto.roleId=='2'">
+            INNER JOIN base_teacher t4 on t1.id=t4.user_id
+        </if>
+        <if test="dto.roleId != null and dto.roleId=='3'">
+            INNER JOIN base_student t4 on t1.id=t4.user_id
+        </if>
         WHERE t1.delete_mark = 0
         <if test="dto.keyword != null and dto.keyword !=''">
             and (t1.name like concat('%', #{dto.keyword}, '%') or t1.mobile like concat('%', #{dto.keyword}, '%'))
@@ -14,6 +20,9 @@
         <if test="dto.roleId != null">
             and t2.role_id = #{dto.roleId}
         </if>
+        <if test="dto.roleId != null and (dto.roleId=='2' or dto.roleId=='3')">
+            and t4.delete_mark = 0 AND t4.is_normal = 1
+        </if>
     </select>
     <select id="getInfosByParam" parameterType="com.xjrsoft.module.student.dto.BaseStudentSimpleInfoDto" resultType="com.xjrsoft.module.student.vo.BaseStudentSompleInfoVo">
         SELECT t1.id, t1.name as student_name, t1.enabled_mark, t1.credential_number, t4.name AS class_name,t1.mobile,