Files
zhxg_java/srs-comprehensive/src/main/resources/mapper/comprehensive/CphProRankingMapper.xml

172 lines
9.5 KiB
XML
Raw Normal View History

2025-07-28 15:14:11 +08:00
<?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="com.srs.comprehensive.mapper.CphProRankingMapper">
<resultMap type="CphProRanking" id="CphProRankingResult">
<result property="id" column="id" />
<result property="stuNo" column="stu_no" />
<result property="classId" column="class_id" />
<result property="classCode" column="class_code" />
<result property="stuYearId" column="stu_year_id" />
<result property="courseCredit" column="course_credit" />
<result property="totalCredit" column="total_credit" />
<result property="totalScore" column="total_score" />
<result property="courseNum" column="course_num" />
<result property="avgScore" column="avg_score" />
<result property="avgCredit" column="avg_credit" />
<result property="ranking" column="ranking" />
<result property="nopass" column="nopass" />
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createDate" column="create_date" />
<result property="updateBy" column="update_by" />
<result property="updateDate" column="update_date" />
</resultMap>
<sql id="selectCphProRankingVo">
select id, stu_no, class_id, class_code, stu_year_id, course_credit, total_credit, total_score, course_num, avg_score, avg_credit, ranking, nopass, status, create_by, create_date, update_by, update_date from cph_pro_ranking
</sql>
<select id="selectCphProRankingList" parameterType="CphProRankingDto" resultMap="CphProRankingResult">
<include refid="selectCphProRankingVo"/>
<where>
<if test="stuNo != null and stuNo != ''"> and stu_no = #{stuNo}</if>
<if test="classId != null "> and class_id = #{classId}</if>
<if test="classCode != null and classCode != ''"> and class_code = #{classCode}</if>
<if test="stuYearId != null "> and stu_year_id = #{stuYearId}</if>
<if test="courseCredit != null "> and course_credit = #{courseCredit}</if>
<if test="totalCredit != null "> and total_credit = #{totalCredit}</if>
<if test="totalScore != null "> and total_score = #{totalScore}</if>
<if test="courseNum != null "> and course_num = #{courseNum}</if>
<if test="avgScore != null "> and avg_score = #{avgScore}</if>
<if test="avgCredit != null "> and avg_credit = #{avgCredit}</if>
<if test="ranking != null "> and ranking = #{ranking}</if>
<if test="nopass != null "> and nopass = #{nopass}</if>
<if test="status != null "> and status = #{status}</if>
<if test="createDate != null "> and create_date = #{createDate}</if>
<if test="updateDate != null "> and update_date = #{updateDate}</if>
</where>
</select>
<select id="selectCphProRankingById" parameterType="Long" resultMap="CphProRankingResult">
<include refid="selectCphProRankingVo"/>
where id = #{id}
</select>
<select id="getRankList" parameterType="CphProRank" resultType="CphProRank">
SELECT a.id,a.stu_no,ss.name as xsxm,b.class_name, CASE WHEN c.stu_year_name IS NULL THEN '未知' ELSE c.stu_year_name END AS
stu_year_name, course_credit, total_credit, total_score, course_num, avg_score, avg_credit, ranking, nopass
from cph_pro_ranking as a
left join srs_class as b on a.class_id=b.class_id
left join srs_stu_year as c on a.stu_year_id=c.id
left join srs_student ss on a.stu_no = ss.stu_no
<where>
<if test="stuNo != null and stuNo != ''"> and a.stu_no = #{stuNo}</if>
<if test="xsxm != null and xsxm != ''"> and xsxm = #{xsxm}</if>
<if test="classId != null "> and a.class_id = #{classId}</if>
<if test="classCode != null and classCode != ''"> and a.class_code = #{classCode}</if>
<if test="stuYearId != null "> and a.stu_year_id = #{stuYearId}</if>
<if test="courseCredit != null "> and course_credit = #{courseCredit}</if>
<if test="totalCredit != null "> and total_credit = #{totalCredit}</if>
<if test="totalScore != null "> and total_score = #{totalScore}</if>
<if test="courseNum != null "> and course_num = #{courseNum}</if>
<if test="avgScore != null "> and avg_score = #{avgScore}</if>
<if test="avgCredit != null "> and avg_credit = #{avgCredit}</if>
<if test="ranking != null "> and ranking = #{ranking}</if>
<if test="nopass != null "> and nopass = #{nopass}</if>
</where>
</select>
<insert id="insertCphProRanking" parameterType="CphProRankingDto" useGeneratedKeys="true" keyProperty="id">
insert into cph_pro_ranking
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stuNo != null">stu_no,</if>
<if test="classId != null">class_id,</if>
<if test="classCode != null">class_code,</if>
<if test="stuYearId != null">stu_year_id,</if>
<if test="courseCredit != null">course_credit,</if>
<if test="totalCredit != null">total_credit,</if>
<if test="totalScore != null">total_score,</if>
<if test="courseNum != null">course_num,</if>
<if test="avgScore != null">avg_score,</if>
<if test="avgCredit != null">avg_credit,</if>
<if test="ranking != null">ranking,</if>
<if test="nopass != null">nopass,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="createDate != null">create_date,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateDate != null">update_date,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stuNo != null">#{stuNo},</if>
<if test="classId != null">#{classId},</if>
<if test="classCode != null">#{classCode},</if>
<if test="stuYearId != null">#{stuYearId},</if>
<if test="courseCredit != null">#{courseCredit},</if>
<if test="totalCredit != null">#{totalCredit},</if>
<if test="totalScore != null">#{totalScore},</if>
<if test="courseNum != null">#{courseNum},</if>
<if test="avgScore != null">#{avgScore},</if>
<if test="avgCredit != null">#{avgCredit},</if>
<if test="ranking != null">#{ranking},</if>
<if test="nopass != null">#{nopass},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createDate != null">#{createDate},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateDate != null">#{updateDate},</if>
</trim>
</insert>
<insert id="batchInsertCphProRanking">
INSERT INTO cph_pro_ranking (
stu_no, class_id, class_code, stu_year_id, course_credit,
total_credit, total_score, course_num, ranking, avg_credit,
avg_score, nopass, create_by, create_date, status
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.stuNo}, #{item.classId}, #{item.classCode}, #{item.stuYearId}, #{item.courseCredit},
#{item.totalCredit}, #{item.totalScore}, #{item.courseNum}, #{item.ranking}, #{item.avgCredit},
#{item.avgScore}, #{item.nopass}, #{item.createBy}, #{item.createDate}, #{item.status}
)
</foreach>
</insert>
<update id="updateCphProRanking" parameterType="CphProRankingDto">
update cph_pro_ranking
<trim prefix="SET" suffixOverrides=",">
<if test="stuNo != null">stu_no = #{stuNo},</if>
<if test="classId != null">class_id = #{classId},</if>
<if test="classCode != null">class_code = #{classCode},</if>
<if test="stuYearId != null">stu_year_id = #{stuYearId},</if>
<if test="courseCredit != null">course_credit = #{courseCredit},</if>
<if test="totalCredit != null">total_credit = #{totalCredit},</if>
<if test="totalScore != null">total_score = #{totalScore},</if>
<if test="courseNum != null">course_num = #{courseNum},</if>
<if test="avgScore != null">avg_score = #{avgScore},</if>
<if test="avgCredit != null">avg_credit = #{avgCredit},</if>
<if test="ranking != null">ranking = #{ranking},</if>
<if test="nopass != null">nopass = #{nopass},</if>
<if test="status != null">status = #{status},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createDate != null">create_date = #{createDate},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateDate != null">update_date = #{updateDate},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCphProRankingById" parameterType="Long">
delete from cph_pro_ranking where id = #{id}
</delete>
<delete id="deleteCphProRankingByIds" parameterType="String">
delete from cph_pro_ranking where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>