修改模糊查询

master
xiaoCJ 7 months ago
parent 9b1168fb27
commit 0f35db6405

@ -82,7 +82,7 @@ public class TeaGradeManageController {
List<TeaExamManage> teaExamManages = teaExamManageMapper.selectBySchoolIdAndSystemOwner(schoolId, systemOwner);
if (teaExamManages == null || teaExamManages.isEmpty()) {
return new ResultEntity<>(new PageInfo<>());
return null;
}
List<TeaExamManageCountDto> teaExamManageCountDtos = new ArrayList<>();
Map<String, StuUser> userMap = new HashMap<>();

@ -67,4 +67,9 @@ public interface StuUserMapper {
List<StuUser> selectByPrimaryKeys(@Param("userIds") List<String> userIds);
List<StuUser> selectTeaExamAndUserDtos(@Param("schoolId")String schoolId,@Param("keyWord") String keyWord, @Param("classId")String classId);
List<StuUser> getByNameAndStudentID(@Param("schoolId")String schoolId,
@Param("keyWord") String keyWord,
@Param("classId")String classId,
@Param("systemOwner") String systemOwner);
}

@ -289,20 +289,9 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
private List<TeaTrainingInfoDTO> getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId, String systemOwner) {
StuUserExample userExample = new StuUserExample();
StuUserExample.Criteria criteria = userExample.createCriteria();
criteria.andSchoolIdEqualTo(schoolId).andRoleIdEqualTo(4).andSystemOnwerEqualTo(systemOwner);
if (StringUtils.isNotBlank(classId)) {
criteria.andClassIdEqualTo(classId);
}
if (StringUtils.isNotBlank(keyWord)) {
userExample.or().andSchoolIdEqualTo(schoolId).andStudentIdEqualTo(keyWord);
userExample.or().andSchoolIdEqualTo(schoolId).andNameEqualTo(keyWord);
}
List<StuUser> stuUsers =userMapper.getByNameAndStudentID(schoolId,keyWord,classId,systemOwner);
// 查询学生用户列表
List<StuUser> stuUsers = userMapper.selectByExample(userExample);
if (stuUsers.isEmpty()) {
return Collections.emptyList();
}

@ -409,7 +409,8 @@
role_id,create_time,school_id,school_name,status) VALUES
<foreach collection="list" item="student" separator=",">
(#{student.userid}, #{student.name}, #{student.studentId}, #{student.classId}, #{student.username},
#{student.password}, #{student.phone}, #{student.email},#{student.major},#{student.zyUserid},#{student.systemOnwer},#{student.roleId},
#{student.password}, #{student.phone},
#{student.email},#{student.major},#{student.zyUserid},#{student.systemOnwer},#{student.roleId},
#{student.createTime},#{student.schoolId},#{student.schoolName},#{student.status})
</foreach>
</insert>
@ -454,7 +455,7 @@
u.role_id = 4
AND u.school_id = #{schoolId}
<if test="keyWord != null and keyWord!=''">
AND (u.name = #{keyWord} OR u.student_id = #{keyWord})
AND student_id like CONCAT ('%',#{keyWord},'%') or name like CONCAT ('%',#{keyWord},'%')
</if>
<if test="classId != null and classId !=''">
AND u.class_id = #{classId}
@ -476,5 +477,22 @@
)GROUP BY class_id ) AS subquery;
</select>
<select id="getByNameAndStudentID" resultMap="BaseResultMap">
SELECT *
FROM stu_userinfo
<where>
system_onwer =#{systemOwner}
and role_id = 4
<if test="classId != null and classId != ''">
class_id = #{classId}
</if>
<if test="schoolId != null and schoolId != ''">
AND school_id = #{schoolId}
</if>
<if test="keyWord != null and keyWord != ''">
AND student_id like CONCAT ('%',#{keyWord},'%') or name like CONCAT ('%',#{keyWord},'%')
</if>
</where>
</select>
</mapper>
Loading…
Cancel
Save