|
|
@@ -0,0 +1,197 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8" ?>
|
|
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
+<mapper namespace="org.dromara.zsjy.mapper.InternshipInfoMapper">
|
|
|
+
|
|
|
+ <!-- 实习信息结果映射 -->
|
|
|
+ <resultMap type="org.dromara.zsjy.domain.vo.InternshipInfoVO" id="InternshipInfoVOResult">
|
|
|
+ <id property="studentId" column="student_id" />
|
|
|
+ <result property="studentNo" column="student_no" />
|
|
|
+ <result property="studentName" column="student_name" />
|
|
|
+ <result property="gender" column="gender" />
|
|
|
+ <result property="phone" column="phone" />
|
|
|
+ <result property="classId" column="class_id" />
|
|
|
+ <result property="className" column="class_name" />
|
|
|
+ <result property="grade" column="grade" />
|
|
|
+ <result property="collegeName" column="college_name" />
|
|
|
+ <result property="majorName" column="major_name" />
|
|
|
+ <result property="counselorName" column="counselor_name" />
|
|
|
+ <result property="classTeacherName" column="class_teacher_name" />
|
|
|
+ <result property="internshipId" column="internship_id" />
|
|
|
+ <result property="internshipStatus" column="internship_status" />
|
|
|
+ <result property="companyName" column="company_name" />
|
|
|
+ <result property="companyAddress" column="company_address" />
|
|
|
+ <result property="internshipPosition" column="internship_position" />
|
|
|
+ <result property="internshipAllowance" column="internship_allowance" />
|
|
|
+ <result property="internshipStartDate" column="internship_start_date" />
|
|
|
+ <result property="internshipEndDate" column="internship_end_date" />
|
|
|
+ <result property="contactPersonName" column="contact_person_name" />
|
|
|
+ <result property="contactPersonPhone" column="contact_person_phone" />
|
|
|
+ <result property="agreementStatus" column="agreement_status" />
|
|
|
+ <result property="remark" column="remark" />
|
|
|
+ <result property="createBy" column="create_by" />
|
|
|
+ <result property="createTime" column="create_time" />
|
|
|
+ <result property="updateBy" column="update_by" />
|
|
|
+ <result property="updateTime" column="update_time" />
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <!-- 基础SQL片段 -->
|
|
|
+ <sql id="selectInternshipInfoVo">
|
|
|
+ SELECT
|
|
|
+ s.id as student_id,
|
|
|
+ s.student_no,
|
|
|
+ s.name as student_name,
|
|
|
+ s.gender,
|
|
|
+ s.phone,
|
|
|
+ s.class_id,
|
|
|
+ s.class_name,
|
|
|
+ s.grade,
|
|
|
+ s.college_name,
|
|
|
+ s.major_name,
|
|
|
+ s.counselor_name,
|
|
|
+ s.class_teacher_name,
|
|
|
+ c.class_teacher_id,
|
|
|
+ c.counselor_id,
|
|
|
+ i.internship_id as internship_id,
|
|
|
+ i.internship_status,
|
|
|
+ i.company_name,
|
|
|
+ i.company_address,
|
|
|
+ i.position_name as internship_position,
|
|
|
+ i.internship_allowance,
|
|
|
+ i.start_date as internship_start_date,
|
|
|
+ i.end_date as internship_end_date,
|
|
|
+ i.company_contact as contact_person_name,
|
|
|
+ i.company_phone as contact_person_phone,
|
|
|
+ i.status as agreement_status,
|
|
|
+ COALESCE(i.remark, s.remark) as remark,
|
|
|
+ COALESCE(i.create_by, s.create_by) as create_by,
|
|
|
+ COALESCE(i.create_time, s.create_time) as create_time,
|
|
|
+ COALESCE(i.update_by, s.update_by) as update_by,
|
|
|
+ COALESCE(i.update_time, s.update_time) as update_time
|
|
|
+ FROM xg_student_msg s
|
|
|
+ LEFT JOIN xg_class_msg c ON s.class_id = c.id AND c.tenant_id = '000000'
|
|
|
+ LEFT JOIN zsjy_internship_info i ON s.id = i.student_id AND i.deleted = 0 AND i.tenant_id = '000000'
|
|
|
+ WHERE s.deleted = 0
|
|
|
+ AND c.deleted = 0
|
|
|
+ AND s.student_status = '1'
|
|
|
+ AND s.tenant_id = '000000'
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 查询条件SQL片段 -->
|
|
|
+ <sql id="selectInternshipInfoWhere">
|
|
|
+ <if test="queryBO.studentNo != null and queryBO.studentNo != ''">
|
|
|
+ AND s.student_no LIKE CONCAT('%', #{queryBO.studentNo}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.studentName != null and queryBO.studentName != ''">
|
|
|
+ AND s.name LIKE CONCAT('%', #{queryBO.studentName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.classId != null and queryBO.classId != ''">
|
|
|
+ AND s.class_id = #{queryBO.classId}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.className != null and queryBO.className != ''">
|
|
|
+ AND s.class_name LIKE CONCAT('%', #{queryBO.className}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.grade != null and queryBO.grade != ''">
|
|
|
+ AND s.grade = #{queryBO.grade}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.collegeName != null and queryBO.collegeName != ''">
|
|
|
+ AND s.college_name LIKE CONCAT('%', #{queryBO.collegeName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.majorName != null and queryBO.majorName != ''">
|
|
|
+ AND s.major_name LIKE CONCAT('%', #{queryBO.majorName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.gender != null and queryBO.gender != ''">
|
|
|
+ AND s.gender = #{queryBO.gender}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.internshipStatus != null and queryBO.internshipStatus != ''">
|
|
|
+ <choose>
|
|
|
+ <when test="queryBO.internshipStatus == 'null'">
|
|
|
+ AND i.internship_status IS NULL
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND i.internship_status = #{queryBO.internshipStatus}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.companyName != null and queryBO.companyName != ''">
|
|
|
+ AND i.company_name LIKE CONCAT('%', #{queryBO.companyName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.companyAddress != null and queryBO.companyAddress != ''">
|
|
|
+ AND i.company_address LIKE CONCAT('%', #{queryBO.companyAddress}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.internshipPosition != null and queryBO.internshipPosition != ''">
|
|
|
+ AND i.internship_position LIKE CONCAT('%', #{queryBO.internshipPosition}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.agreementStatus != null and queryBO.agreementStatus != ''">
|
|
|
+ AND i.agreement_status = #{queryBO.agreementStatus}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.internshipStartDateBegin != null">
|
|
|
+ AND i.internship_start_date >= #{queryBO.internshipStartDateBegin}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.internshipStartDateEnd != null">
|
|
|
+ AND i.internship_start_date <= #{queryBO.internshipStartDateEnd}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.internshipEndDateBegin != null">
|
|
|
+ AND i.internship_end_date >= #{queryBO.internshipEndDateBegin}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.internshipEndDateEnd != null">
|
|
|
+ AND i.internship_end_date <= #{queryBO.internshipEndDateEnd}
|
|
|
+ </if>
|
|
|
+ <!-- 数据权限控制:班主任只能查看自己班级的学生 -->
|
|
|
+ <if test="queryBO.classTeacherId != null">
|
|
|
+ AND c.class_teacher_id = #{queryBO.classTeacherId}
|
|
|
+ </if>
|
|
|
+ <if test="queryBO.counselorId != null">
|
|
|
+ AND c.counselor_id = #{queryBO.counselorId}
|
|
|
+ </if>
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <!-- 查询学生实习信息列表 -->
|
|
|
+ <select id="selectInternshipInfoList" parameterType="org.dromara.zsjy.domain.bo.InternshipInfoQueryBO"
|
|
|
+ resultMap="InternshipInfoVOResult">
|
|
|
+ <include refid="selectInternshipInfoVo"/>
|
|
|
+ <include refid="selectInternshipInfoWhere"/>
|
|
|
+ ORDER BY s.class_name, s.student_no
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 根据学生ID查询实习信息详情 -->
|
|
|
+ <select id="selectInternshipInfoById" parameterType="Long" resultMap="InternshipInfoVOResult">
|
|
|
+ <include refid="selectInternshipInfoVo"/>
|
|
|
+ AND s.id = #{studentId}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询班主任管理的班级信息 -->
|
|
|
+ <select id="selectTeacherClasses" parameterType="Long" resultType="map">
|
|
|
+ SELECT
|
|
|
+ c.id as value,
|
|
|
+ c.class_name as label,
|
|
|
+ c.grade,
|
|
|
+ c.college_name,
|
|
|
+ c.major_name,
|
|
|
+ c.current_student_count
|
|
|
+ FROM xg_class_msg c
|
|
|
+ WHERE c.deleted = 0
|
|
|
+ AND c.class_status = '1'
|
|
|
+ AND c.class_teacher_id = #{teacherId}
|
|
|
+ AND c.tenant_id = '000000'
|
|
|
+ ORDER BY c.grade DESC, c.class_name
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!-- 查询实习状态统计数据 -->
|
|
|
+ <select id="selectInternshipStatistics" parameterType="org.dromara.zsjy.domain.bo.InternshipInfoQueryBO"
|
|
|
+ resultType="map">
|
|
|
+ SELECT
|
|
|
+ COUNT(*) as totalCount,
|
|
|
+ COUNT(CASE WHEN i.internship_status IS NOT NULL AND i.internship_status != '' THEN i.internship_id END) as internshipCount,
|
|
|
+ COUNT(CASE WHEN i.internship_status IS NULL OR i.internship_status = '' THEN 1 END) as noInternshipCount,
|
|
|
+ CONCAT(ROUND(IFNULL(COUNT(CASE WHEN i.internship_status IS NOT NULL AND i.internship_status != '' THEN i.internship_id END) * 100.0 / NULLIF(COUNT(*), 0), 0), 2), '%') as internshipRate
|
|
|
+ FROM xg_student_msg s
|
|
|
+ LEFT JOIN xg_class_msg c ON s.class_id = c.id AND c.tenant_id = '000000'
|
|
|
+ LEFT JOIN zsjy_internship_info i ON s.id = i.student_id AND i.deleted = 0 AND i.tenant_id = '000000'
|
|
|
+ WHERE s.deleted = 0
|
|
|
+ AND c.deleted = 0
|
|
|
+ AND s.student_status = '1'
|
|
|
+ AND s.tenant_id = '000000'
|
|
|
+ <include refid="selectInternshipInfoWhere"/>
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|