whb 5 months ago
commit e0943292bb

@ -38,6 +38,6 @@ public class Constant {
public static final String THEORY = "理论考试模块";
public static final String RESOURCE = "资源中心模块";
public static final String API_URL = "http://120.79.54.255:8889";
// public static final String API_URL = "http://192.168.2.29:8889";
// public static final String API_URL = "http://192.168.2.44:8889";
}

@ -127,7 +127,10 @@ public class StuIndexController {
StuUserDto stuUserDto = new StuUserDto();
BeanUtils.copyProperties(stuUser, stuUserDto);
StuClass stuClass = stuClassMapper.selectByPrimaryKey(stuUser.getClassId());
StuClassExample example =new StuClassExample();
example.createCriteria().andClassIdEqualTo(stuUser.getClassId());
List<StuClass> stuClassList = stuClassMapper.selectByExample(example);
StuClass stuClass = stuClassList.get(0);
stuUserDto.setClassName(stuClass.getClassName());
stuUserDto.setIpPlace(sysLoginLogs.get(0).getIpAddress());
stuUserDto.setLastIP(sysLoginLogs.get(0).getLoginIp());

@ -154,9 +154,12 @@ public class TeaExamManageController {
list.add(s);
}
}
StuClassExample example =new StuClassExample();
example.createCriteria().andClassIdIn(list).andSystemOwnerEqualTo(systemOwner);
List<StuClass> stuClasslist = stuClassMapper.selectByExample(example);
String s = "";
for (String id : list) {
StuClass stuClass = stuClassMapper.selectByPrimaryKey(id);
for (StuClass stuClass : stuClasslist) {
s += stuClass.getClassName() + ",";
}
// 去掉最后一个逗号

@ -147,8 +147,9 @@ public class TeaGradeManageController {
@RequestParam String schoolId,
@ApiParam("学号或姓名搜索框") @RequestParam(required = false) String keyWord,
@RequestParam(required = false) String classId,
@RequestParam(required = false) String examManageId) {
List<TeaExamAndUserDto> list = getTeaExamAndUserDtos(schoolId, keyWord, classId, examManageId);
@RequestParam(required = false) String examManageId,
@RequestParam String systemOwner) {
List<TeaExamAndUserDto> list = getTeaExamAndUserDtos(schoolId, keyWord, classId, examManageId, systemOwner);
if (list == null || list.isEmpty()) {
return new ResultEntity<PageInfo<TeaExamAndUserDto>>(new PageInfo<>());
}
@ -211,7 +212,8 @@ public class TeaGradeManageController {
@AnonymousAccess
@PostMapping("/getClassByExamManageId")
@ApiOperation("考试模式--图表统计接口班级下拉框返回classID和班级名") //只显示新建实训时添加的班级
public ResultEntity<List<Map<String, String>>> getClassByExamManageId(@RequestParam String examManageId) {
public ResultEntity<List<Map<String, String>>> getClassByExamManageId(@RequestParam String examManageId,
@RequestParam String systemOwner) {
TeaAndStudentExamExample teaAndStudentExamExample = new TeaAndStudentExamExample();
teaAndStudentExamExample.createCriteria().andExamManageIdEqualTo(examManageId);
List<TeaAndStudentExam> teaAndStudentExams = teaAndStudentExamMapper.selectByExample(teaAndStudentExamExample);
@ -220,11 +222,18 @@ public class TeaGradeManageController {
if (!teaAndStudentExams.isEmpty()) {
TeaAndStudentExam teaAndStudentExam = teaAndStudentExams.get(0);
String classId = teaAndStudentExam.getClassId();
String[] split = classId.split(",");
for (String singleId : split) {
StuClass stuClass = stuClassMapper.selectByPrimaryKey(singleId);
List<String> idlist = Arrays.asList(split);
StuClassExample example = new StuClassExample();
example.createCriteria().andClassIdIn(idlist).andSystemOwnerEqualTo(systemOwner);
List<StuClass> stuClassList = stuClassMapper.selectByExample(example);
for (StuClass stuClass : stuClassList) {
String className = stuClass.getClassName();
map.put(singleId, className);
map.put(stuClass.getId(), className);
}
list.add(map);
}
@ -311,8 +320,9 @@ public class TeaGradeManageController {
@RequestParam String schoolId,
@ApiParam("学号或姓名搜索框") @RequestParam(required = false) String keyWord,
@RequestParam(required = false) String classId,
@RequestParam(required = false) String examManageId) {
List<TeaExamAndUserDto> list = getTeaExamAndUserDtos(schoolId, keyWord, classId, examManageId);
@RequestParam(required = false) String examManageId,
@RequestParam String systemOwner) {
List<TeaExamAndUserDto> list = getTeaExamAndUserDtos(schoolId, keyWord, classId, examManageId, systemOwner);
list.sort(new TeaGradeManageServiceImpl.StuUserDtoComparator()); //比较器按得分排序
int i = 0;
@ -335,11 +345,11 @@ public class TeaGradeManageController {
}
private List<TeaExamAndUserDto> getTeaExamAndUserDtos(String schoolId, String keyWord, String classId, String examManageId) {
private List<TeaExamAndUserDto> getTeaExamAndUserDtos(String schoolId, String keyWord, String classId, String examManageId, String systemOwner) {
List<TeaExamAndUserDto> list = new ArrayList<>();
// 批量查询用户信息
List<StuUser> stuUsers = userMapper.selectTeaExamAndUserDtos(schoolId, keyWord, classId);
List<StuUser> stuUsers = userMapper.selectTeaExamAndUserDtos(schoolId, keyWord, classId, systemOwner);
// 构建用户id列表
List<String> userIds = stuUsers.stream()
@ -371,7 +381,9 @@ public class TeaGradeManageController {
Map<String, StuStudentExamWithBLOBs> userExamMap = stuStudentExams.stream()
.collect(Collectors.toMap(StuStudentExamWithBLOBs::getUserid, Function.identity()));
List<StuClass> stuClass = stuClassMapper.getByPrimaryKeys(classIds);
StuClassExample example = new StuClassExample();
example.createCriteria().andClassIdIn(classIds).andSystemOwnerEqualTo(systemOwner);
List<StuClass> stuClass = stuClassMapper.selectByExample(example);
// 构建班级ID与班级对象的映射关系
Map<String, StuClass> classMap = stuClass.stream()
@ -382,9 +394,12 @@ public class TeaGradeManageController {
TeaExamAndUserDto teaExamAndUserDto = new TeaExamAndUserDto();
teaExamAndUserDto.setName(stuUser.getName());
teaExamAndUserDto.setStudentId(stuUser.getStudentId());
// 从映射关系中获取班级对象
if (classMap.get(stuUser.getClassId())==null){
continue;
}
StuClass classdata = classMap.get(stuUser.getClassId());
teaExamAndUserDto.setClassName(classdata.getClassName());
StuStudentExamWithBLOBs stuStudentExam = userExamMap.get(stuUser.getUserid());
@ -471,7 +486,10 @@ public class TeaGradeManageController {
StuUser user = userMapper.selectByPrimaryKey(trainingReport.getUserId());
trainingReportDto.setName(user.getName());
trainingReportDto.setStudentId(user.getStudentId());
StuClass stuClass = stuClassMapper.selectByPrimaryKey(user.getClassId());
StuClassExample example = new StuClassExample();
example.createCriteria().andClassIdEqualTo(user.getClassId());
List<StuClass> stuClassList = stuClassMapper.selectByExample(example);
StuClass stuClass = stuClassList.get(0);
trainingReportDto.setClassName(stuClass.getClassName());
list.add(trainingReportDto);
}

@ -227,11 +227,12 @@ public class UserController {
for (int i = 0; i < zyUserInfoList.size(); i++) {
StuClass stuClass = new StuClass();
ZYUserInfo zyUserInfo = zyUserInfoList.get(i);
Integer roleId = zyUserInfo.getRoleId(); //3教师 4学生
Integer zyUserId = zyUserInfo.getUserId();
String username = zyUserInfo.getUsername(); // studentid
String name = zyUserInfo.getName();
String password = zyUserInfo.getPassword();
Integer roleId = zyUserInfo.getRoleId(); //3教师 4学生
StuUserExample example = new StuUserExample();
example.createCriteria().andZyUseridEqualTo(zyUserId).andSystemOnwerEqualTo(systemOwner);
@ -261,10 +262,12 @@ public class UserController {
users.add(stuUser);
if (roleId == 4) {
stuClass.setId(IdUtil.randomUUID());
stuClass.setClassId(zyUserInfo.getClassId().toString());
stuClass.setClassName(zyUserInfo.getClassName());
stuClass.setSchoolName(zyUserInfo.getSchoolName());
stuClass.setCreateTime(new Date());
stuClass.setSystemOwner(systemOwner);
map.put(zyUserInfo.getClassId().toString(), stuClass);
}
}

@ -10,6 +10,8 @@ import io.swagger.annotations.ApiModelProperty;
* stu_class
*/
public class StuClass {
private String id;
private String classId;
@ApiModelProperty("班级名称")
@ -24,6 +26,14 @@ public class StuClass {
@ApiModelProperty("归属系统")
private String systemOwner;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getClassId() {
return classId;
}

@ -105,6 +105,76 @@ public class StuClassExample {
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andClassIdIsNull() {
addCriterion("class_id is null");
return (Criteria) this;
@ -374,6 +444,76 @@ public class StuClassExample {
addCriterion("school_name not between", value1, value2, "schoolName");
return (Criteria) this;
}
public Criteria andSystemOwnerIsNull() {
addCriterion("system_owner is null");
return (Criteria) this;
}
public Criteria andSystemOwnerIsNotNull() {
addCriterion("system_owner is not null");
return (Criteria) this;
}
public Criteria andSystemOwnerEqualTo(String value) {
addCriterion("system_owner =", value, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerNotEqualTo(String value) {
addCriterion("system_owner <>", value, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerGreaterThan(String value) {
addCriterion("system_owner >", value, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerGreaterThanOrEqualTo(String value) {
addCriterion("system_owner >=", value, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerLessThan(String value) {
addCriterion("system_owner <", value, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerLessThanOrEqualTo(String value) {
addCriterion("system_owner <=", value, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerLike(String value) {
addCriterion("system_owner like", value, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerNotLike(String value) {
addCriterion("system_owner not like", value, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerIn(List<String> values) {
addCriterion("system_owner in", values, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerNotIn(List<String> values) {
addCriterion("system_owner not in", values, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerBetween(String value1, String value2) {
addCriterion("system_owner between", value1, value2, "systemOwner");
return (Criteria) this;
}
public Criteria andSystemOwnerNotBetween(String value1, String value2) {
addCriterion("system_owner not between", value1, value2, "systemOwner");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

@ -15,7 +15,7 @@ public interface StuClassMapper {
int deleteByExample(StuClassExample example);
int deleteByPrimaryKey(String classId);
int deleteByPrimaryKey(String id);
int insert(StuClass record);
@ -23,7 +23,7 @@ public interface StuClassMapper {
List<StuClass> selectByExample(StuClassExample example);
StuClass selectByPrimaryKey(String classId);
StuClass selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") StuClass record, @Param("example") StuClassExample example);
@ -40,7 +40,7 @@ public interface StuClassMapper {
@Select("SELECT s.class_name FROM stu_class s, stu_userinfo u WHERE s.class_id = u.class_id and s.class_id = #{classId};")
String selectClassNameByClassId(@Param("classId")String classId);
List<StuClass> selectByPrimaryKeys(@Param("classIds") Set<String> classIds);
List<StuClass> getByPrimaryKeys(@Param("classIds") List<String> classIds);
// List<StuClass> selectByPrimaryKeys(@Param("classIds") Set<String> classIds);
//
// List<StuClass> getByPrimaryKeys(@Param("classIds") List<String> classIds);
}

@ -66,7 +66,10 @@ public interface StuUserMapper {
"</script>")
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> selectTeaExamAndUserDtos(@Param("schoolId")String schoolId,
@Param("keyWord") String keyWord,
@Param("classId")String classId,
@Param("systemOwner")String systemOwner);
List<StuUser> getByNameAndStudentID(@Param("schoolId")String schoolId,
@Param("keyWord") String keyWord,

@ -298,7 +298,12 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
// 批量获取班级信息
Set<String> classIds = stuUsers.stream().map(StuUser::getClassId).collect(Collectors.toSet());
List<StuClass> stuClasses = classMapper.selectByPrimaryKeys(classIds);
StuClassExample example =new StuClassExample();
List<String> IDlist = new ArrayList<>(classIds);
example.createCriteria().andClassIdIn(IDlist).andSystemOwnerEqualTo(systemOwner);
List<StuClass> stuClasses = classMapper.selectByExample(example);
Map<String, String> classIdToNameMap = stuClasses.stream().collect(Collectors.toMap(StuClass::getClassId, StuClass::getClassName));
// 批量获取实训记录

@ -42,7 +42,7 @@
<property name="enableSubPackages" value="true"/>
</javaClientGenerator>
<!-- 需要生成的表 -->
<!-- <table tableName="stu_class" domainObjectName="StuClass" />-->
<table tableName="stu_class" domainObjectName="StuClass" />
<!-- <table tableName="stu_error" domainObjectName="StuError" />-->
<!-- <table tableName="stu_exam_case" domainObjectName="StuExamCase" />-->
<!-- <table tableName="stu_student_exam" domainObjectName="StuStudentExam" />-->
@ -55,7 +55,7 @@
<!-- <table tableName="sys_course_chapter" domainObjectName="SysCourseChapter" />-->
<!-- <table tableName="sys_log" domainObjectName="SysLog" />-->
<!-- <table tableName="sys_objective_question" domainObjectName="SysObjectiveQuestion" />-->
<table tableName="tea_exam_manage" domainObjectName="TeaExamManage" />
<!-- <table tableName="tea_exam_manage" domainObjectName="TeaExamManage" />-->
<!-- <table tableName="tea_learning_statistics" domainObjectName="TeaLearningStatistics" />-->
<!-- <table tableName="tea_resource_center" domainObjectName="TeaResourceCenter" />-->
<!-- <table tableName="training_report" domainObjectName="TrainingReport" />-->

@ -2,7 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sztzjy.financial_bigdata.mapper.StuClassMapper">
<resultMap id="BaseResultMap" type="com.sztzjy.financial_bigdata.entity.StuClass">
<id column="class_id" jdbcType="VARCHAR" property="classId" />
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="class_id" jdbcType="VARCHAR" property="classId" />
<result column="class_name" jdbcType="VARCHAR" property="className" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="school_name" jdbcType="VARCHAR" property="schoolName" />
@ -67,7 +68,7 @@
</where>
</sql>
<sql id="Base_Column_List">
class_id, class_name, create_time, school_name, system_owner
id, class_id, class_name, create_time, school_name, system_owner
</sql>
<select id="selectByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample" resultMap="BaseResultMap">
select
@ -87,11 +88,11 @@
select
<include refid="Base_Column_List" />
from stu_class
where class_id = #{classId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from stu_class
where class_id = #{classId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="com.sztzjy.financial_bigdata.entity.StuClassExample">
delete from stu_class
@ -100,14 +101,19 @@
</if>
</delete>
<insert id="insert" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
insert into stu_class (class_id, class_name, create_time,
school_name, system_owner)
values (#{classId,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{schoolName,jdbcType=VARCHAR}, #{systemOwner,jdbcType=VARCHAR})
insert into stu_class (id, class_id, class_name,
create_time, school_name, system_owner
)
values (#{id,jdbcType=VARCHAR}, #{classId,jdbcType=VARCHAR}, #{className,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{schoolName,jdbcType=VARCHAR}, #{systemOwner,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
insert into stu_class
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="classId != null">
class_id,
</if>
@ -125,6 +131,9 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="classId != null">
#{classId,jdbcType=VARCHAR},
</if>
@ -151,6 +160,9 @@
<update id="updateByExampleSelective" parameterType="map">
update stu_class
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.classId != null">
class_id = #{record.classId,jdbcType=VARCHAR},
</if>
@ -173,7 +185,8 @@
</update>
<update id="updateByExample" parameterType="map">
update stu_class
set class_id = #{record.classId,jdbcType=VARCHAR},
set id = #{record.id,jdbcType=VARCHAR},
class_id = #{record.classId,jdbcType=VARCHAR},
class_name = #{record.className,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
school_name = #{record.schoolName,jdbcType=VARCHAR},
@ -185,6 +198,9 @@
<update id="updateByPrimaryKeySelective" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
update stu_class
<set>
<if test="classId != null">
class_id = #{classId,jdbcType=VARCHAR},
</if>
<if test="className != null">
class_name = #{className,jdbcType=VARCHAR},
</if>
@ -198,32 +214,33 @@
system_owner = #{systemOwner,jdbcType=VARCHAR},
</if>
</set>
where class_id = #{classId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.sztzjy.financial_bigdata.entity.StuClass">
update stu_class
set class_name = #{className,jdbcType=VARCHAR},
set class_id = #{classId,jdbcType=VARCHAR},
class_name = #{className,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
school_name = #{schoolName,jdbcType=VARCHAR},
system_owner = #{systemOwner,jdbcType=VARCHAR}
where class_id = #{classId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<select id="selectByPrimaryKeys" parameterType="java.util.Set" resultMap="BaseResultMap">
SELECT *
FROM stu_class
WHERE class_id IN
<foreach close=")" collection="classIds" item="classId" open="(" separator=",">
#{classId}
</foreach>
</select>
<!-- <select id="selectByPrimaryKeys" parameterType="java.util.Set" resultMap="BaseResultMap">-->
<!-- SELECT *-->
<!-- FROM stu_class-->
<!-- WHERE id IN-->
<!-- <foreach close=")" collection="classIds" item="classId" open="(" separator=",">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </select>-->
<select id="getByPrimaryKeys" parameterType="java.util.List" resultMap="BaseResultMap">
SELECT *
FROM stu_class
WHERE class_id IN
<foreach close=")" collection="classIds" item="classId" open="(" separator=",">
#{classId}
</foreach>
</select>
<!-- <select id="getByPrimaryKeys" parameterType="java.util.List" resultMap="BaseResultMap">-->
<!-- SELECT *-->
<!-- FROM stu_class-->
<!-- WHERE id IN-->
<!-- <foreach close=")" collection="classIds" item="classId" open="(" separator=",">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </select>-->
</mapper>

@ -452,7 +452,8 @@
<select id="selectTeaExamAndUserDtos" resultMap="BaseResultMap">
select * from stu_userinfo u
where
u.role_id = 4
system_onwer =#{systemOwner}
AND u.role_id = 4
AND u.school_id = #{schoolId}
<if test="keyWord != null and keyWord!=''">
AND student_id like CONCAT ('%',#{keyWord},'%') or name like CONCAT ('%',#{keyWord},'%')

Loading…
Cancel
Save