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

212 lines
11 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.CphBiyeApplyMapper">
<resultMap type="CphBiyeApply" id="CphBiyeApplyResult">
<result property="id" column="id" />
<result property="stuNo" column="stu_no" />
<result property="stuYearId" column="stu_year_id" />
<result property="classTwo" column="class_two" />
<result property="youthStudy" column="youth_study" />
<result property="zzmm" column="zzmm" />
<result property="classPost" column="class_post" />
<result property="goodHis" column="good_his" />
<result property="mainHis" column="main_his" />
<result property="fdyCmt" column="fdy_cmt" />
<result property="xwCmt" column="xw_cmt" />
<result property="jwcCmt" column="jwc_cmt" />
<result property="applyStatus" column="apply_status" />
<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 id="selectCphBiyeApplyVo">
select id, stu_no, stu_year_id, class_two, youth_study, zzmm, class_post, good_his, main_his, fdy_cmt, xw_cmt, jwc_cmt, apply_status, create_by, create_time, update_by, update_time from cph_biye_apply
</sql>
<select id="exportView" parameterType="CphSearch" resultType="CphBiyeApplyVo">
SELECT a.*,c.`name` as stu_name,d.class_name,e.major_name,b.id_card,e.major_type_name,
f.dept_name,g.`name` as teacher_name,h.stu_year_name, NOW() as import_time,
case
when a.apply_status = 1 then '已提交待辅导员审核'
when a.apply_status = 6 then '学工审核通过'
when a.apply_status = 10 then '驳回'
when a.apply_status = 11 then '拒绝'
when a.apply_status = 12 then '作废'
when a.apply_status = 2 then '辅导员审核通过'
when a.apply_status = 3 then '学院审核通过'
else '无状态' end as apply_status_ex,
(select major_count from view_stu_major_count where major_id = d.major_id and grade_id = d.grade_id) as major_count,
i.major_rank as stu_major_rank
from cph_biye_apply as a
left join srs_student as c on a.stu_no = c.stu_no
left join srs_class as d on c.class_id = d.class_id
left join srs_majors as e on d.major_id = e.major_id
left join sys_dept as f on e.college_id = f.dept_id
left join cph_teacher as g on d.teacher_id = g.teacher_id
left join srs_stu_year as h on a.stu_year_id = h.id
left join view_sum_stu_score_rank as i on a.stu_no = i.stu_no
left join view_stu_info as b on a.stu_no = b.stu_no
<where>
<if test="stuNo != null and stuNo != ''"> and a.stu_no = #{stuNo}</if>
<if test="stuName != null and stuName != ''"> and c.`name` like concat('%', #{stuName}, '%')</if>
<if test="classId != null and classId != ''"> and d.class_id = #{classId}</if>
<if test="majorId != null and majorId != ''"> and d.major_id = #{majorId}</if>
<if test="deptId != null and deptId != ''"> and f.dept_id = #{deptId}</if>
<if test="tNo != null and tNo != ''"> and g.employee_id = #{tNo}</if>
<if test="status != null and status != ''"> and a.apply_status = #{status}</if>
<if test="stuYearId != null and stuYearId != ''"> and a.stu_year_id = #{stuYearId}</if>
</where>
ORDER BY a.id desc , a.apply_status asc
</select>
<select id="listView" parameterType="CphSearch" resultType="CphBiyeApplyVo">
SELECT a.*,i.nick_name as fdy_no_name,j.nick_name as xw_no_name,k.nick_name as xg_no_name,c.`name` as stu_name,d.class_name,e.major_name,e.major_type_name,
f.dept_name,g.`name` as teacher_name,h.stu_year_name, NOW() as import_time,
case
when a.apply_status = 1 then '已提交待辅导员审核'
when a.apply_status = 6 then '学工审核通过'
when a.apply_status = 10 then '驳回'
when a.apply_status = 11 then '拒绝'
when a.apply_status = 12 then '作废'
when a.apply_status = 2 then '辅导员审核通过'
when a.apply_status = 3 then '学院审核通过'
else '无状态' end as apply_status_ex
from cph_biye_apply as a
left join srs_student as c on a.stu_no = c.stu_no
left join srs_class as d on c.class_id = d.class_id
left join srs_majors as e on d.major_id = e.major_id
left join sys_dept as f on e.college_id = f.dept_id
left join cph_teacher as g on d.teacher_id = g.teacher_id
left join srs_stu_year as h on a.stu_year_id = h.id
left join sys_user as i on a.fdy_no = i.user_name
left join sys_user as j on a.xw_no = j.user_name
left join sys_user as k on a.xg_no = k.user_name
<where>
<if test="stuNo != null and stuNo != ''"> and a.stu_no = #{stuNo}</if>
<if test="stuName != null and stuName != ''"> and c.`name` like concat('%', #{stuName}, '%')</if>
<if test="classId != null and classId != ''"> and d.class_id = #{classId}</if>
<if test="majorId != null and majorId != ''"> and d.major_id = #{majorId}</if>
<if test="deptId != null and deptId != ''"> and f.dept_id = #{deptId}</if>
<if test="tNo != null and tNo != ''"> and g.employee_id = #{tNo}</if>
<if test="status != null and status != ''"> and a.apply_status = #{status}</if>
<if test="stuYearId != null and stuYearId != ''"> and a.stu_year_id = #{stuYearId}</if>
</where>
ORDER BY a.id desc , a.apply_status asc
</select>
<select id="getOwnStuScoreMajorRank" parameterType="String" resultType="CphClassRankScore">
select a.major_rank , b.major_count
from view_sum_stu_score_rank as a
left join view_major_grade_stu_count as b on a.major_id = b.major_id and a.grade_id = b.grade_id
where a.stu_no = #{stuNo};
</select>
<select id="selectCphBiyeApplyList" parameterType="CphBiyeApply" resultMap="CphBiyeApplyResult">
<include refid="selectCphBiyeApplyVo"/>
<where>
<if test="stuNo != null and stuNo != ''"> and stu_no = #{stuNo}</if>
<if test="stuYearId != null "> and stu_year_id = #{stuYearId}</if>
<if test="classTwo != null and classTwo != ''"> and class_two = #{classTwo}</if>
<if test="youthStudy != null and youthStudy != ''"> and youth_study = #{youthStudy}</if>
<if test="zzmm != null and zzmm != ''"> and zzmm = #{zzmm}</if>
<if test="classPost != null and classPost != ''"> and class_post = #{classPost}</if>
<if test="goodHis != null and goodHis != ''"> and good_his = #{goodHis}</if>
<if test="mainHis != null and mainHis != ''"> and main_his = #{mainHis}</if>
<if test="fdyCmt != null and fdyCmt != ''"> and fdy_cmt = #{fdyCmt}</if>
<if test="xwCmt != null and xwCmt != ''"> and xw_cmt = #{xwCmt}</if>
<if test="jwcCmt != null and jwcCmt != ''"> and jwc_cmt = #{jwcCmt}</if>
<if test="applyStatus != null and applyStatus != ''"> and apply_status = #{applyStatus}</if>
</where>
</select>
<select id="selectCphBiyeApplyById" parameterType="Long" resultMap="CphBiyeApplyResult">
<include refid="selectCphBiyeApplyVo"/>
where id = #{id}
</select>
<insert id="insertCphBiyeApply" parameterType="CphBiyeApply" useGeneratedKeys="true" keyProperty="id">
insert into cph_biye_apply
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stuNo != null">stu_no,</if>
<if test="stuYearId != null">stu_year_id,</if>
<if test="classTwo != null">class_two,</if>
<if test="youthStudy != null">youth_study,</if>
<if test="zzmm != null">zzmm,</if>
<if test="classPost != null">class_post,</if>
<if test="goodHis != null">good_his,</if>
<if test="mainHis != null">main_his,</if>
<if test="fdyCmt != null">fdy_cmt,</if>
<if test="xwCmt != null">xw_cmt,</if>
<if test="jwcCmt != null">jwc_cmt,</if>
<if test="applyStatus != null">apply_status,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stuNo != null">#{stuNo},</if>
<if test="stuYearId != null">#{stuYearId},</if>
<if test="classTwo != null">#{classTwo},</if>
<if test="youthStudy != null">#{youthStudy},</if>
<if test="zzmm != null">#{zzmm},</if>
<if test="classPost != null">#{classPost},</if>
<if test="goodHis != null">#{goodHis},</if>
<if test="mainHis != null">#{mainHis},</if>
<if test="fdyCmt != null">#{fdyCmt},</if>
<if test="xwCmt != null">#{xwCmt},</if>
<if test="jwcCmt != null">#{jwcCmt},</if>
<if test="applyStatus != null">#{applyStatus},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateCphBiyeApply" parameterType="CphBiyeApply">
update cph_biye_apply
<trim prefix="SET" suffixOverrides=",">
<if test="stuNo != null">stu_no = #{stuNo},</if>
<if test="stuYearId != null">stu_year_id = #{stuYearId},</if>
<if test="classTwo != null">class_two = #{classTwo},</if>
<if test="youthStudy != null">youth_study = #{youthStudy},</if>
<if test="zzmm != null">zzmm = #{zzmm},</if>
<if test="classPost != null">class_post = #{classPost},</if>
<if test="goodHis != null">good_his = #{goodHis},</if>
<if test="mainHis != null">main_his = #{mainHis},</if>
<if test="fdyCmt != null">fdy_cmt = #{fdyCmt},</if>
<if test="xwCmt != null">xw_cmt = #{xwCmt},</if>
<if test="jwcCmt != null">jwc_cmt = #{jwcCmt},</if>
<if test="applyStatus != null">apply_status = #{applyStatus},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteCphBiyeApplyById" parameterType="Long">
delete from cph_biye_apply where id = #{id}
</delete>
<delete id="deleteCphBiyeApplyByIds" parameterType="String">
delete from cph_biye_apply where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>